clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
672 stars 176 forks source link

TorrentToMedia truncates folder names when moving then postprocessor can't find files for processing #937

Closed petermgates closed 8 years ago

petermgates commented 8 years ago

Synology DS211j (DSM 5.2) using Transmission / SickRage. useLink=move

I am finding that when TTM.py moves folders from the Transmission output folder into the processing folder, it drops the last section of the folder name. This is then passed to SickRage for postprocessing which cannot find the media file. SR marks a failed download and returns a success signal to TTM.py which deletes the folder and removes the torrent.

If SR failed download handling switched off, that is the end of things. With FDH on, SR then re-snatches the media file, adds it to Transmission and we are in a loop.

A manual run exhibits similar behavior - the folder name is truncated after the last period, SR cannot find files to process and the files get deleted. If there are any periods, the portion of the folder name after the last period is dropped. For example, The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] becomes The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV

If I manually edit all periods out of the folder name, then a manual run of TTM.py is successful.

Folder structure is standard, per the wiki:

/downloads
    /complete
        /tv
        /movies
    /process
        /tv
        /movies

/complete is the Transmission output folder with /tv and /movies being labels in Transmission. /process is the outputDirectory for autoProcessMedia.cfg and process/tv is the SickRage postprocessing path.

Debug info:

cfg: autoProcessMedia.cfg extract

Logs: Run triggered by Transmission (extract below) Manual run, periods left in folder name Manual run, some but not all periods removed from folder name Manual run, all periods removed from folder name Run triggered by Transmission with all periods manually removed from folder name during download.

2016-01-14 16:43:58 INFO    ::ENVIRONMENT: TR_TORRENT_NAME: The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg]
...
2016-01-14 16:44:15 DEBUG   ::MAIN: Received Directory: /volume1/downloads/complete/tv | Name: The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] | Category:
2016-01-14 16:44:15 DEBUG   ::MAIN: SEARCH: Found Category: tv in directory structure
2016-01-14 16:44:15 INFO    ::MAIN: SEARCH: Found torrent directory The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] in input directory directory /volume1/downloads/complete/tv
2016-01-14 16:44:15 INFO    ::MAIN: SEARCH: Setting inputDirectory to /volume1/downloads/complete/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg]
2016-01-14 16:44:15 DEBUG   ::MAIN: Determined Directory: /volume1/downloads/complete/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] | Name: The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] | $
...
2016-01-14 16:44:21 INFO    ::MAIN: Output directory set to: /volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV
...
2016-01-14 16:44:21 WARNING ::MAIN: Found no media files in /volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV
...
2016-01-14 16:44:21 INFO    ::MAIN: Calling SickBeard:tv to post-process:The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg]
...
2016-01-14 16:44:25 WARNING ::SICKBEARD: No media files found in directory /volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV. Processing this as a failed download
2016-01-14 16:44:25 DEBUG   ::SICKBEARD: Opening URL: http://localhost:####/home/postprocess/processEpisode with params: {'nzbName': 'The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg]', 'quiet': 1, 'failed': 1, 'dir': '/volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV'}
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: Processing folder /volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: PostProcessing Path: /volume1/downloads/process/tv
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: PostProcessing Dirs: [u'The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV']
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: Successfully processed
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: I did encounter some unprocessable items: 
2016-01-14 16:44:39 POSTPROCESS::SICKBEARD: [The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV : Failed download]
2016-01-14 16:44:39 DEBUG   ::MAIN: Deleting torrent The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV.x264-CROOKS[rarbg] from transmission
2016-01-14 16:44:45 INFO    ::CLEANDIRS: Directory /volume1/downloads/process/tv/The.Daily.Show.2016.01.13.Tavis.Smiley.HDTV has been processed, removing ...
2016-01-14 16:44:46 INFO    ::MAIN: The /volume1/@appstore/transmission/var/nzbToMedia/TorrentToMedia.py script completed successfully.
petermgates commented 8 years ago

Hmm, I just found #911 which appears to be a similar issue. Will switch to nightly and try again.

petermgates commented 8 years ago

Identical issue after switching to nightly.

clinton-hall commented 8 years ago

The problem is no files are copied/moved/linked to the output directory... Can you show your autoProcessMedia.cfg (xxxxx out the API/user/pass details)?

petermgates commented 8 years ago

Aha! Now I understand.

In autoProcessMedia.cfg under [SickBeard] I had Torrent_NoLink = 1. This was bypassing the Transmission linking method (in my case useLink = move) and no files were being placed in the outputDirectory.

Now I have set Torrent_NoLink = 0 it works as expected.

Thank you for your help.

josh4trunks commented 8 years ago

thanks for this! I was getting bit by this with CP and SickRage, hoping changing that setting works for me

cgmille2 commented 8 years ago

I think I may be having this issue on the nightly branch. CP seems to work but SR hasn't worked in some time. I have had the script working in the past. I have attached the log and my cfg. I'm hoping it's something simple on my end. Thanks

http://pastebin.com/v6r540bR http://pastebin.com/M3rRjuaH

clinton-hall commented 8 years ago

@cgmille2 Not the same issue... Please check the SickRage logs at the time of the postprocess request. For some reason SickRage can't find the files... It may be an encoding issue with the folder name? /mnt/user/Limbo/Processed/tv/[ www.TorrentDay.com ] - Black.Mirror.2x02.White.Bear.HDTV

cgmille2 commented 8 years ago

Hmm. I do not see anything logged in SR at that time. I thought it might be a similar issue because it seems to be cutting the folder name short when setting the output directory (lines 43 & 48, http://pastebin.com/QZVuK7S4). For reference, I am comparing it to a log from December when the script was working (http://pastebin.com/1BcLcrZ8). Any thoughts? Thanks.

clinton-hall commented 8 years ago

yes, it truncates, but that isn't an issue. The files should be at /mnt/user/Limbo/Processed/tv/Black.Sails.S03E08.HDTV which is where the script is telling SickRage to look. I'm not sure why SickRage is not finding these files. Perhaps in SickRage try a manual scan of the folder and see what it says. It could be a folder permissions issue?

clinton-hall commented 8 years ago

Ok.. looking at your scripts... are SickRage and Deluge on different systems? If so you need to set the mount points.

cgmille2 commented 8 years ago

Thanks clinton-hall. It was the mount points. Not sure how I missed that. I am on dockers on unraid. Thanks again