qBittorrent post processing script with import to Radarr and Medusa by using a temporary directory.
Caveat: I'm not a programmer, so use at own risk :)
Only 1 instance of the script will be running and if other downloads complete during execution they will wait on the first script to finish. This is to prevent a system overload.
Script will do the following:
- Unpack or copy to Temporary Processing folder defined in config.json (copy from config-sample.json)
- If torrent label is TV show as defined in config.json Label
- Will strip all srt subtitle languages not in config.json WantedLanguages from MKV
- Extract all SRT subtitles in config.json WantedLanguages from MKV
- Will try to download missing subs from OpenSubtitles.com
- Renames all srt files from ISO 639-2 (3 letter codes) to ISO 639-1 (2 letter codes) as defined in LanguageCodes.json
- Clean up the srt subtitles using Subtitle Edit
- Remove Hearing Impaired.
- Fix Common errors.
- Start Medusa Import
- If torrent label is Movie as defined in config.json Label
- Will strip all srt subtitle languages not in config.json WantedLanguages from MKV
- Extract all SRT subtitles in config.json WantedLanguages from MKV
- Will try to download missing subs from OpenSubtitles.com
- Renames all srt files from ISO 639-2 (3 letter codes) to ISO 639-1 (2 letter codes) as defined in LanguageCodes.json
- Clean up the srt subtitles using Subtitle Edit
- Remove Hearing Impaired.
- Fix Common errors.
- Start Radarr Import
- If there is another Label will just unpack or extract
- Clean up Temporary folder
- If there is no Label set or label is
NoProcess
script will exit - Send an email with result
Success
Medusa wrong host
Unrar error
Need to create a config.json in the root folder of the script, you can copy the config-sample.json.
Script needs to be called from qBittorrent after download is finished with the following command
powershell "C:\Scripts\TorrentScript\TorrentScript.ps1" -DownloadPath '%R' -DownloadLabel '%L' -TorrentHash '%I'
Other important setting is that for each torrent a new Folder needs to be created.
Within Radarr you need to set up Remote Path Mapping to an empty folder, otherwise Radarr will pick up to downloads directly from qbittorent
Example:
- qBittorent root download path = C:\Torrent\Downloads\
- Radarr Remote Path Mapping = C:\Torrent\Radarr
With this setup, Radarr will never find the finished torrent download and only this script will trigger the import.
The following external tools need to be available and the path defined in the config.json