Importing extracted files without Drone Factory [unrar]


#1

due to the drone factory being depreciated, I wanted to start a new thread for us Windows users who are using a torrent client.

Background:

Previous method:

I’m currently working on using NZBToMedia:

I’ve got it mostly working, however, I can’t figure out how to envoke the command DownloadedEpisodesScan once NzbToMedia has extracted the file.

Anyone?


#2

I think it’s in this part of the config file: https://github.com/clinton-hall/nzbToMedia/blob/master/autoProcessMedia.cfg.spec#L109


Drone Factory is Deprecated [unrar]
#3

Right, i looked at that, but isn’t that to trigger nzbtomedia to start the job? Or does that trigger sonarr to scan for the episode?


#4

That’s used by nzbToMedia to trigger Sonarr.

Here are the instructions for integrating in your torrent client: https://github.com/clinton-hall/nzbToMedia/wiki#torrent


#5

Yup, I’ve got it integrated into the torrent client fine.

I was just confused about having the script call Sonarr…so I’ll add the sonarr config to the nzbtomedia config.


#6

Yo @Taloth

So, I’ve been using the NzbtoMedia app.

I’ve got it MOSTLY working perfectly (even with my seedbox) - it’s been extracting and calling DownloadedEpisodesScan and it’s also been handling failed downloads great.

The ONE problem I’m seeing is that it looks to me like this has to be configured to handle ALL of your post processing or none at all. As you know, most of us who were bitching are only concerned with auto-extraction, NzbToMedia does A LOT more than that, encoding, etc. So, it doesn’t seem like you can use NzbToMedia for extraction only. Example:

I’ve configured NzbToMedia to do the following:

  1. Monitor Deluge for newly added torrents Labels with “TV” (which is how Sonarr sends them to Deluge)
  2. Upon torrent completion, check if the torrent is RARed. If it is, extract it and send it to “Done Folder” (I’m still calling it this, because that’s what it is even tho Sonarr Drone factory is disabled in this scenario)
  3. Leave the original torrent in it’s completed folder
  4. Make a call to Sonarr to trigger DownloadedEpisodesScan
  5. Complete.

So, all of this is happening, however, because the NzbToMedia is designed to handle ALL post-processing, it will also copy ALL completed downloads (labeled TV) in addition to the RARed ones.

So, what this means is that in the “drone” folder mentioned above, will have duplicates of ALL the TV torrents, un-RARed and non-RARed.

I put in an issue to see if I’m doing this wrong, but haven’t got a response.

Here’s my NZBtoMedia Config file for reference. Again, the only sections I configured were [NZBDrone] and [torrent].


[NzbDrone]
    #### autoProcessing for TV Series
    #### ndCategory - category that gets called for post-processing with NzbDrone
    [[tv]]
        enabled = 1
        apikey = ce3722936dca4c868d1d183fddb94c16
        host = 192.168.1.20
        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
        ##### 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 = no
    ###### 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 = ""
    ###### uTorrent Hardlink solution (You must edit this if your using TorrentToMedia.py with uTorrent)
    uTorrentWEBui = http://localhost:8090/gui/
    uTorrentUSR = your username
    uTorrentPWD = your password
    ###### Transmission (You must edit this if your using TorrentToMedia.py with Transmission)
    TransmissionHost = localhost
    TransmissionPort = 9091
    TransmissionUSR = your username
    TransmissionPWD = your password
    #### 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 = 192.168.1.25
    DelugePort = 58846
    DelugeUSR = admin
    DelugePWD = Vreedogg1
    ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
    deleteOriginal = 0
    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 = ""

Let me know what you think.


#7

Wouldn’t useLink=hard resolve that? Then nzbToMedia will hardlink the source to the temp location, invoke Sonarr. which will either hardlink or move, depending on the parameters nzbToMedia submits.
Not sure if that works correctly on Windows though, coz of the way windows uses file locks.

I don’t think nzbToMedia does transcoding by default.


#8

@Taloth

There are 3 (Possible issues) with using hard links (in this scenario):

1 - If you’re using a seedbox (Which most people do, using hard links won’t work)

2 - IF it’s hardlinked to the temp dir (drone folder) and then Sonarr post-processes it, is it going to be able to follow that hard link to copy it to the FINAL directory for PLEX/Emby to use? (that would be a hard link to a hard link to a file that’s possibly in use)

3 - File lock is a huge thing…that’s USUALLY why people stay away from hard linking and use COPY. I doubt that NTM, and Sonarr are going to be able to follow those hard links WHILE deluge is still seeding it.


#9
  1. Considering the nzbToMedia would be running on the seedbox then internally it would still hardlink. Sonarr importing it then over a mount would of course just be a copy, but that changes little. The hardlink is purely to handle the non-rar quicker.

  2. There’s no such thing as a hardlink to a hardlink, it’s just another link to the same content. In fact, there’s always a hardlink from the directory file entry to the content. Which is why, on linux, you see a link count of 1 on normal files, because the content is referenced once, until you create a hardlink coz then there are two links. In this scenario there would be 3 (hard)links.

  3. Definitely, but only on Windows, coz on Windows filelocks block ‘deletions’ by default, where on linux it does not. So it depends on how Deluge locks. Based on a quick google, libtorrent has a flag for it.
    But I agree, it’s definitely tricky.


#10

@Taloth , Copy all -

However, I’m not sure why you keep referencing linux. No one that is having this problem to begin with is using linux. If we were, this wouldn’t even be an issue. That’s why I brought up the issue in the beginning on the other thread:

" I’m SO sick of us Windows people being left out of all the open source stuff…it’s like “oh yeah, THOSE guys” .

So, let’s get back to the issue at hand. I REALLY want this to work for me, and ALL the other dudes out there.

So - let’s assume we use “uselink=hard” in the NZBtoMedia config:

  1. NzbToMedia extracts all finished RARed torrents and copies (doesn’t need to link because it actually created the file, right?) finished media to drone folder.
  2. NTM also makes hard link for all non-RARed (labeled TV) in the drone (temp) folder with the target being in the deluge finished folder.
  3. Sonarr would then post-process EVERYTHING from the Drone folder instead of the normal completed Dir??
  4. That would still leave you with a duplicated dir (drone folder) with all those hard links in it, right?

#11

The reason I mentioned linux is because the link count is clearly visible there in the ls result while it’s not readily available on windows without tools, but the underlying principle is exactly the same as on Windows.
I already responded to your complaint about ‘Windows’ in the other thread, but it feels worth repeating: Almost 50% of our userbase is windows, so don’t start with this “Windows is left out” shit again, it’s bullshit.

  1. Yes, but I’m assuming it actually unrars in the drone (temp) folder, but if it unrars somewhere else it’ll move it.

  2. Yes. At least, that’s what I’m understanding from the nzbToMedia docs.

  3. No, nzbToMedia calls the Sonarr API for each download individually, instructing Sonarr to import that specific download. It doesn’t process a generic ‘drone’ folder, which is the whole purpose of this exercise, to get a download to flow from grab->download->pp-script->import-> in an event driven manner.

  4. No/Yes, that depends on whether nzbToMedia calls Sonarr using the importMode parameter. Which, based on this it doesn’t do. But that’s no surprise coz it wasn’t needed for usenet downloads. Might be worth suggesting to clinton to add , "importMode": "Move".


#12

I’ve been using a VBScript I made that uses Sonarrs’ API, the script is torrent only and uses WinRAR, but essentially, once a download has completed, if it has a Sonarr or Radarr label, it will extract the file to a temporary directory, then tell the API to scan that directory and also notifies it of which download by using the downloadClientID, aka the torrents HASH, that way the download handler can do the rest once the torrent has finished seeding.

I plan to use nzbToMedia, once Radarr is supported, although I’m still unsure if I should make that leap since a lot of what nzbToMedia does (at the moment) would be wasted on me, pretty much all I need (for now) is my file extracted, Sonarr or Radarr to scan that directory, then for my torrents to be removed once seeding has completed, my script handles the extraction and the API call to scan the directory, and Sonarr as well as Radarr handles the moving of the files as well as the removal of the torrent.

The downside to my current method (which is something I will probably have to include at some point), is that it wouldn’t recursively check subfolders for rar’s, so if you have a season pack where each season is a rar and in their own folders, then the script would ignore it.

The reason why I’m wanting to make the leap is because nzbToMedia sounds like a smart move (for me) since I plan on doing a lot of upgrading to my server and a lot of the features it offers would come in handy, but I’m unsure because currently, the script I made is meeting my needs, and if drone factory never became deprecated, then I probably wouldn’t have considered the move.

Overall, for me, there are more reasons to move to nzbToMedia, but if I do I might wait until I have officially made the decision to move to linux, as it would be pointless setting it up in a windows environment to then have to learn how to do it in linux, currently, I’m running a headless VM to brush up on my linux.


#13

Shoot,

Well, looks like we are in a holding pattern then. (at least with NZBtoMedia)

IF there was a way to ONLY post-porocess .RARs, then we would be golden as I suggested in this github issue:


#14

@Skullzy ,

Exactly, you need a solution that has some type of database so it doesn’t re-extract already completed torrents.

As I said in my reply to Taloth. If there was a way to ONLY post-process .RARs with NZBtoMedia, then we would have no issue and all of us would be happy.

That’s why I used SyncBackup - because it keeps a DB, and had the option to filter .RARs. as I wrote in this post:

Which still works until the drone factory is no more.

Again - it’s the ONLY method I’ve seen that doesn’t duplicate files, and doesn’t need to link.


#15

Why a holding pattern? Just add that importMode to the code line I linked and Sonarr should move instead of hardlink/copy.


#16

@Taloth

I’m a bit confused. Excuse my ignorance. I’m no coder. I’m sysadmin.

Can you give me an example?


#17

Sure.

NzbToMedia is using python. which means in this case you don’t have to compile the sources.

needs to be:

            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"}

#18

Okay, so, making sure I got this right so I can go do some testing:

1 - Change the NzbtoMedia config

[torrent]
uselink = hard

2 - Change autoprocesstv.py - lines 253 and 256 to add " “importMode”: “Move”" "

-I don’t need to add “importMode”: “Move” to the NTM config file, right?

The only question I have is that for all the other non-RARed TV shows that are hard-linked in the drone “temp” dir, won’t sonarr try to import twice since the original torrent is still in the Deluge completed DIR and now also in the “drone” folder as well?


#19
  1. yes

  2. yes, only on the lines. nope for the config.

  3. That’s a concern yes, similar to the case I discussed with the user here Import without Drone Factory [iflicks]
    The suggestion there was to use ‘Remote’ Path Mapping to point it to some empty directory, so it finds nothing to import except via nzbToMedia. It isn’t ideal and I do plan to add a config option so the user can specify how he imports, but I suppose that at that point I’d be pretty close to Transfer Provider support and can think about proper unrar integration.


#20

@Taloth

Okay, now what if I have A NZB downloader going to that same finished folder as the torrents … If change the remote path mapping, am I going to have to also enable NZBtoMedia for NZBs as well?