[UNRAR] [WIN]: **NEW** Guide to auto-process .rar torrents via Sonarr w/o Drone Factory [edit: 01 SEP 17]

  • Last Edited:01 SEP 2017 (minor edits)

  • EDIT: THIS WILL ONLY PARTIALLY WORK WITH RADARR given current code. The tool that is used (NZBToMedia) will auto-extract the movie, but no method is in place to call Radarr for importing. So, you can use NTM as an auto extractor for Radarr, however, you’ll still need to use the drone factory to import. See this post which I authored for more details. I also got word that there is work to make this fully functional with Radarr.

  • DO NOT LET THE LENGTH OF THIS GUIDE SCARE YOU, the actual configuration using the guide should take no more than 15 minutes.

  • If you want to skip all the intro stuff and go directly to the config - go to Para 7 “Configuration”


1. OBJECTIVE: This NEW and tested method will enable the user to configure their environment to do the following:
a. Process all Torrent downloads (compressed and uncompressed) automatically and unmonitored with no intervention required by the user and minimal additional software.
b. Migrate from using the “Drone Factory” within Sonarr as it will soon no longer exist as a function.
c. Server can complete all tasks using system services (user does NOT need to be logged on)
d. Avoid file locks, media duplication, and the use of hard/sym links (if preferred)
e. Ensures that Torrent client (Deluge) + NZB downloader (if used) do not conflict.
f. Enables Sonarr to Handle completed and failed downloads – HUGE


2. Background:

Sonarr is fucking dope. Huge shout out to the devs @Taloth and @markus101 and @clinton-hall who created the software to make this work. However, If you are using Sonarr and Radarr, there is one issue that has been plaguing Windows users who use torrents: The inability to auto-extract and process compressed torrent downloads (.RAR). NZBs are not an issue because software like SABnzbd extracts releases before post-processing. And if you’re using Linux, please close this page now.There were several methods to complete this with somewhat complicated methods( including this one I authored), that all relied on the Sonarr function “Drone Factory”. However, this function is being depreciated . This left many users no method to address this issue. This guide will resolve that.

  • If you have a better suggestion, please comment below, however, ensure that your suggestions address all the objectives listed above. If you say, “but bro, just download a Linux docker and you’ll be golden bro.” I’m going to find you and poop in your beer.

3. Software Needed:

NOTE: This guide assumes you already have the necessary software installed to run Sonarr/Radarr, your DL clients, and their dependancy software. If that software is not working properly, I suggest you debug those issues first before implementing this (especially file permission problems). Although the implementation of this feature is somewhat easy, it can be considered an advanced configuration.


4. Non-standard vocab:

a. “NTM” - NzbToMedia – Software that extracts releases from torrent client and sends command to Sonarr for post-processing.
b. “Release” – raw .torrent/NZB unprocessed data sent from Sonarr to download client.
c. .RAR/.NZB – Compressed files downloaded via download client
d. “Finished DIR” – Directory where torrent/NZB client sends finished downloads for seeding/processing by NTM (NOT Sonarr).
e. “Done DIR” – Intermediate/temporary directory where NTM sends fully extracted media for post-processing by Sonarr.
g. “Media DIR” - Directory where the media is placed via Sonarr at end of job. This is usually the directory where your front end media player (PLEX/KODI) serves media.


5. Environment: This has been tested on two different rigs, I personally, am using the following:

  • Server: Windows 10E 1703 CU x64 (Sonarr, PLEX, Deluge all run as system services)

  • Seedbox (LAN): VM Windows 10P 1703 (VPN, Deluge, NTM)

  • Directory/File Structure (example, however, don’t screw this up, it’s important):

    NOTE: (I have everything below d:\downloads hard-linked to my seedbox, however, a mapped network drive, FTP, etc would all work as long as Sonarr and your DL client can write to them, make sure to test your file structure FIRST before implementing this configuration)

├── D:\ [root non-system directory]
	├── Media\ [Media DIR which PLEX/Kodi uses to serve fully processed media]
		├── Movies
		├── TV
	├── Downloads\ [root folder where all downloads reside]
		├── Drone\ [temp DIR]
			├── TV [created by NTM]
			├── Movies [created by NTM]
		├── Incomplete\ [currently downloading]
			├── TV 
			├── Movies
		├── TV\ [finished/seeding DIR]
			├── Torrents
			├── NZBs
		├── Movies\ [finished/seeding dir]
			├── Torrents
			├── NZBs
		├── Empty [empty DIR which will be used for Sonarr’s “remote path mapping” **important**

6. Process explanation (How this shit works):

  • non-Rar release flow:
  1. Sonarr sends release (non-.RAR) to deluge appends “TV” Label ->
  2. Deluge begins downloading in Incomplete DIR ->
  3. Sonarr tracks download because “TV” label is appended to torrent ->
  4. Deluge completes download, moves torrent data to finished DIR, begins seeding->
  5. Sonarr doesn’t import because remote path is EMPTY. ->
  6. Deluge executes NTM script ->
  7. NTM doesn’t detect .rar, COPIES release to drone folder in sub dir \TV\releasename\release.mkv ->
  8. NTM sends EPISODEASCAN command to sonarr ->
  9. Sonarr finds extracted media file in dir \TV\releasename\ ->
  10. Sonarr imports, post-processes, and MOVES release to final destination.
  11. COMPLETE: Release is copied to final media DIR, Drone DIR is clean, torrent is still being seeding in its original finished dir.
  • Rar-Release flow:
  1. Sonarr sends release (.RAR) to deluge appends “TV” Label ->
  2. no change
  3. no change
  4. no change
  5. Sonarr doesn’t import because remote path is EMPTY. ->
  6. Deluge executes NTM script ->
  7. NTM detects .RAR, auto pauses torrent, extracts release, sends ONLY extracted media file to drone folder in sub dir \TV\releasename\release.mkv, resumes torrent for seeding ->
  8. NTM sends EPISODESCAN command to sonarr ->
  9. Sonarr finds extracted media file in dir \TV\releasename\ ->
  10. Sonarr MOVES release to final media destination.
  11. COMPLETE: Release is extracted, sent to Media DIR, Drone DIR is clean, original .rar torrent is still being seeding in finished DIR

Note 1: See the bottom of this guide for what the NTM LOG should look like after process is completed

Note 2: NTM Will “evaluate” ALL torrents once completed downloading because the Auto-Extract plugin does NOT allow you to execute based on labels. However, NTM will ONLY process those completed downloads which match the label you set forth in the NTM config file. By design, you will/should see this line in the NTM logs for every completed download that DOES NOT meet the processing criteria:

2017-07-20 06:52:10 ERROR   ::MAIN: Category:[LABEL] is not defined or is not enabled. Please rename it or ensure it is enabled for the appropriate section in your autoProcessMedia.cfg and try again.
2017-07-20 06:52:10 ERROR   ::MAIN: A problem was reported in the C:\nzbToMedia\TorrentToMedia.py script.

7. Configuration

  • Sonarr:
    Sonarr settings -> Download client ->
  1. ENABLE completed download handling
  2. ENABLE Remove
  3. Redownload Failed download: I recommend YES
  4. Remove Failed downloads: I recommend YES
  5. DISABLE: Drone factory
  6. Remote Path Mappings:
    • Host: IP address of host you entered for your download client
    • Remote Path: location to an EMPTY Dir, Local Path: same
      (exmaple: I created an empty dir on my seedbox at d:\downloads\empty and the same on the server (Sonarr)).
  7. Optional: configure your NZB downloader in the same manner
  • Deluge (Or your preferred torrent client):
  1. Preferences -> Downloads
    • Download to: Incomplete DIR (DO NOT TOUCH ANYTHING ELSE. (The autoadd plugin will handle the rest))
  2. Preferences -> Plug-ins:
    • Enable: LABEL, Create Labels from deluge main screen: (TV, Movies, etc.).
    • Enable: AutoAdd, add “Watch Folder” path for each label you created from above (Screenshot)
      • Path Options:
      • Watch folder d:\downloads\Incomplete\TV
      • Set download location: d:\downloads\Incomplete\TV
      • Move completed: d:\downloads\TV\torrents (this will be your Completed DIR)
      • Label: TV
    • Enable: Execute
      • Add Command:
      • Event: Torrent Complete,
      • Comand: C:\NZBtoMedia\torrenttomedia.bat
        (We will create this file later when we clone the NTM repo)
  • NZBtoMedia

Note 1: Make sure the NTM config is completed/executed on the box that is running your torrent client aka seedbox)

Note 2: I recommend first browsing to the NTM repo and read the wiki so you can understand how this works. There might be some dependant software you need to install (7-zip)

Note 3: NTM does A LOT more than just auto-extract. As you see in the below .cfg file there are MANY options to fully encode, meta-data, etc. For this purpose, I will only cover the basic code that needs to be in place for this extractions and auto-import process to work.

  1. Clone Repo from https://github.com/clinton-hall/nzbToMedia
  2. Command Prompt ->
  1. This will create a folder at C:\NZBtoMedia with all the files from the remote repo.
  2. CD to c:\NZBtoMedia
  3. Create a .txt file in c:\nzbtoMedia\torrenttomedia.txt (This will be the script DELUGE executes when a torrent is completed downloading
  4. Edit torrenttomedia.txt ->
  • Insert the text: “ C:\nzbToMedia\torrenttomedia.py %1 %2 %3 " (One single line, without quotes).
  • save .txt file.
  • Rename torrenttomedia.txt to torrenttomedia.bat
  1. Copy and rename AutoProcessmeda.cfg.spec to autoprocessmedia.cfg
  2. Edit \NZBtoMedia\autoproecssmedia.cfg with the following values:
[General]
    # Enable/Disable update notifications
    version_notify = 1
    # Enable/Disable automatic updates
    auto_update = 1
    # Set to the full path to the git executable
    git_path = ""
    # GitHUB user for repo
    git_user = ""
    # GitHUB branch for repo
    git_branch = ""
    # Enable/Disable forceful cleaning of leftover files following postprocess 
    force_clean = 1
    # Enable/Disable logging debug messages to nzbtomedia.log
    log_debug = 0
    # Enable/Disable logging database messages to nzbtomedia.log
    log_db = 1
    # Enable/Disable logging environment variables to debug nzbtomedia.log (helpful to track down errors calling external tools.)
    log_env = 1
    # Enable/Disable logging git output to debug nzbtomedia.log (helpful to track down update failures.)
    log_git = 1
    # Set to the directory where your ffmpeg/ffprobe executables are located
    ffmpeg_path = ""
    # Enable/Disable media file checking using ffprobe.
    check_media = 0
    # Enable/Disable a safety check to ensure we don't process all downloads in the default_downloadDirectories by mistake.
    safe_mode = 1
    # Turn this on to disable additional extraction attempts for failed downloads. Default = 0 will attempt to extract and verify if media is present.
    no_extract_failed = 0

[NzbDrone]
    #### autoProcessing for TV Series
    #### ndCategory - category that gets called for post-processing with NzbDrone
    [[tv]]
        enabled = 1
        apikey = SonarrAPIKey
        host = IP Address of Sonarr
        port = 38084
        username = ""
        password = ""
        ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
        web_root = /sonarr
        ssl = 0
        delete_failed = 0
        # Enable/Disable linking for Torrents
        Torrent_NoLink = 0
        keep_archive = 1
        extract = 1
        nzbExtractionBy = Downloader
        wait_for = 2
        # Set this to minimum required size to consider a media file valid (in MB)
        minSize = 0
        # Enable/Disable deleting ignored files (samples and invalid media files)
        delete_ignored = 1
        ##### Enable if NzbDrone is on a remote server for this category
        remote_path = 1 (You would enable this if the machine this file resides on (your seebox) is different from the box Sonarr runs on)
        ##### Set to path where download client places completed downloads locally for this category
        watch_dir = C:\Media\PlexDownloads\TV\torrents

[Torrent]
    ###### clientAgent - Supported clients: utorrent, transmission, deluge, rtorrent, vuze, other
    clientAgent = deluge
    ###### useLink - Set to hard for physical links, sym for symbolic links, move to move, move-sym to move and link back, and no to not use links (copy)
    useLink = hard
    ###### outputDirectory - Default output directory (categories will be appended as sub directory to outputDirectory)
    outputDirectory = C:\Media\PlexDownloads\drone
    ###### Enter the default path to your default download directory (non-category downloads). this directory is protected by safe_mode. 
    default_downloadDirectory = C:\Media\PlexDownloads\tv\torrents
    ###### Other categories/labels defined for your downloader. Does not include CouchPotato, SickBeard, HeadPhones, Mylar categories.
    categories = tv
    ###### A list of categories that you don't want to be flattened (i.e preserve the directory structure when copying/linking.
    noFlatten = ""
    #### Deluge (You must edit this if your using TorrentToMedia.py with deluge. Note that the host/port is for the deluge daemon, not the webui)
    DelugeHost = IP.Address
    DelugePort = 58846
    DelugeUSR = 
    DelugePWD = 
    ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
    deleteOriginal = 0 **ENSURE THIS IS 0, if not, once Sonarr post-processes the release, the torrent will fail. 
    chmodDirectory = 0
    resume = 1
    resumeOnFailure = 1

[Extensions]
    compressedExtensions = .zip, .rar, .7z, .gz, .bz, .tar, .arj, .1, .01, .001
    mediaExtensions = .mkv, .avi, .divx, .xvid, .mov, .wmv, .mp4, .mpg, .mpeg, .vob, .iso, .m4v, .ts
    audioExtensions = ""
    metaExtensions = ""

9.Ensure the above file is saved and file permissions are set appropriately.
10.You must now edit the repo code.
11. Within the NTM local repo, find the file: c:\NZBtoMedia\core\autoProcess\autoProcesstv.py
12. Make a backup of the original file, rename it to autoProcesstv.py.default
13. Copy autoProcesstv.py.default, rename to autoProcesstv.py
14. Use a text editor to CHANGE the following lines 251 - 256: Reference this issue as to why you need to edit the repo code.

            if remote_path:
                logger.debug("remote_path: {0}".format(remoteDir(dirName)), section)
                data = {"name": "DownloadedEpisodesScan", "path": remoteDir(dirName), "downloadClientId": download_id, "importMode": "Move"}
            else:
                logger.debug("path: {0}".format(dirName), section)
                data = {"name": "DownloadedEpisodesScan", "path": dirName, "downloadClientId": download_id, "importMode": "Move"}

15.Save autoProcesstv.py
16. TEST the torrenttomedia.bat (ensure your torrent client is OFFLINE) -> If configured correctly, you’ll see a CMD shell, and should disappear.
17. Obviously, it shouldn’t need to process anything, however, look at the logs for obvious errors.
18 Check the logs at c:\nzbdtomedia\logs
19. I would also recommend to TEST the entire process by manually downloading a .RARed .torrent, append the TV label, and see if it auto extracts to your drone folder
20. Once you verify that the Deluge is executing the script, and NTM is extracting and processing files correctly, I would then test the entire process starting by manually downloading a release for a monitored episode from within the Sonarr WebUI and let 'er rip.

PROFIT!


Huge shout out to @TALOTH for taking flack from all of us entitled users (well, a couple of us) who got all triggered when the decision was made to do away with the drone factory. Also, @Clinton-Hall for his dope code that makes this shit all work.

Cheers.



NOTE: Below is what a successful NTM job LOG should look like for both .RARed and Non-RARed releases:

  • RARed Release:
    Result: Release EXTRACTED, copied to drone folder, post-processing completed by Sonarr, Drone DIR clean. BOOM!
2017-07-20 09:37:22 DB      ::MAIN: nzbtomedia.db: UPDATE downloads SET status = ?, client_agent = ?, last_update = ?, input_id = ?, input_hash = ?, input_name = ? WHERE input_directory = ? with args [0, u'deluge', 736530, u'd927ed42a4332c62c65b18179879d7c82dd9eb3b', u'd927ed42a4332c62c65b18179879d7c82dd9eb3b', u'Suits.S07E02.1080p.WEB.x264-TBS', u'C:\\Media\\Plexdownloads\\tv\\Torrents']
2017-07-20 09:37:22 INFO    ::MAIN: SEARCH: Found torrent directory Suits.S07E02.1080p.WEB.x264-TBS in input directory directory C:\Media\Plexdownloads\tv\Torrents
2017-07-20 09:37:22 INFO    ::MAIN: SEARCH: Setting inputDirectory to C:\Media\Plexdownloads\tv\Torrents\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:22 INFO    ::MAIN: Auto-detected SECTION:NzbDrone
2017-07-20 09:37:27 INFO    ::MAIN: Output directory set to: C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:27 INFO    ::MAIN: Extracting C:\Media\Plexdownloads\tv\Torrents\Suits.S07E02.1080p.WEB.x264-TBS\suits.s07e02.1080p.web.x264-tbs.rar to C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:34 INFO    ::MAIN: EXTRACTOR: Extraction was successful for C:\Media\Plexdownloads\tv\Torrents\Suits.S07E02.1080p.WEB.x264-TBS\suits.s07e02.1080p.web.x264-tbs.rar to C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:38 INFO    ::MAIN: FLATTEN: Flattening directory: C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:39 INFO    ::MAIN: Found 1 media files in C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:39 INFO    ::MAIN: Calling NzbDrone:tv to post-process:Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:39 INFO    ::MAIN: Attempting to verify tv fork
2017-07-20 09:37:39 INFO    ::MAIN: NzbDrone:tv fork set to default
2017-07-20 09:37:40 INFO    ::MAIN: FLATTEN: Flattening directory: C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS
2017-07-20 09:37:40 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request
2017-07-20 09:38:00 DB      ::DB: Updating status of our download Suits.S07E02.1080p.WEB.x264-TBS in the DB to 1
2017-07-20 09:38:00 DB      ::MAIN: nzbtomedia.db: UPDATE downloads SET status=?, last_update=? WHERE input_name=? with args [1, 736530, u'Suits.S07E02.1080p.WEB.x264-TBS']
2017-07-20 09:38:06 INFO    ::CLEANDIRS: Directory C:\Media\PlexDownloads\drone\tv\Suits.S07E02.1080p.WEB.x264-TBS has been processed, removing ...
2017-07-20 09:38:06 INFO    ::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed successfully.
  • Non-RARed Release:
    Result: Release COPIED to drone folder, post-processing completed by Sonarr, Drone DIR clean. BOOM!


2017-07-19 06:49:16 INFO    ::MAIN: #########################################################
2017-07-19 06:49:16 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2017-07-19 06:49:16 INFO    ::MAIN: #########################################################
2017-07-19 06:49:16 DB      ::MAIN: nzbtomedia.db: UPDATE downloads SET status = ?, client_agent = ?, last_update = ?, input_id = ?, input_hash = ?, input_name = ? WHERE input_directory = ? with args [0, u'deluge', 736529, u'3756fdc9bab0c77fe3a79918f7b70293c1cc29f0', u'3756fdc9bab0c77fe3a79918f7b70293c1cc29f0', u'The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv', u'C:\\Media\\Plexdownloads\\tv\\Torrents']
2017-07-19 06:49:16 INFO    ::MAIN: SEARCH: Found torrent file The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv in input directory directory C:\Media\Plexdownloads\tv\Torrents
2017-07-19 06:49:16 INFO    ::MAIN: SEARCH: Setting inputDirectory to C:\Media\Plexdownloads\tv\Torrents\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:16 INFO    ::MAIN: Auto-detected SECTION:NzbDrone
2017-07-19 06:49:21 INFO    ::MAIN: Output directory set to: C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:21 INFO    ::COPYLINK: MEDIAFILE: [The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv]
2017-07-19 06:49:21 INFO    ::COPYLINK: SOURCE FOLDER: [C:\Media\Plexdownloads\tv\Torrents]
2017-07-19 06:49:21 INFO    ::COPYLINK: TARGET FOLDER: [C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv]
2017-07-19 06:49:21 INFO    ::COPYLINK: Hard linking SOURCE MEDIAFILE -> TARGET FOLDER
2017-07-19 06:49:21 WARNING ::COPYLINK: Error: Incorrect function.
, copying instead ... 
2017-07-19 06:49:21 INFO    ::COPYLINK: Copying SOURCE MEDIAFILE -> TARGET FOLDER
2017-07-19 06:49:30 INFO    ::MAIN: FLATTEN: Flattening directory: C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:30 INFO    ::MAIN: Found 1 media files in C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:30 INFO    ::MAIN: Calling NzbDrone:tv to post-process:The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:30 INFO    ::MAIN: Attempting to verify tv fork
2017-07-19 06:49:30 INFO    ::MAIN: NzbDrone:tv fork set to default
2017-07-19 06:49:30 INFO    ::MAIN: FLATTEN: Flattening directory: C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv
2017-07-19 06:49:30 POSTPROCESS::NZBDRONE: SUCCESS: The download succeeded, sending a post-process request
2017-07-19 06:49:50 DB      ::DB: Updating status of our download The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv in the DB to 1
2017-07-19 06:49:50 DB      ::MAIN: nzbtomedia.db: UPDATE downloads SET status=?, last_update=? WHERE input_name=? with args [1, 736529, u'The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv']
2017-07-19 06:49:55 INFO    ::CLEANDIRS: Directory C:\Media\PlexDownloads\drone\tv\The.Jim.Jefferies.Show.S01E05.1080p.WEB.x264-TBS.mkv has been processed, removing ...
2017-07-19 06:49:55 INFO    ::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed successfully.

Format complete, published!

Please put in your guide all the software needed to be install like:

Python 2.7
Python for Windows Extensions : https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/

Thanks for the Guide. I’m having the same problems as another user because of Labels are not creating the folders inside the Incomplete Folder. Already saw the permissions, activated Logs on Deluge to see if it was some authentication problems… but nothing… Also saw the python version, all are 2.7. The only thing missing is posting into deluge forums.

In terms of the script of NPM I’m also having difficulties:

[01:30:11] [INFO]::MAIN: nzbToMedia Version:80c8ad58523ab99825c02f3855f9bd3dc9945d57 Branch:master (Windows 10)
Traceback (most recent call last):
File “D:\Tools\nzbToMedia\TorrentToMedia.py”, line 363, in
exit(main(sys.argv))
File “D:\Tools\nzbToMedia\TorrentToMedia.py”, line 282, in main
core.initialize()
File “D:\Tools\nzbToMedia\core_init_.py”, line 369, in initialize
DELETE_ORIGINAL = int(CFG[“Torrent”][“deleteOriginal”])
TypeError: int() argument must be a string or a number, not ‘list’

It is giving me this error. Any ideas what it may be? The strange thing is that the event is received by sonarr and the file then goes to the right directory.

Thanks

@Glutao,

1 - As stated in para 3. Software needed - NTM states you need to have Python installed, so I didn’t restate that here.

2 - Are you using Deluge? The folders inside your incomplete folder are NOT created automatically, is that what you’re saying? You must create them on your system first, then configure the Deluge label plug in. If you look at my chart above in para 5, you need to make sure that file structure (or something similar) is in place FIRST. So, this means to create all those folders and ensure proper permissions are set.

3 - As far as your error, that is a python error.

I suggest bringing up the issue specifically with that error on the NTM GitHub page: https://github.com/clinton-hall/nzbToMedia/issues

I think this guide will get my about 95% to where I need to be. However, I do have a question or two. It looks like you are running a similar setup to my own except that your seedbox is another machine on your local network? How would you suggest connecting to a remote box? In this guide, you are using Sonarr to MOVE files to the final destination, i.e. the directory that Plex uses. Over a LAN this seems fine. However, if the “final destination” and the “drone folder” are not on the same network do we need an additional step, i.e. Syncthing, to complete the process or is moving the files over the net a feature of Sonarr I wasn’t aware of?

I apologize if for some reason the answer to all of this is right in front of me and I’m just not seeing it. I am a tech person, actually work as a system admin, but for some reason I seem to have a hard time wrapping my mind around how all of this works. I just finally got my system up and running a few months before the announcement that the Drone Factory was going away.

Thank you for any help you can provide, even if it just pointing at another source of info that I haven’t come across.

Deluge is downloading in Incomplete folder, I need to setup label plugin to move completed download ? If not why you created TV and MOVIES folder under Incomplete?

Thanks :slight_smile:

@ToRvaLDz -

That’s actually a good question -

YES! You need to set up BOTH the label AND the AutoAdd Plugin to move the download to the completed location. It IS a little confusing as both the LABEL plugin and the AutoAdd plugin do the same thing and both have “move when completed” settings. So, just makes sure that they are BOTH set to move the download to the same location. See screenshot:

@Fragsrus

It’s a good question … and this is the hardest part of this configuring IF you are using a remote machine.

So, YES, my “seedbox” is on a remote machine within my LAN. However, it IS just a VM on the server that is running Sonarr, but for all intensive purposes, all applications see it as a separate machine, ie sonarr, radarr, - because it has a separate IP address.

so in your scenario - YES, I would recommend SyncThing. However, I’ve always used a local seedbox, I’ve never used a seedbox service or something outside my LAN. But I DO KNOW that this does work if you are using a something remote.

Also, I actually StableBit’s “Cloud Drive” to mount remote folders as “local drives”. I’m NOT using it for this scenario, but I know it would work. CloudDrive “spoofs” Windows (and all other appliaions) into seeing a remote folder as a local drive. It allows you to mount ANY remote folder, Google Drive, FTP, etc.

https://stablebit.com/CloudDrive

LMK what you figure out.

So following the guide this is my setup:

Deluge download to \incomplete
Auto add watching to \incomplete\tv download to \incomplete\tv move to \tv\torrents
Label move to \tv\torrents

But all my downloaded files are in \incomplete so Label and autoadd will not move any files to tv\torrents :sweat:

@ToRvaLDz - The “download to” or “download location” is not that important unless you are using NZBs and Torrents, which it looks like you are not. As longs as the torrent data is moved FROM one DIR to another DIR

Also, your WATCH folder is not as important as well…that only comes in use IF you manually download a torrent. So, if I go to a torrent website, download the actual .torrent file, and save it to my local computer, THEN, I move the .torrent file to the “WATCHED DIR”, then Deluge should automatically add the TV label. SINCE SOnarr automatically appends the TV label, it’s not as important.

So:

“But all my downloaded files are in \incomplete so Label and autoadd will not move any files to tv\torrents”

So, after it’s complete, the finished torrent data stays in \incomplete?!

When the torrent is downloading, is the label 'TV" added to it?

also, make sure that the plugin AUTOADD adds the same label (Case sensitive?) ‘TV’ to the torrent as Sonarr does.

So, there are three places you have to actually input the label “TV”

1 - In the AutoAdd plugin properties at the bottom
2 - in the Deluge main window under “labels” (right click and “add label”)
3 - in Sonarr -> settings -> Download client -> Deluge -> “category”

Finally, This MAY also be a permissions issue. Is your folder “\incomplete” and “\tv\torrents” on the same machine? are they on the same Hard drive?

Yes my downloads remains in \incomplete, anyway Sonarr are processing them and files are copied to media folder, probably they are not finished because deluge is still seeding them.
They are on same drive.

Thank you

I’m an analog guy living in a digital world, however, I use a program called “extractnow” that auto extracts all torrents and deletes what it extracted from and dumps to drone factory folder. I’m having to use the import feature.

I was hoping someone a lot smarter and technical than me could take a look at extractnow and see if it makes for easier workflow and create a guide based on that for the benefit of all.

I don’t remember where I downloaded extractnow but here’s a copy of it if you need it: https://dl.dropboxusercontent.com/u/1687202/Disks/extractnow.exe

If this isn’t helpful, I apologize. But from a windows perspective, extractnow has been entirely helpful to me.

No, Deluge should move them even if they are still seeding.

I would check the deluge logs and find out why they aren’t being moved.

@Sean_Reitmeyer

Yes, I was using extract now before, I wrote an in-depth guide here. :

However, the problem with extract now is that you still have to use the drone folder as ExtractNow it doesn’t have the ability to call Sonarr to ESPISODESCAN. So, once the drone folder is completely depreciated, extract now will no longer work.

Here a simpler method for those who are on windows and have winrar already installed or wish to install it since its free.

Ok this should help for those who already have winrar installed on thier windows pc.

If not its a free download.

In utorrent go to options/preferences/advanced/run program and copy this into the run this program when a torrent is finished box.
“C:\Program Files\WinRAR\WinRAR.exe” x -ibck -inul “%D*.r00” “%D”

If your winrar is installed in a different directory mod the first part as needed but that the default install location for it.

This will run winrar and extract the file to the same folder as the download.

This should work in most torrent programs that support the run function which is most of them these days.

I couldn’t get this to work in deluge since most of its plugins are presently broken in windows along with the one used to run programs.

This should be a much simpler less of a headache way for the windows users tell sonarr adds the feature itself. :slight_smile:

@Eric_M

So how does this method make the call to Sonarr for an EPISODESCAN ?

Also if you’re using your torrent client for more than just TV - how would you separate the completed torrents into diff directories based on their labels - IE, music, movies, etc?

Sonnar can see and scans the episode without issue.

I use the client for more then just tv which doesn’t cause a issue.
Since basically the only things using rar is tv shows these days.
Sonnar is going to just ignore anything else anyway since it didn’t request or need them.

Different directories not needed as winrar unpacks the tv shows directly into the episode own directory which sonnar is happy with.

Set sonnar to monitor what ever download direct you client is using.
The client downloads the tv show into a folder of the same name in the download directory.
Once completed winrar upacks the show into that directory.
Sonnar sees all this and scans the shows over to the correct place.

Simple easy no messing with extra directories or the like.

Of course this is windows only.

PS: sorry for spelling and grammar autocarrot is killing me (gaaaaa)

Example.

Sonarr grabbed torrent for episode from show last night uotrrent auto-added it.

Sonnar could see it was being download.

It finished and show was unpacked .
Sonarr was aware of this and scanned the show over.

Wife happy :wink:

Hey @seanvree. I wanted to thank you for the work you have done so far on this - it definitely helped give me a better picture of how all the different pieces need to interplay to get this working. I will admit I was a bit frustrated by some lack of clarity in your guide however. I’m sure that it took you a few drinks to get this all working and I know putting a guide together like this is a chore mostly for the benefit of others. So again, thanks.

That being said I would like to offer some constructive criticism and suggestions on how to make this better and hopefully the next person won’t stumble through all the same blocks that I did.

I’ll try to go in order of the guide - though some things may be out of place.

  1. Most importantly…link this guide at the very top of your other guide so people don’t waste time with the other method.

  2. It isn’t really clear (in either guide) that all these steps you are taking are:
    a) because you have a separate seed box machine
    b) because you are trying to seed the files and want to avoid locks

Yes you do mention in passing that this guide solves all those issues, but not everyone who wants an “auto-process .rar” solution is going to have that configuration. Many pieces here are overly complex or simply don’t make much sense if you don’t fit the above criteria. It would be very helpful if you both explained clearly that is your setup at the onset AND commented on each piece as to what part of the puzzle it solves so that those who don’t have that particular challenge know that they can skip it/go an easier route.

  1. The directory names you have chosen are confusing. Calling the directory “drone” confuses the issue since we are specifically doing away with the drone folder. I know this is just semantics, but it does muddy the waters. Personally I call my folder “processing”, but anything to distinguish it as “not drone” would be better.

  2. You don’t stay consistent with your directory names. You show your tree structure up top, but then down in your autoproecssmedia.cfg and log files you have a different structure. This makes it very difficult for people to follow how you should set up the autoproecssmedia.cfg.

  3. On the same note, the section for configuration of the autoproecssmedia.cfg is difficult to follow. Part of it is the naming I mention in #4, part of it is the bad color coding the site here does to it. And part of it is the wall of text with no real indicator of what specific variables one needs to set.

  4. While we are on autoproecssmedia.cfg. I’m pretty sure the default_downloadDirectory is optional and probably will never come into play with how this is configured.

  5. In you section “6. Process explanation (How this shit works):” your two flow examples could use a little clarification. I believe that step #5 in the non-Rar flow “Sonarr doesn’t import because the remote path is EMPTY.” should also be step #5 in the rar flow. I know Sonarr wouldn’t import anyway because the files are archived, but that doesn’t mean that the workflow step isn’t there. You should try to mirror the text in both workflows to be exactly the same except where they actually differ.

Another example here is your step 10/9 in the two flows. In both cases sonarr “Sonarr imports, post-processes, and MOVES release to final destination.” Just because the file isn’t a rar doesn’t mean that the NTM script doesn’t act on it. For example it may download subtitles for a file that is already an .mkv. Likewise, in both cases sonarr does additional post processing in the form of moving and renaming the files.

I know this seems minor, but when you are looking at this through fresh eyes little omissions/differences like this are very confusing as to how they should be interpreted and what is responsible for what.

  1. The section on the code change to autoProcesstv.py. A change like this is a big deal (since as you state it may be lost on upgrade of source). It doesn’t hurt to point out here again exactly what this is being used for and why you probably don’t need it if on a single box config.

This is the one thing that I think I can offer some additional assistance on (rather than just nitpicking :wink:). You can actually get around this by writing your bat script as follows:

if /I %3==D:\queue\processing\tv\torrent\\ (
	"d:\Program Files (x86)\nzbToMedia\TorrentToMedia.py" %1 %2 %3
) ELSE (
	# do nothing
)

Ofc you would substitute your path for mine above (after the %3==). This way even though the deluge script will always execute, it will only actually run NTM for torrents in the appropriate directory. Less processing and cleaner logs!

Well, that’s about it for now…it is really late and I’ve been working on this whole configuration for too long today. I’ll probably read this over again in the next couple of days so would appreciate your feedback and if you care for any more of mine (if I have it).

thanks again.

@bengalih ,

Hey, brother. Really appreciate the feedback, you’re right it did take a few drinks. But after using sonarr for a couple years now and ALWAYS having that single problem nagging me, when I figured it out…I had to share.

So, let me address each one:

  1. I actually tried, but it’s “Locked”, I can’t edit it. Maybe @Taloth can delete it? Not sure what the best way to address that is.

  2. Understood, I’ll consider editing, but to answer, it’s both. Depending on your enviroment…you MAY have either of those issues or none of those issues. However, the bottom line is that there is NO method to auto-extract RARs. I’ll compare it to CouchPotato - which DID have the auto-extract option, native. I guess I assumed you’re using this guide if BOTH of those things are true. I don’t see why you would even need this guide if you don’t have those issues? So, Yeah, good point - I may or may not edit it simply because I think there is something in the works that will auto-extract native.

  3. Yeah, I actually thought about this. I guess I couldn’t come up with a better name than “drone” HA.

  4. Got it, I’ll clean that up. I was trying to use “common” terms/names, while also copying and pasting from my environment. Good point.

  5. Humm… not sure I see what you mean of why it’s hard to follow…I guess I can change all the DIR names to be consistent. As far as formatting - yeah, that took me a good hour to figure out, I guess I could post it on gist.

  6. Actually, that is important. … I THINK. when you set that, AND you run the script manually - if it’s not set, it will try to post-process everything in all the DIRs you have enabled. So, as I understand it, that will PREVENT it from re-extracting the same files again. I may be wrong but this ONLY comes into play if you run the script manually…if you’re testing or something. But I also left some values in there so that the code I posted looked similar to what the .cfg file looks like on your machine.

  7. Yup, you’re right. Corrected.

  8. Yeah, you’re right. I guess I assumed that people are using this to COPY the release and not link it. I’ll add verbiage.

  9. HA, I was about to get pissed man! I was like “WHO IS THIS GUY”? Ha, jk, thanks for the input…yeah, I’ll add that in as well.
    Personally, I’m not going to use it as I forsee myself using this same method for Radarr (as it looks as if they are doing away with drone factory as well) That way all I don’t have to edit the bat script again, I just have to edit the .cfg file. But yeah, thanks!

Really appreciate your feedback. I’m interested to know IF you actually got this working for you. Sounds like you know the deal real well, so PLEASE reach out. Depending on the progress that the devs are making with including this native, I’ve been procrastinating editing this for Radarr as well, SO…if I get word that this is still useful for the time being, I’ll make some MAJOR edits once I figure out how to implement this with Radarr.

_SV