Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
I had a user ask me to help him write a script which would make symbolic links to newly downloaded files. These symbolic links would then be used by Handbrake on his Apple Silicon Mac (wicked fast in transcoding!), to transcode these new downloads.
Additionally the original (downloaded) filename should stay the same so importing a transcode file would be easy to manually import (maintaining quality, release group, etc).
Initially this seemed a challenge until I found out that Sonarr has the option to run a custom scrip after importing new episodes.
In Sonarr, go to "Settings" -> "Connect" -> "+" -> "Custom Script"
Enter a "Name" so you know what it's for.
Select on what events your custom scripts needs to run. In our example: on Import (downloaded or manually imported) and on Upgrade.
In the "Path" box enter the location and filename of the script you'd like to run. Note that the script needs to run on the same machine (in this case: the NAS) where Sonarr is running.
You can make this file just and empty file initially, and enter the file path and click "Test" to make sure the script can be found etc.
Where ${sonarr_episodefile_scenename} is the original filename, but unfortunately without file extension. Next, ${sonarr_episodefile_sourcepath} holds the new filename with extension. To grab only the extension we use ${sonarr_episodefile_sourcepath##*.}.
- We only want downloads (new and upgrades). Manual imports should be skipped!
This means that the source path should match the downloads folder or part of that name, so in our example the name should include "nzbget" in the original file path. If is doesn't include "nzbget" then we can skip it as it's most likely a manual import.
All combined; this is what I came up with (suitable for Linux or macOS environment - may work different under Windows):
#!/bin/bash
nzbget_path_portion="nzbget"
# Skip all files that do NOT come from NZBGet
if ! [[ "${sonarr_episodefile_sourcepath}" =~ ${nzbget_path_portion} ]]; then
exit
fi
#original downloaded name
ln -s "${sonarr_episodefile_path}" "/share/Downloads/Media Files/Sonarr - New arrivals/${sonarr_episodefile_scenename}.${sonarr_episodefile_sourcepath##*.}"
All files in "/share/Downloads/Media Files/Sonarr - New arrivals/" will now be symbolic links to newly downloaded or upgraded episodes (skipping manual imports), which can be transcoded with Handbrake or other tools. The symbolic links can be deleted or moved without affecting the original files. Of course opening one of these, editing, say in a video editor, and saving it again WILL change the original files.
If you'd like to make a dump of all known variables provided by Sonarr (and the Linux environment), add something like this to the beginning of your script (before the "exit")
# All environment vars:
env > "/share/Downloads/Media Files/envdump.txt"
Or if you want to test/add a single variable, for example:
# Single environment var:
echo "$sonarr_episodefile_scenename" >> "/share/Downloads/Media Files/envdump.txt"
Photopea A free alternative to Photoshop (pretty close anyway), and runs in your browser - this works surprisingly good!
PreLoaders Handy little online tool to generate preload images (spinners).
RegExr Awesome website to play and experiment with regular expression!
PhotoStream2Folder Handy little program that automatically downloads pictures and videos from iCloud - highly recommended
0xED - Hex Editor Compact, fast and very flexible Hex (hexadecimal) editor for MacOS.
7-Zip One of the best, free, and most efficient Windows archive and unarchive utilties around. Support quite a few formats as well.
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
ConnectMeNow4-v4.0.18-macOS-x86-64.dmgDate: 2024-04-24 - Size: 3.5 MBVersion 4 of ConnectMeNow - A tool for more convenient mounting of network shares under macOS. This is the Intel version which works on Intel and Apple Silicon Macs.
ConnectMeNow4-v4.0.18-macOS-arm64.dmgDate: 2024-04-24 - Size: 3 MBVersion 4 of ConnectMeNow - A tool for more convenient mounting of network shares under macOS. This is the Apple Silicon version (not suitable for Intel).
MiniWOL2 MacOS (64 bits Apple Silicon)Date: 2023-08-01 - Size: 1.2 MBminiWol is a simple, but effective application to send Wake On LAN to network devices. This is the signed 64 bit MacOS ARM (Apple Silicon) version.
MovieScanner2-2.2.3-Windows-32bit-setup.exeDate: 2023-04-12 - Size: 18.6 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 32 bit Windows version.
MovieScanner2-2.2.2-Linux-GTK-64bits.tar.gzDate: 2023-04-11 - Size: 29.2 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 64 bit Linux version for GTK.
MovieScanner2-2.2.2-Linux-QT5-64bits.tar.gzDate: 2023-04-11 - Size: 29.1 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 64 bit Linux version for QT5.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through these Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).