clinton-hall / nzbToMedia

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

TorrentToMedia.py not working Synology. #123

Closed schumi2004 closed 11 years ago

schumi2004 commented 11 years ago

TorrentToMedia doesn seem to work on my Synology here using Transmission. Python path missing maybe since other scripts can set python path?

I see it being called but that's about it. (no postprocess.log)

[08:58:01.463] 666 Park Avenue S01E13 Lazarus HDTV x264-TRiC[ettv] Calling script "/volume1/@appstore/scripts/nzbToMedia-torrent/TorrentToMedia.py" (torrent.c:2016)

clinton-hall commented 11 years ago

Try running /volume1/@appstore/scripts/nzbToMedia-torrent/TorrentToMedia.py via command line/ssh

If it runs (will say something about unable to load variables) then it is not a python path issue. If not, you can try editing the first line to the absolute path to your python install). If this script runs when called via command line, it should run when called from Transmission.

schumi2004 commented 11 years ago

I tested script manual with and without adding python to PATH and this is the result i'm getting

00:19:35|INFO MAIN: Loading config from /volume1/downloads/ppscripts-torrents/autoProcessMedia.cfg 00:19:35|DEBUG MAIN: Received Directory: /volume1/downloads/torrents | Name: Elementary.S01E20.HDTV.x264-LOL.mp4 | Category: 00:19:35|ERROR SEARCH: Could not identify category and torrent name from the directory structure. Please check downloader settings. Exiting

Maybe there is something wrong in my build.

Not using watchdir etc in script

schumi2004 commented 11 years ago

I also noticed i need to set full path for python in all scripts because python in PATH doesn't seem to work.

Tue Apr 30 2013 09:10:27 nzbToSickBeard: env: python: No such file or directory

PATH=/usr/local/python/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

clinton-hall commented 11 years ago

When it does run, the issue is that it isn't able to determine this to be category of TV/series etc.

Since Transmission doesn't pass a category we need to have the files downloaded to a "category folder". I.e the directory needs to be /volume1/downloads/torrents/tv Or /volume1/downloads/torrents/series And then the sbCategory should be "tv" (or "series")

The question is, can the fork of SB you are using set the download directory when sending the torrent?

schumi2004 commented 11 years ago

I'm using mr-orange fork which is slightly modified to handle failed downloads. I think i have it working now, would be better if SB sends download dir.

schumi2004 commented 11 years ago

Any ideas?

23:40:32|INFO ==================== 23:40:32|INFO TorrentToMedia V8.0 23:40:32|INFO MAIN: Loading config from /volume1/@appstore/scripts/ppscripts-torrents/autoProcessMedia.cfg 23:40:32|DEBUG MAIN: Received Directory: /volume1/downloads/torrents/series | Name: Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 | Category: 23:40:32|DEBUG SEARCH: Found Category: series in directory structure 23:40:32|INFO SEARCH: Determined Category to be: series 23:40:32|INFO SEARCH: Could not find a unique torrent folder in the directory structure 23:40:32|INFO SEARCH: The directory passed is the root directory for category series 23:40:32|WARNING SEARCH: You should change settings to download torrents to their own directory if possible 23:40:32|INFO SEARCH: We will try and determine which files to process, individually 23:40:32|INFO MAIN: Output directory set to: /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|DEBUG MAIN: Scanning files in directory: /volume1/downloads/torrents/series 23:40:32|DEBUG MAIN: Looking for Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 in: Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|DEBUG MAIN: Found file Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 that matches Torrent Name Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|INFO MAIN: Found video file .mp4 in /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|INFO COPYLINK: Hard linking /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 to /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|INFO COPYLINK: Something went wrong in linktastic.link, copying instead 23:40:32|DEBUG COPYLINK: Copying /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 to /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|ERROR MAIN: Failed to link file: Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|DEBUG [Errno 20] Not a directory: '/volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4' 23:40:32|INFO FLATTEN: Flattening directory: /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|INFO REMOVER: Removing empty folders in: /volume1/downloads/torrents/series/Beauty.and.the.Beast.2012.S01E19.HDTV.x264-ASAP.mp4 23:40:32|ERROR MAIN: Something failed! Please check logs. Exiting

clinton-hall commented 11 years ago

The issue I see above is that the directory linking from and to are the same. I would suggest you change the option (autoProcessMedia.cfg) outputdirectory To /volume1/downloads/complete Or something like that... Just not the same /torrents directory.

What this script does is link or copy from the download location to this "interim" directory, extract if needed, then send to SickBeard and CouchPotato etc. this way the original downloaded files are still available for seeding.

This has been tested with utorrent (we pause seeding before doing processing) but as transmission isn't supposed to lock files when seeding, I believe this should work fine once you make that change.

digiSal commented 11 years ago

I am having this issue and my to and from are correct. I believe it has to do with the file name of the show. If it has lots of periods it breaks it. It works for every other show.

Here is my log. See the similarities as the log posted above? 22:06:15|INFO TorrentToMedia V8.3 22:06:15|INFO MAIN: Loading config from /home/owner/nzbToMedia/nzbToMedia/autoProcessMedia.cfg 22:06:15|DEBUG MAIN: Received Directory: /media/owner/goflex/Downloaded/tv | Name: The.Real.Housewives.Of.Miami.S03E03.mp4 | Category: 22:06:15|DEBUG SEARCH: Found Category: tv in directory structure 22:06:15|INFO SEARCH: Determined Category to be: tv 22:06:15|INFO SEARCH: Could not find a unique torrent folder in the directory structure 22:06:15|INFO SEARCH: The directory passed is the root directory for category tv 22:06:15|WARNING SEARCH: You should change settings to download torrents to their own directory if possible 22:06:15|INFO SEARCH: We will try and determine which files to process, individually 22:06:15|INFO MAIN: Output directory set to: /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:15|DEBUG MAIN: Scanning files in directory: /media/owner/goflex/Downloaded/tv 22:06:15|DEBUG MAIN: Looking for The.Real.Housewives.Of.Miami.S03E03.mp4 in: The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:15|DEBUG MAIN: Found file The.Real.Housewives.Of.Miami.S03E03.mp4 that matches Torrent Name The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:15|INFO MAIN: Found video file .mp4 in /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:15|INFO COPYLINK: Hard linking /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 to /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:15|ERROR COPYLINK Traceback (most recent call last): File "/home/owner/nzbToMedia/nzbToMedia/autoProcess/nzbToMediaUtil.py", line 156, in copy_link linktastic.link(filePath, targetDirectory) File "/home/owner/nzbToMedia/nzbToMedia/linktastic/linktastic.py", line 68, in link os.link(src, dest) OSError: [Errno 20] Not a directory 22:06:16|WARNING COPYLINK: Something went wrong in linktastic.link, copying instead 22:06:16|DEBUG COPYLINK: Copying /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 to /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:16|ERROR MAIN: Failed to link file: The.Real.Housewives.Of.Miami.S03E03.mp4 Traceback (most recent call last): File "/home/owner/nzbToMedia/nzbToMedia/TorrentToMedia.py", line 91, in main copy_link(filePath, targetDirectory, useLink, outputDestination) File "/home/owner/nzbToMedia/nzbToMedia/autoProcess/nzbToMediaUtil.py", line 164, in copy_link shutil.copy(filePath, targetDirectory) File "/usr/lib/python2.7/shutil.py", line 119, in copy copyfile(src, dst) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 20] Not a directory: '/media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4/The.Real.Housewives.Of.Miami.S03E03.mp4' 22:06:16|INFO FLATTEN: Flattening directory: /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:16|INFO REMOVER: Removing empty folders in: /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 22:06:16|ERROR MAIN: Something failed! Please check logs. Exiting

clinton-hall commented 11 years ago

No. The issue here is /media/owner/goflex/Downloaded/tv/The.Real.Housewives.Of.Miami.S03E03.mp4 exists as a file, so it can't create this as a directory!

You need to set outputDirectory = something else. E.g outputDirectory = /media/owner/goflex/extracted

digiSal commented 11 years ago

just saw your reply here https://couchpota.to/forum/viewtopic.php?f=17&t=343&p=11037#p11067

explains everything. sorry for double/cross posting. wont happen again.