Downloadedepisodesscan api call moving instead of copying

I have been using very happily Sonarr for a few months now, managing a dedicated server seedbox from a local raspberry pi, automating downloads from my seedbox to my local raspberry pi based NAS using Syncthing. A pretty sweet setup that I was quite pleased with.

But I am greedy and I have been trying to automate uploads from the seedbox to google drive using rclone. As an intermediate step, I am trying to use another instance of sonarr running on the seedbox to create the file structure/sorting that then is pushed to the cloud.

The problem comes when I can’t manage to make sonarr to copy instead of moving using a API call. I specifically need copying as the source folder is the one that Syncthing uses to send files to my local NAS.

I hope someone will know what is it that I am doing wrong. Thanks in advance.

Further details of the issue below:

Sonarr version (exact version): 2.0.0.4949
Mono version (if Sonarr is not running on Windows): 4.2.3
OS: Ubuntu 12.04.5 LTS

Description of issue:

I am trying to use an api call to trigger episode importing/renaming having Complete Download Handling disabled and Drone Factory Interval set to 0 (thus also disabled). Drone Factory Path is set to /home/user/temp and use hardlinks instead of copy is enabled under Settings -> Media Managing -> Importing

The API call I use is the following:

curl http://localhost:8989/sonarr/api/command -X POST -d '{"name": "downloadedepisodesscan", "importMode": "Copy"}' --header "X-Api-Key:MY_API_KEY"

The reason for using the API call in the first place is that Drone Factory does not support copying or creating hardlinks, but unfortunatelly I am not acheiving copying through the API call as the original file is deleted after being imported.

According to the downloadedepisodesscan method documentation, copying instead of moving should be possible so I seem to be missing something.

Trace logs:

17-10-29 18:19:44.3|Trace|Http|Req: 98 [POST] /api/command
17-10-29 18:19:44.3|Trace|CommandQueueManager|Publishing DownloadedEpisodesScan
17-10-29 18:19:44.3|Trace|CommandQueueManager|Checking if command is queued or started: DownloadedEpisodesScan
17-10-29 18:19:44.3|Trace|CommandQueueManager|Inserting new command: DownloadedEpisodesScan
17-10-29 18:19:44.4|Trace|CommandExecutor|DownloadedEpisodesScanCommand -> DownloadedEpisodesCommandService
17-10-29 18:19:44.4|Trace|CommandQueueManager|Marking command as started: DownloadedEpisodesScan
17-10-29 18:19:44.4|Trace|Http|Res: 98 [POST] /api/command: 201.Created (153 ms)
17-10-29 18:19:44.4|Debug|Api|[POST] /api/command: 201.Created (153 ms)
17-10-29 18:19:44.5|Debug|DiskScanService|Scanning '/home/user/temp/' for video files
17-10-29 18:19:44.5|Trace|DiskScanService|5 files were found in /home/user/temp/
17-10-29 18:19:44.5|Debug|DiskScanService|1 video files were found in /home/user/temp/
17-10-29 18:19:44.5|Debug|Parser|Parsing string 'gunpowder.1x01.720p_hdtv_x264-fov'
17-10-29 18:19:44.5|Trace|Parser|^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))(?:[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)
17-10-29 18:19:44.5|Debug|Parser|Episode Parsed. gunpowder - S01E01 
17-10-29 18:19:44.5|Debug|Parser|Language parsed: English
17-10-29 18:19:44.5|Debug|QualityParser|Trying to parse quality for gunpowder.1x01.720p_hdtv_x264-fov
17-10-29 18:19:44.5|Debug|Parser|Quality parsed: HDTV-720p v1
17-10-29 18:19:44.5|Debug|Parser|Release Group parsed: fov
17-10-29 18:19:44.6|Debug|ImportDecisionMaker|Analyzing 1/1 files.
17-10-29 18:19:44.6|Debug|Parser|Parsing string 'gunpowder.1x01.720p_hdtv_x264-fov.mkv'
17-10-29 18:19:44.6|Trace|Parser|^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))(?:[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)
17-10-29 18:19:44.6|Debug|Parser|Episode Parsed. gunpowder - S01E01 
17-10-29 18:19:44.6|Debug|Parser|Language parsed: English
17-10-29 18:19:44.6|Debug|QualityParser|Trying to parse quality for gunpowder.1x01.720p_hdtv_x264-fov.mkv
17-10-29 18:19:44.6|Debug|Parser|Quality parsed: HDTV-720p v1
17-10-29 18:19:44.6|Debug|Parser|Release Group parsed: fov
17-10-29 18:19:44.6|Debug|ImportDecisionMaker|Size: 736777248
17-10-29 18:19:44.6|Debug|VideoFileInfoReader|Getting media info from /home/user/temp/gunpowder.1x01.720p_hdtv_x264-fov.mkv
17-10-29 18:19:44.7|Trace|MediaInfo|Read file offset 0-49152 (49152 bytes)
17-10-29 18:19:44.7|Trace|MediaInfo|Read file offset 736761725-736777248 (15523 bytes)
17-10-29 18:19:44.7|Trace|MediaInfo|Read a total of 64675 bytes (0.0%)
17-10-29 18:19:44.7|Trace|ConfigService|Using default config value for 'skipfreespacecheckwhenimporting' defaultValue:'False'
17-10-29 18:19:44.7|Debug|SameFileSpecification|No existing episode file, skipping
17-10-29 18:19:44.7|Debug|GrabbedReleaseQualitySpecification|No download client item provided, skipping.
17-10-29 18:19:44.7|Debug|Parser|Parsing string 'temp'
17-10-29 18:19:44.7|Debug|Parser|Unable to parse temp
17-10-29 18:19:44.8|Debug|VideoFileInfoReader|Getting media info from /home/user/temp/gunpowder.1x01.720p_hdtv_x264-fov.mkv
17-10-29 18:19:44.8|Trace|MediaInfo|Read file offset 0-49152 (49152 bytes)
17-10-29 18:19:44.8|Trace|MediaInfo|Read file offset 736761725-736777248 (15523 bytes)
17-10-29 18:19:44.8|Trace|MediaInfo|Read a total of 64675 bytes (0.0%)
17-10-29 18:19:44.8|Debug|DetectSample|Runtime is over 90 seconds
17-10-29 18:19:44.8|Trace|ConfigService|Using default config value for 'downloadclientworkingfolders' defaultValue:'_UNPACK_|_FAILED_'
17-10-29 18:19:44.9|Debug|Parser|Parsing string 'gunpowder.1x01.720p_hdtv_x264-fov'
17-10-29 18:19:44.9|Trace|Parser|^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))(?:[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)
17-10-29 18:19:44.9|Debug|Parser|Episode Parsed. gunpowder - S01E01 
17-10-29 18:19:44.9|Debug|Parser|Language parsed: English
17-10-29 18:19:44.9|Debug|QualityParser|Trying to parse quality for gunpowder.1x01.720p_hdtv_x264-fov
17-10-29 18:19:44.9|Debug|Parser|Quality parsed: HDTV-720p v1
17-10-29 18:19:44.9|Debug|Parser|Release Group parsed: fov
17-10-29 18:19:44.9|Debug|EpisodeFileMovingService|Moving episode file: /home/user/temp/gunpowder.1x01.720p_hdtv_x264-fov.mkv to /home/user/media_temp/Series/Gunpowder/Season 1/gunpowder.1x01.720p_hdtv_x264-fov.mkv
17-10-29 18:19:45.0|Debug|DiskTransferService|Move [/home/user/temp/gunpowder.1x01.720p_hdtv_x264-fov.mkv] > [/home/user/media_temp/Series/Gunpowder/Season 1/gunpowder.1x01.720p_hdtv_x264-fov.mkv]
17-10-29 18:19:45.0|Trace|SymbolicLinkResolver|Checking path /home/user/media_temp/Series/Gunpowder/Season 1/gunpowder.1x01.720p_hdtv_x264-fov.mkv for symlink returned error ENOENT, assuming it's not a symlink.
17-10-29 18:19:45.0|Trace|DiskTransferService|Attempting to move hardlinked backup.
17-10-29 18:19:45.0|Trace|DiskTransferService|Hardlink move succeeded, deleting source.
17-10-29 18:19:45.0|Trace|DiskProviderBase|Deleting file: /home/user/temp/gunpowder.1x01.720p_hdtv_x264-fov.mkv

You shouldn’t use the Drone Factory path at all. If you don’t supply a ‘path’ then all other options are ignored and it’s just going to scan the drone factory.
The importMode only applies to api calls with include the path. (path to folder or file of a single job/download, so not the /temp dir)
The path can point to a folder with multiple vids, as long as those vids are part of the same release (season pack).

So: name=‘downloadedEpisodesScan’, path=folder/file, importMode=‘Copy’

1 Like

I see! I will have to adapt my workflow to the explained behaviour.

Thanks for such a prompt response!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.