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

move-sym with Deluge/Radarr partially working, link created to Output dir and not final destination #1289

Closed natoriousbigg closed 6 months ago

natoriousbigg commented 7 years ago

I'm running the latest nightly (2779cb6). I want to use Deluge with Radarr with sym-move option for torrent. I want to nzbtomedia to process it, send it to Radarr to move, then nzbtomedia to create symbolic link to the final destination create by Radarr so Deluge can continue to seed. It seems to work but nzbtomedia is createing a link from Download directory -> Output directory and not the Final directory. The Output directory is deleted after successful processing and then link in the Download directory is broken.

Just to clarify, I want use symbolic link as opposed to hard link is because the files that in the final directory in Radarr is actually inside a UnionFS mount and will eventually uploaded to the cloud. I only want to keep a copy of the symbolic link my local hard drive which is linked the the file in the cloud after it's been uploaded.

Here's my log:

2017-08-11 12:58:30 INFO    ::MAIN: #########################################################
2017-08-11 12:58:30 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2017-08-11 12:58:30 INFO    ::MAIN: #########################################################
2017-08-11 12:58:30 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['/data/postprocess/nzbtomedia-deluge/TorrentToMedia.py', '911085a778802e0ceaf2516e51d33f06683fc14a', 'King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO', '/data/media/downloads/torrents/movies']
2017-08-11 12:58:30 DEBUG   ::MAIN: Adding TORRENT download info for directory /data/media/downloads/torrents/movies to database
2017-08-11 12:58:30 DEBUG   ::MAIN: Received Directory: /data/media/downloads/torrents/movies | Name: King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO | Category: movies
2017-08-11 12:58:30 DEBUG   ::MAIN: SEARCH: Found the Category: movies in directory structure
2017-08-11 12:58:30 INFO    ::MAIN: SEARCH: Found torrent directory King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO in input directory directory /data/media/downloads/torrents/movies
2017-08-11 12:58:30 INFO    ::MAIN: SEARCH: Setting inputDirectory to /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:30 DEBUG   ::MAIN: Determined Directory: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO | Name: King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO | Category: movies
2017-08-11 12:58:30 INFO    ::MAIN: Auto-detected SECTION:Radarr
2017-08-11 12:58:30 DEBUG   ::MAIN: Stopping torrent King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO in deluge while processing
2017-08-11 12:58:35 INFO    ::MAIN: Output directory set to: /data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 DEBUG   ::MAIN: Scanning files in directory: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 DEBUG   ::MAIN: Found 1 files in /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::COPYLINK: MEDIAFILE: [King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.avi]
2017-08-11 12:58:35 INFO    ::COPYLINK: SOURCE FOLDER: [/data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO]
2017-08-11 12:58:35 INFO    ::COPYLINK: TARGET FOLDER: [/data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO]
2017-08-11 12:58:35 INFO    ::COPYLINK: Sym linking SOURCE MEDIAFILE -> TARGET FOLDER
2017-08-11 12:58:35 DEBUG   ::MAIN: Checking for archives to extract in directory: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::MAIN: FLATTEN: Flattening directory: /data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 DEBUG   ::MAIN: Checking for empty folders in:/data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::MAIN: Found 1 media files in /data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::MAIN: Calling Radarr:movies to post-process:King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::MAIN: Attemping imdbID lookup for King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 INFO    ::MAIN: Searching folder and file names for imdbID ...
2017-08-11 12:58:35 INFO    ::MAIN: Searching IMDB for imdbID ...
2017-08-11 12:58:35 DEBUG   ::MAIN: Opening URL: http://www.omdbapi.com
2017-08-11 12:58:35 ERROR   ::MAIN: No imdbID returned from omdbapi.com
2017-08-11 12:58:35 WARNING ::MAIN: Unable to find a imdbID for King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:35 DEBUG   ::SERVER: Attempting to connect to server at http://localhost:7878/api/command
2017-08-11 12:58:35 DEBUG   ::SERVER: Server responded at http://localhost:7878/api/command
2017-08-11 12:58:35 DEBUG   ::MAIN: calling command: /data/postprocess/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /data/postprocess/nzbtomedia-deluge/tests/test.mp4
2017-08-11 12:58:35 INFO    ::TRANSCODER: Checking [King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.avi] for corruption, please stand by ...
2017-08-11 12:58:35 DEBUG   ::MAIN: calling command: /data/postprocess/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.avi
2017-08-11 12:58:36 INFO    ::TRANSCODER: SUCCESS: [King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.avi] has no corruption.
2017-08-11 12:58:36 DEBUG   ::RADARR: Opening URL: http://localhost:7878/api/command with PARAMS: {'path': '/data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO', 'name': 'DownloadedMoviesScan', 'downloadClientId': '911085a778802e0ceaf2516e51d33f06683fc14a'}
2017-08-11 12:58:36 POSTPROCESS::RADARR: Starting DownloadedMoviesScan scan for King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:58:36 POSTPROCESS::POSTPROCESS: Radarr response: queued
2017-08-11 12:58:36 DEBUG   ::RADARR: Scan started with id: 3373
2017-08-11 12:58:36 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2017-08-11 12:58:36 DEBUG   ::RADARR: The Scan command return status: started
2017-08-11 12:59:36 POSTPROCESS::RADARR: Checking for status change, please stand by ...
2017-08-11 12:59:36 DEBUG   ::RADARR: The Scan command return status: completed
2017-08-11 12:59:36 DEBUG   ::RADARR: The Scan command has completed successfully. Renaming was successful.
2017-08-11 12:59:36 DEBUG   ::MAIN: Checking for sym-links to re-direct in: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO
2017-08-11 12:59:36 DEBUG   ::MAIN: Checking symlink: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.nfo
2017-08-11 12:59:36 DEBUG   ::MAIN: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.nfo is not a link
2017-08-11 12:59:36 DEBUG   ::MAIN: Checking symlink: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO.avi
2017-08-11 12:59:36 DEBUG   ::MAIN: Checking symlink: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/sample.avi
2017-08-11 12:59:36 DEBUG   ::MAIN: /data/media/downloads/torrents/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO/sample.avi is not a link
2017-08-11 12:59:36 DEBUG   ::MAIN: Starting torrent King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO in deluge
2017-08-11 12:59:41 INFO    ::CLEANDIR: Directory /data/media/downloads/torrents/processing/movies/King.Arthur.Legend.of.the.Sword.2017.HC.HDRip.XviD.AC3-EVO has been processed and removed ...
2017-08-11 12:59:41 INFO    ::MAIN: The /data/postprocess/nzbtomedia-deluge/TorrentToMedia.py script completed successfully.

My settings:

[General]
    # Enable/Disable update notifications
    version_notify = 0
    # Enable/Disable automatic updates
    auto_update = 0
    # Set to the full path to the git executable
    git_path = ""
    # GitHUB user for repo
    git_user = ""
    # GitHUB branch for repo
    git_branch = nightly
    # Enable/Disable forceful cleaning of leftover files following postprocess 
    force_clean = 0
    # Enable/Disable logging debug messages to nzbtomedia.log
    log_debug = 1
    # Enable/Disable logging database messages to nzbtomedia.log
    log_db = 0
    # Enable/Disable logging environment variables to debug nzbtomedia.log (helpful to track down errors calling external tools.)
    log_env = 0
    # Enable/Disable logging git output to debug nzbtomedia.log (helpful to track down update failures.)
    log_git = 0
    # Set to the directory where your ffmpeg/ffprobe executables are located
    ffmpeg_path = /data/postprocess/bin
    # Enable/Disable media file checking using ffprobe.
    check_media = 1
    # 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 = 1

[Posix]
    ### Process priority setting for External commands (Extractor and Transcoder) on Posix (Unix/Linux/OSX) systems.
    # Set the Niceness value for the nice command. These range from -20 (most favorable to the process) to 19 (least favorable to the process).
    niceness = 10
    # Set the ionice scheduling class. 0 for none, 1 for real time, 2 for best-effort, 3 for idle.
    ionice_class = 2
    # Set the ionice scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data.
    ionice_classdata = 4

[Radarr]
    [[movies]]
        enabled = 1
        apikey = XXXX
        host = localhost
        port = 7878
        web_root = ""
        ssl = 1
        delete_failed = 1
        Torrent_NoLink = 0
        keep_archive = 0
        extract = 1
        nzbExtractionBy = Downloader
        wait_for = 6
        minSize = 0
        delete_ignored = 0
        remote_path = 0
        watch_dir = /data/media/downloads/torrents/movies

[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 = move-sym
    ###### outputDirectory - Default output directory (categories will be appended as sub directory to outputDirectory)
    outputDirectory = /data/media/downloads/torrents/processing
    ###### Enter the default path to your default download directory (non-category downloads). this directory is protected by safe_mode. 
    default_downloadDirectory = /data/media/downloads/torrents
    ###### Other categories/labels defined for your downloader. Does not include CouchPotato, SickBeard, HeadPhones, Mylar categories.
    categories = music_videos, pictures, software, manual
    ###### A list of categories that you don't want to be flattened (i.e preserve the directory structure when copying/linking.
    noFlatten = pictures, manual
    ###### uTorrent Hardlink solution (You must edit this if your using TorrentToMedia.py with uTorrent)
    uTorrentWEBui = http://127.0.0.1:8090/gui/
    uTorrentUSR = your username
    uTorrentPWD = your password
    ###### Transmission (You must edit this if your using TorrentToMedia.py with Transmission)
    TransmissionHost = 127.0.0.1
    TransmissionPort = 9091
    TransmissionUSR = ""
    TransmissionPWD = ""
    #### 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 = localhost
    DelugePort = 58846
    DelugeUSR = localclient
    DelugePWD = XXXXX
    ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
    deleteOriginal = 0
    chmodDirectory = 0
    resume = 1
    resumeOnFailure = 1
clinton-hall commented 7 years ago

The issue is Radarr is moving the files which breaks the symlink and nzbToMedia doesn't know where to look to symlink to.

Basically, your nzbToMedia settings are right, but you need to have Radarr do a move with symlink back (or reverse symlink). To achieve this, set a postprocess script in Radarr... look at the following link and use the "reserse symlinking" section at the bottom of the page. https://github.com/Radarr/Radarr/wiki/Custom-Post-Processing-Scripts