Skip to content

qBittorrent post processing script, with Subtitle extraction and cleaning, Radarr and Medusa Import.

License

Notifications You must be signed in to change notification settings

Rouzax/TorrentScript

Repository files navigation

TorrentScript

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 :)

Description

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:

  1. Unpack or copy to Temporary Processing folder defined in config.json (copy from config-sample.json)
  2. 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
  3. 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
  4. If there is another Label will just unpack or extract
  5. Clean up Temporary folder
  6. If there is no Label set or label is NoProcess script will exit
  7. Send an email with result

Success
Success
Medusa wrong host
Medusa wrong host
Unrar error
Unrar error

Installation

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'

qBittorrent settings page

Other important setting is that for each torrent a new Folder needs to be created. qBittorrent Folder settings page

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
    Radarr Remote Path Mapping settings page

With this setup, Radarr will never find the finished torrent download and only this script will trigger the import.

Required external tools

The following external tools need to be available and the path defined in the config.json

About

qBittorrent post processing script, with Subtitle extraction and cleaning, Radarr and Medusa Import.

Resources

License

Stars

Watchers

Forks

Packages