Sonarr version (exact version): 2.0.0.4753
Mono version (if Sonarr is not running on Windows): Mono JIT compiler version 5.0.0.100 (2017-02/9667aa6 Fri May 5 09:12:57 EDT 2017)
OS: macOS 10.12.5
((Debug logs)): generated only for successful runs (see below)
Description of issue:
Hi all,
I’ve been experimenting with Sonarr and have been liking what I see so far, but I’ve come across something that I’m not sure if it’s a bug or working as intended. I’m trying to run a custom script after a download completes but before it is imported (will be passing EpisodeFile_SourcePath
to Handbrake for post-download video conversion and passing EpisodeFile_SourceFolder
to DownloadedEpisodesScan
in the API to import once the script completes). For this example I’m using a script that just exports the list of environment variables.
Completed Download Handling:
Enable: Yes
Remove: Yes (also tried No with same results)
Connect > Custom Script:
- On Grab: No
- On Download: Yes
- On Upgrade: Yes
- On Rename: No
Script:
#!/bin/bash
/usr/bin/env > /Users/foo/Desktop/vars.txt
If Completed Download Handling is enabled, the script runs as expected; file is imported into Sonarr, script runs:
17-5-29 22:37:15.3|Debug|EpisodeFileMovingService|Moving episode file: /Users/foo/Movies/Transmission/1. Import/bar/bar.mkv to /Users/foo/Movies/Plex/TV Shows/show/season/episode.mkv
17-5-29 22:37:15.4|Debug|DiskTransferService|Move [/Users/foo/Movies/Transmission/1. Import/bar/bar.mkv] > [/Users/foo/Movies/Plex/TV Shows/show/season/episode.mkv]
17-5-29 22:37:15.4|Debug|EpisodeService|Linking [season/episode.mkv] > [episode]
17-5-29 22:37:15.6|Debug|NotificationService|No tags set for this notification.
17-5-29 22:37:15.6|Debug|CustomScript|Executing external script: /Users/foo/Documents/Sonarr/vars.sh
17-5-29 22:37:15.6|Debug|vars.sh|Starting /Users/foo/Documents/Sonarr/vars.sh
17-5-29 22:37:15.9|Debug|CustomScript|Executed external script: /Users/foo/Documents/Sonarr/vars.sh - Status: 0
17-5-29 22:37:15.9|Debug|CustomScript|Script Output:
17-5-29 22:37:15.9|Debug|DiskScanService|Scanning '/Users/foo/Movies/Transmission/1. Import/bar' for video files
17-5-29 22:37:15.9|Debug|DiskScanService|0 video files were found in /Users/foo/Movies/Transmission/1. Import/bar
17-5-29 22:37:15.9|Debug|DownloadedEpisodesImportService|Deleting folder after importing valid files
If Completed Download Handling is disabled, CustomScript
never executes in the logs, even after leaving things alone for hours after the download. (From reading the instructions to set up the sickbeard_mp4_automator it appeared that the script should run with Completed Download Handling disabled.)
I thought that by setting “On Download”: Yes that the script would execute after the download completes regardless of whether Completed Download Handling was enabled, but this behavior makes me think it’s more of an “On Import” trigger.
Does Completed Download Handling need to be enabled to trigger “On Download” Connections?
Thanks in advance.