clinton-hall / nzbToMedia

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

TorrentToMedia (manually run) is not deleting files after process completed. #964

Closed MrCee closed 7 months ago

MrCee commented 8 years ago

Hi Clinton,

Using the nightly branch things are working fantastically with directories. Thank you! I have TorrentToMedia.py set to run once every hour to deal with Synology's Download Station issue. Synology have confirmed scripts will be triggered correctly and the correct environment variables you currently use be parsed to scripts in a future release. Having mentioned this, this is not a Download Station issue, more of a hardlink then not deleting the original link problem.

Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 is located in /volume1/downloads/tv/

Manual Run 1 If a torrent file is downloaded on it's own without being contained within a folder, the file itself is HARDLINKED to a newly created folder (created by the script), everything is processed/moved/hardlinked to the final destination. The folder created by the script is deleted. This leaves the original file not deleted.

SOURCE FOLDER: [/volume1/downloads/tv] The script creates: TARGET FOLDER: [/volume1/downloads/tv/Vikings] The original file is now linked to: /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4

Manual Run 2 If a torrent file is downloaded with a folder, and the file is contained within this folder, then TorrentToMedia.py when manually run will work perfectly and delete the remaining folder after it has been processed/moved/hardlinked to the final destination. I created a folder called 'Anything' and dragged the file into this.

SOURCE FOLDER: [/volume1/downloads/tv/Anything]' TARGET FOLDER: [/volume1/downloads/tv/Anything]

Tested

The script will clean up afterwards if the file is in a folder: Manual Run 1 Deleting /volume1/downloads/tv/Vikings Original file is left behind because this folder was created automatically and original file was HARDLINKED to this auto created 'Vikings' folder

Manual Run 2Deleting /volume1/downloads/tv/Anything Original file is deleted because it was already in a folder. COPYLINK process was skipped

Are you able to take a look at this? Possibly COPYLINK to the new folder created and REMOVE the original LINK if this is not in a folder when the folder name Vikings is auto generated? (HARDLINK then REMOVE original link)

Hard linking SOURCE MEDIAFILE -> TARGET FOLDER rm SOURCE MEDIAFILE ?

Cheers Paul

[00:01:54] [INFO]::MAIN: Loading config from [/volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia/autoProcessMedia.cfg]
[00:01:54] [INFO]::ENVIRONMENT: LANG: en_US.utf8
[00:01:54] [INFO]::ENVIRONMENT: TERM: xterm-256color
[00:01:54] [INFO]::ENVIRONMENT: SHELL: /bin/ash
[00:01:54] [INFO]::ENVIRONMENT: TZ: AEST-10AEDT,M10.1.0,M4.1.0/3
[00:01:54] [INFO]::ENVIRONMENT: LC_ALL: en_US.utf8
[00:01:54] [INFO]::ENVIRONMENT: SSH_TTY: /dev/pts/1
[00:01:54] [INFO]::ENVIRONMENT: OLDPWD: /volume1/@appstore/VideoStation/bin
[00:01:54] [INFO]::ENVIRONMENT: PWD: /volume1/@appstore/VideoStation/bin
[00:01:54] [INFO]::ENVIRONMENT: PATH: /sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/sbin:/opt/bin
[00:01:54] [INFO]::ENVIRONMENT: PGDATA: /var/services/pgsql
[00:01:54] [INFO]::ENVIRONMENT: SSH_CLIENT: 
[00:01:54] [INFO]::ENVIRONMENT: LOGNAME: root
[00:01:54] [INFO]::ENVIRONMENT: USER: root
[00:01:54] [INFO]::ENVIRONMENT: TERMINFO: /usr/share/terminfo
[00:01:54] [INFO]::ENVIRONMENT: HOME: /root
[00:01:54] [INFO]::ENVIRONMENT: MAIL: /var/mail/root
[00:01:54] [INFO]::ENVIRONMENT: SSH_CONNECTION: 
[00:01:54] [INFO]::ENVIRONMENT: PAGER: more
[00:01:54] [INFO]::ENVIRONMENT: LD_LIBRARY_PATH: /opt/lib:/opt/include
[00:01:54] [INFO]::MAIN: Checking database structure...
[00:01:54] [DEBUG]::MAIN: Checking Initial Schema database upgrade
[00:01:54] [DB]::MAIN: nzbtomedia.db: SELECT 1 FROM sqlite_master WHERE name = ?; with args ('db_version',)
[00:01:54] [DB]::MAIN: nzbtomedia.db: SELECT db_version FROM db_version
[00:01:54] [DEBUG]::MAIN: InitialSchema upgrade not required
[00:01:54] [DEBUG]::MAIN: Checking if we can use git commands: "/usr/local/bin/git" version
[00:01:54] [DEBUG]::MAIN: Executing "/usr/local/bin/git" version with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:54] [DEBUG]::MAIN: git output: git version 2.7.0
[00:01:54] [DEBUG]::MAIN: "/usr/local/bin/git" version : returned successful
[00:01:54] [DEBUG]::MAIN: Using: "/usr/local/bin/git"
[00:01:54] [DEBUG]::MAIN: Executing "/usr/local/bin/git" symbolic-ref -q HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:54] [DEBUG]::MAIN: git output: refs/heads/nightly
[00:01:54] [DEBUG]::MAIN: "/usr/local/bin/git" symbolic-ref -q HEAD : returned successful
[00:01:54] [INFO]::MAIN: Checking if git needs an update
[00:01:54] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-parse HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:54] [DEBUG]::MAIN: git output: 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17
[00:01:54] [DEBUG]::MAIN: "/usr/local/bin/git" rev-parse HEAD : returned successful
[00:01:54] [DEBUG]::MAIN: Executing "/usr/local/bin/git" fetch origin with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:56] [DEBUG]::MAIN: git output: 
[00:01:56] [DEBUG]::MAIN: "/usr/local/bin/git" fetch origin : returned successful
[00:01:56] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-parse --verify --quiet "@{upstream}" with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:56] [DEBUG]::MAIN: git output: 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17
[00:01:56] [DEBUG]::MAIN: "/usr/local/bin/git" rev-parse --verify --quiet "@{upstream}" : returned successful
[00:01:56] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-list --left-right "@{upstream}"...HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:01:56] [DEBUG]::MAIN: git output: 
[00:01:56] [DEBUG]::MAIN: "/usr/local/bin/git" rev-list --left-right "@{upstream}"...HEAD : returned successful
[00:01:56] [DEBUG]::MAIN: cur_commit = 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17 % (newest_commit)= 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17, num_commits_behind = 0, num_commits_ahead = 0
[00:01:56] [INFO]::MAIN: No update needed
[00:01:56] [INFO]::MAIN: nzbToMedia Version:9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17 Branch:nightly (Linux 3.2.40)
[00:01:56] [DEBUG]::MAIN: Connecting to transmission: http://localhost:9093
[00:01:56] [INFO]::MAIN: #########################################################
[00:01:56] [INFO]::MAIN: ## ..::[TorrentToMedia.py]::.. ##
[00:01:56] [INFO]::MAIN: #########################################################
[00:01:56] [DEBUG]::MAIN: Options passed into TorrentToMedia: ['/nzbToMedia/TorrentToMedia.py']
[00:01:56] [WARNING]::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...
[00:01:56] [INFO]::MAIN: Searching /volume1/downloads/movie for mediafiles to post-process ...
[00:01:56] [DEBUG]::MAIN: No directories identified in CouchPotato:movie for post-processing
[00:01:56] [INFO]::MAIN: Searching /volume1/downloads/tv for mediafiles to post-process ...
[00:01:56] [DEBUG]::MAIN: Found file Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 in root directory /volume1/downloads/tv.
[00:01:59] [INFO]::COPYLINK: MEDIAFILE: [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4]
[00:01:59] [INFO]::COPYLINK: SOURCE FOLDER: [/volume1/downloads/tv]
[00:01:59] [INFO]::COPYLINK: TARGET FOLDER: [/volume1/downloads/tv/Vikings]
[00:01:59] [INFO]::COPYLINK: Hard linking SOURCE MEDIAFILE -> TARGET FOLDER
[00:01:59] [INFO]::MAIN: Starting manual run for SickBeard:tv - Folder:/volume1/downloads/tv/Vikings
[00:01:59] [INFO]::MAIN: Checking database for download info for Vikings ...
[00:01:59] [DB]::DB: Getting download info for Vikings from the DB
[00:01:59] [DB]::MAIN: nzbtomedia.db: SELECT * FROM downloads WHERE input_name=? AND status=? with args [u'Vikings', 0]
[00:01:59] [INFO]::MAIN: Unable to locate download info for Vikings, continuing to try and process this release ...
[00:01:59] [DEBUG]::MAIN: Received Directory: /volume1/downloads/tv/Vikings | Name: Vikings | Category: tv
[00:01:59] [DEBUG]::MAIN: SEARCH: Found the Category: tv in directory structure
[00:01:59] [INFO]::MAIN: SEARCH: Found a unique directory Vikings in the category directory
[00:01:59] [DEBUG]::MAIN: Determined Directory: /volume1/downloads/tv/Vikings | Name: Vikings | Category: tv
[00:01:59] [INFO]::MAIN: Auto-detected SECTION:SickBeard
[00:01:59] [INFO]::MAIN: Output directory set to: /volume1/downloads/tv/Vikings
[00:01:59] [DEBUG]::MAIN: Scanning files in directory: /volume1/downloads/tv/Vikings
[00:01:59] [DEBUG]::MAIN: Found 1 files in /volume1/downloads/tv/Vikings
[00:01:59] [INFO]::COPYLINK: MEDIAFILE: [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4]
[00:01:59] [INFO]::COPYLINK: SOURCE FOLDER: [/volume1/downloads/tv/Vikings]
[00:01:59] [INFO]::COPYLINK: TARGET FOLDER: [/volume1/downloads/tv/Vikings]
[00:01:59] [INFO]::COPYLINK: SOURCE AND TARGET files are the same, skipping ...
[00:01:59] [DEBUG]::MAIN: Checking for archives to extract in directory: /volume1/downloads/tv/Vikings
[00:01:59] [INFO]::MAIN: FLATTEN: Flattening directory: /volume1/downloads/tv/Vikings
[00:01:59] [DEBUG]::MAIN: Checking for empty folders in:/volume1/downloads/tv/Vikings
[00:01:59] [INFO]::MAIN: Found 1 media files in /volume1/downloads/tv/Vikings
[00:01:59] [INFO]::MAIN: Calling SickBeard:tv to post-process:Vikings
[00:02:00] [INFO]::MAIN: Attempting to auto-detect tv fork
[00:02:03] [INFO]::MAIN: SickBeard:tv fork auto-detection successful ...
[00:02:03] [INFO]::MAIN: SickBeard:tv fork set to sickrage
[00:02:03] [DEBUG]::MAIN: calling command: /volume1/@appstore/VideoStation/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia/tests/test.mp4
/volume1/@appstore/VideoStation/bin/ffprobe: /opt/lib/libz.so.1: no version information available (required by /var/packages/VideoStation/target/lib/ffmpeg/libavcodec.so.55)
[00:02:04] [INFO]::TRANSCODER: Checking [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4] for corruption, please stand by ...
[00:02:04] [DEBUG]::MAIN: calling command: /volume1/@appstore/VideoStation/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
/volume1/@appstore/VideoStation/bin/ffprobe: /opt/lib/libz.so.1: no version information available (required by /var/packages/VideoStation/target/lib/ffmpeg/libavcodec.so.55)
[00:02:05] [INFO]::TRANSCODER: SUCCESS: [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4] has no corruption.
[00:02:05] [POSTPROCESS]::SICKBEARD: SUCCESS: The download succeeded, sending a post-process request
[00:02:05] [DEBUG]::SICKBEARD: Opening URL: https://localhost:8899/home/postprocess/processEpisode with params: {'nzbName': 'Vikings', 'force': 1, 'quiet': 1, 'failed': 0, 'dir': '/volume1/downloads/tv/Vikings', 'process_method': 'hardlink', 'delete_on': 1}
[00:02:10] [POSTPROCESS]::SICKBEARD: Processing folder /volume1/downloads/tv/Vikings
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing Path: /volume1/downloads/tv
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing Dirs: [u'Vikings']
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing Files: []
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing VideoFiles: []
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing RarContent: 
[00:02:10] [POSTPROCESS]::SICKBEARD: PostProcessing VideoInRar: 
[00:02:10] [POSTPROCESS]::SICKBEARD: Processing folder Vikings
[00:02:10] [POSTPROCESS]::SICKBEARD: Processing folder /volume1/downloads/tv/Vikings
[00:02:10] [POSTPROCESS]::SICKBEARD: Processing /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 (Vikings)
[00:02:10] [POSTPROCESS]::SICKBEARD: Retrieving episode object for 4x1
[00:02:10] [POSTPROCESS]::SICKBEARD: Looking up quality for name Vikings, got Unknown
[00:02:10] [POSTPROCESS]::SICKBEARD: Looking up quality for name Vikings, got Unknown
[00:02:10] [POSTPROCESS]::SICKBEARD: Looking up quality for name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4, got Unknown
[00:02:10] [POSTPROCESS]::SICKBEARD: Guessing quality for name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4, got SDTV
[00:02:10] [POSTPROCESS]::SICKBEARD: This was manually downloaded but it appears to be a proper so I'm marking it as priority
[00:02:10] [POSTPROCESS]::SICKBEARD: Is ep a priority download: True
[00:02:10] [POSTPROCESS]::SICKBEARD: File /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 is the same size as /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:02:10] [POSTPROCESS]::SICKBEARD: This download is marked a priority download so I'm going to replace an existing file if I find one
[00:02:10] [POSTPROCESS]::SICKBEARD: No associated files for /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 were found during this pass
[00:02:10] [POSTPROCESS]::SICKBEARD: Deleting file /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:02:10] [POSTPROCESS]::SICKBEARD: Using original release name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:02:10] [POSTPROCESS]::SICKBEARD: Destination folder for this episode: /volume1/video/TV Shows/Vikings (2013)/Season 04
[00:02:10] [POSTPROCESS]::SICKBEARD: No associated files for /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 were found during this pass
[00:02:10] [POSTPROCESS]::SICKBEARD: Hard linking file from /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 to /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:02:10] [POSTPROCESS]::SICKBEARD: Processing succeeded for /volume1/downloads/tv/Vikings/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:02:10] [POSTPROCESS]::SICKBEARD: Successfully processed
[00:02:10] [DEBUG]::PLEX: Attempting to update Plex Library for category tv.
[00:02:10] [DEBUG]::PLEX: Plex Library has been refreshed.
[00:02:10] [INFO]::CLEANDIR: Doing Forceful Clean of /volume1/downloads/tv/Vikings
[00:02:10] [INFO]::MAIN: Deleting /volume1/downloads/tv/Vikings
[00:02:10] [INFO]::MAIN: The /nzbToMedia/TorrentToMedia.py script completed successfully.
Dawnstealer> /nzbToMedia/TorrentToMedia.py 
[00:15:06] [INFO]::MAIN: Loading config from [/volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia/autoProcessMedia.cfg]
[00:15:06] [INFO]::ENVIRONMENT: LANG: en_US.utf8
[00:15:06] [INFO]::ENVIRONMENT: TERM: xterm-256color
[00:15:06] [INFO]::ENVIRONMENT: SHELL: /bin/ash
[00:15:06] [INFO]::ENVIRONMENT: TZ: AEST-10AEDT,M10.1.0,M4.1.0/3
[00:15:06] [INFO]::ENVIRONMENT: LC_ALL: en_US.utf8
[00:15:06] [INFO]::ENVIRONMENT: SSH_TTY: /dev/pts/1
[00:15:06] [INFO]::ENVIRONMENT: OLDPWD: /volume1/@appstore/VideoStation/bin
[00:15:06] [INFO]::ENVIRONMENT: PWD: /volume1/@appstore/VideoStation/bin
[00:15:06] [INFO]::ENVIRONMENT: PATH: /sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/sbin:/opt/bin
[00:15:06] [INFO]::ENVIRONMENT: PGDATA: /var/services/pgsql
[00:15:06] [INFO]::ENVIRONMENT: SSH_CLIENT: 
[00:15:06] [INFO]::ENVIRONMENT: LOGNAME: root
[00:15:06] [INFO]::ENVIRONMENT: USER: root
[00:15:06] [INFO]::ENVIRONMENT: TERMINFO: /usr/share/terminfo
[00:15:06] [INFO]::ENVIRONMENT: HOME: /root
[00:15:06] [INFO]::ENVIRONMENT: MAIL: /var/mail/root
[00:15:06] [INFO]::ENVIRONMENT: SSH_CONNECTION: 
[00:15:06] [INFO]::ENVIRONMENT: PAGER: more
[00:15:06] [INFO]::ENVIRONMENT: LD_LIBRARY_PATH: /opt/lib:/opt/include
[00:15:06] [INFO]::MAIN: Checking database structure...
[00:15:06] [DEBUG]::MAIN: Checking Initial Schema database upgrade
[00:15:06] [DB]::MAIN: nzbtomedia.db: SELECT 1 FROM sqlite_master WHERE name = ?; with args ('db_version',)
[00:15:06] [DB]::MAIN: nzbtomedia.db: SELECT db_version FROM db_version
[00:15:06] [DEBUG]::MAIN: InitialSchema upgrade not required
[00:15:06] [DEBUG]::MAIN: Checking if we can use git commands: "/usr/local/bin/git" version
[00:15:06] [DEBUG]::MAIN: Executing "/usr/local/bin/git" version with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:06] [DEBUG]::MAIN: git output: git version 2.7.0
[00:15:06] [DEBUG]::MAIN: "/usr/local/bin/git" version : returned successful
[00:15:06] [DEBUG]::MAIN: Using: "/usr/local/bin/git"
[00:15:06] [DEBUG]::MAIN: Executing "/usr/local/bin/git" symbolic-ref -q HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:06] [DEBUG]::MAIN: git output: refs/heads/nightly
[00:15:06] [DEBUG]::MAIN: "/usr/local/bin/git" symbolic-ref -q HEAD : returned successful
[00:15:06] [INFO]::MAIN: Checking if git needs an update
[00:15:06] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-parse HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:06] [DEBUG]::MAIN: git output: 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17
[00:15:06] [DEBUG]::MAIN: "/usr/local/bin/git" rev-parse HEAD : returned successful
[00:15:06] [DEBUG]::MAIN: Executing "/usr/local/bin/git" fetch origin with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:08] [DEBUG]::MAIN: git output: 
[00:15:08] [DEBUG]::MAIN: "/usr/local/bin/git" fetch origin : returned successful
[00:15:08] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-parse --verify --quiet "@{upstream}" with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:08] [DEBUG]::MAIN: git output: 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17
[00:15:08] [DEBUG]::MAIN: "/usr/local/bin/git" rev-parse --verify --quiet "@{upstream}" : returned successful
[00:15:08] [DEBUG]::MAIN: Executing "/usr/local/bin/git" rev-list --left-right "@{upstream}"...HEAD with your shell in /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia
[00:15:08] [DEBUG]::MAIN: git output: 
[00:15:08] [DEBUG]::MAIN: "/usr/local/bin/git" rev-list --left-right "@{upstream}"...HEAD : returned successful
[00:15:08] [DEBUG]::MAIN: cur_commit = 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17 % (newest_commit)= 9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17, num_commits_behind = 0, num_commits_ahead = 0
[00:15:08] [INFO]::MAIN: No update needed
[00:15:08] [INFO]::MAIN: nzbToMedia Version:9f3dea8cdf6127ff4672aac20ea9c7e5bf95fb17 Branch:nightly (Linux 3.2.40)
[00:15:09] [DEBUG]::MAIN: Connecting to transmission: http://localhost:9093
[00:15:09] [INFO]::MAIN: #########################################################
[00:15:09] [INFO]::MAIN: ## ..::[TorrentToMedia.py]::.. ##
[00:15:09] [INFO]::MAIN: #########################################################
[00:15:09] [DEBUG]::MAIN: Options passed into TorrentToMedia: ['/nzbToMedia/TorrentToMedia.py']
[00:15:09] [WARNING]::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...
[00:15:09] [INFO]::MAIN: Searching /volume1/downloads/movie for mediafiles to post-process ...
[00:15:09] [DEBUG]::MAIN: No directories identified in CouchPotato:movie for post-processing
[00:15:09] [INFO]::MAIN: Searching /volume1/downloads/tv for mediafiles to post-process ...
[00:15:09] [INFO]::MAIN: Starting manual run for SickBeard:tv - Folder:/volume1/downloads/tv/Anything
[00:15:09] [INFO]::MAIN: Checking database for download info for Anything ...
[00:15:09] [DB]::DB: Getting download info for Anything from the DB
[00:15:09] [DB]::MAIN: nzbtomedia.db: SELECT * FROM downloads WHERE input_name=? AND status=? with args [u'Anything', 0]
[00:15:09] [INFO]::MAIN: Unable to locate download info for Anything, continuing to try and process this release ...
[00:15:09] [DEBUG]::MAIN: Received Directory: /volume1/downloads/tv/Anything | Name: Anything | Category: tv
[00:15:09] [DEBUG]::MAIN: SEARCH: Found the Category: tv in directory structure
[00:15:09] [INFO]::MAIN: SEARCH: Found a unique directory Anything in the category directory
[00:15:09] [DEBUG]::MAIN: Determined Directory: /volume1/downloads/tv/Anything | Name: Anything | Category: tv
[00:15:09] [INFO]::MAIN: Auto-detected SECTION:SickBeard
[00:15:09] [INFO]::MAIN: Output directory set to: /volume1/downloads/tv/Anything
[00:15:09] [DEBUG]::MAIN: Scanning files in directory: /volume1/downloads/tv/Anything
[00:15:09] [DEBUG]::MAIN: Found 1 files in /volume1/downloads/tv/Anything
[00:15:09] [INFO]::COPYLINK: MEDIAFILE: [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4]
[00:15:09] [INFO]::COPYLINK: SOURCE FOLDER: [/volume1/downloads/tv/Anything]
[00:15:09] [INFO]::COPYLINK: TARGET FOLDER: [/volume1/downloads/tv/Anything]
[00:15:09] [INFO]::COPYLINK: SOURCE AND TARGET files are the same, skipping ...
[00:15:09] [DEBUG]::MAIN: Checking for archives to extract in directory: /volume1/downloads/tv/Anything
[00:15:09] [INFO]::MAIN: FLATTEN: Flattening directory: /volume1/downloads/tv/Anything
[00:15:09] [DEBUG]::MAIN: Checking for empty folders in:/volume1/downloads/tv/Anything
[00:15:09] [INFO]::MAIN: Found 1 media files in /volume1/downloads/tv/Anything
[00:15:09] [INFO]::MAIN: Calling SickBeard:tv to post-process:Anything
[00:15:10] [INFO]::MAIN: Attempting to auto-detect tv fork
[00:15:20] [INFO]::MAIN: SickBeard:tv fork auto-detection successful ...
[00:15:20] [INFO]::MAIN: SickBeard:tv fork set to sickrage
[00:15:20] [DEBUG]::MAIN: calling command: /volume1/@appstore/VideoStation/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/@appstore/sickrage/var/SickRage/contrib/nzbToMedia/tests/test.mp4
/volume1/@appstore/VideoStation/bin/ffprobe: /opt/lib/libz.so.1: no version information available (required by /var/packages/VideoStation/target/lib/ffmpeg/libavcodec.so.55)
[00:15:22] [INFO]::TRANSCODER: Checking [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4] for corruption, please stand by ...
[00:15:22] [DEBUG]::MAIN: calling command: /volume1/@appstore/VideoStation/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
/volume1/@appstore/VideoStation/bin/ffprobe: /opt/lib/libz.so.1: no version information available (required by /var/packages/VideoStation/target/lib/ffmpeg/libavcodec.so.55)
[00:15:23] [INFO]::TRANSCODER: SUCCESS: [Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4] has no corruption.
[00:15:23] [POSTPROCESS]::SICKBEARD: SUCCESS: The download succeeded, sending a post-process request
[00:15:23] [DEBUG]::SICKBEARD: Opening URL: https://localhost:8899/home/postprocess/processEpisode with params: {'nzbName': 'Anything', 'force': 1, 'quiet': 1, 'failed': 0, 'dir': '/volume1/downloads/tv/Anything', 'process_method': 'hardlink', 'delete_on': 1}
[00:15:39] [POSTPROCESS]::SICKBEARD: Processing folder /volume1/downloads/tv/Anything
[00:15:39] [POSTPROCESS]::SICKBEARD: PostProcessing Path: /volume1/downloads/tv
[00:15:40] [POSTPROCESS]::SICKBEARD: PostProcessing Dirs: [u'Anything']
[00:15:40] [POSTPROCESS]::SICKBEARD: PostProcessing Files: []
[00:15:40] [POSTPROCESS]::SICKBEARD: PostProcessing VideoFiles: []
[00:15:40] [POSTPROCESS]::SICKBEARD: PostProcessing RarContent: 
[00:15:40] [POSTPROCESS]::SICKBEARD: PostProcessing VideoInRar: 
[00:15:40] [POSTPROCESS]::SICKBEARD: Processing folder Anything
[00:15:40] [POSTPROCESS]::SICKBEARD: Processing folder /volume1/downloads/tv/Anything
[00:15:40] [POSTPROCESS]::SICKBEARD: Processing /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 (Anything)
[00:15:40] [POSTPROCESS]::SICKBEARD: Retrieving episode object for 4x1
[00:15:40] [POSTPROCESS]::SICKBEARD: Looking up quality for name Anything, got Unknown
[00:15:40] [POSTPROCESS]::SICKBEARD: Looking up quality for name Anything, got Unknown
[00:15:40] [POSTPROCESS]::SICKBEARD: Looking up quality for name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4, got Unknown
[00:15:40] [POSTPROCESS]::SICKBEARD: Guessing quality for name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4, got SDTV
[00:15:40] [POSTPROCESS]::SICKBEARD: This was manually downloaded but it appears to be a proper so I'm marking it as priority
[00:15:40] [POSTPROCESS]::SICKBEARD: Is ep a priority download: True
[00:15:40] [POSTPROCESS]::SICKBEARD: File /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 is the same size as /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:15:40] [POSTPROCESS]::SICKBEARD: This download is marked a priority download so I'm going to replace an existing file if I find one
[00:15:40] [POSTPROCESS]::SICKBEARD: No associated files for /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 were found during this pass
[00:15:40] [POSTPROCESS]::SICKBEARD: Deleting file /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:15:40] [POSTPROCESS]::SICKBEARD: Using original release name Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:15:40] [POSTPROCESS]::SICKBEARD: Destination folder for this episode: /volume1/video/TV Shows/Vikings (2013)/Season 04
[00:15:40] [POSTPROCESS]::SICKBEARD: No associated files for /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 were found during this pass
[00:15:40] [POSTPROCESS]::SICKBEARD: Hard linking file from /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4 to /volume1/video/TV Shows/Vikings (2013)/Season 04/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:15:40] [POSTPROCESS]::SICKBEARD: Processing succeeded for /volume1/downloads/tv/Anything/Vikings.S04E01.A.Good.Treason.SDTV.PROPER.mp4
[00:15:40] [POSTPROCESS]::SICKBEARD: Successfully processed
[00:15:40] [DEBUG]::PLEX: Attempting to update Plex Library for category tv.
[00:15:40] [DEBUG]::PLEX: Plex Library has been refreshed.
[00:15:40] [INFO]::CLEANDIR: Doing Forceful Clean of /volume1/downloads/tv/Anything
[00:15:40] [INFO]::MAIN: Deleting /volume1/downloads/tv/Anything
[00:15:40] [INFO]::MAIN: The /nzbToMedia/TorrentToMedia.py script completed successfully.
clinton-hall commented 8 years ago

Ok, I see where this is at... the simple answer here is I had intentionally left the original file such that it could be resumed for seeding or deleted by the downloader. So when the Downloader is used to call the script, the script would use the

[Torrent]
    deleteOriginal = 1

option to actually ask Transmission (Download Station) to delete the files/folders.

In your tests above, the fact that the directory is deleted is due to using the same folder for download complete and the

[Torrent]
    outputDirectory

if these were different, you would again find that the original files are not deleted...

I'll have a bit of a play, but I guess I have tried to err on the side of not deleting files (people tell me off pretty quickly when my script deletes files they want!)