mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.52k stars 201 forks source link

Sonarr/Radarr Import using script #1674

Open tomislav opened 1 year ago

tomislav commented 1 year ago

Sonarr and Radarr now support custom scripts for importing (i.e.. pre-import scripts) https://github.com/Sonarr/Sonarr/pull/5538

All the environmental variables seem the same as OnDownload, and the script should just return exit code 3 after transcoding and they will handle the import.

mdhiggins commented 1 year ago

Shouldn't need any script adjustment then, there was never any specific discrimination between the various calls just the presence of the appropriate environment variables. Are you seeing issues?

tomislav commented 1 year ago

Looking at postSonnar.py the script checks if sonarr_eventtype is Download, and this is not passed by this pre-import. It will probably need a separate script with proper exit codes too.

tomislav commented 1 year ago

https://github.com/Sonarr/Sonarr/blob/60f18249b05daa20523542beef54bc126d963d1e/src/NzbDrone.Core/MediaFiles/ScriptImportDecider.cs#L57

mdhiggins commented 1 year ago

Yeah reading over this it will need its own script I think, a preSonarr.py if you will though I can probably reuse a good portion of postSonarr

mdhiggins commented 1 year ago

https://github.com/Sonarr/Sonarr/pull/5956

Looks like until these features are implemented this new import script probably won't be useful for SMA purposes but I'll keep an eye out for it

JeWe37 commented 1 year ago

Note: I can recommend that you do make some changes to your scripts and remux and transcode from the downloads folder directly to the library folder, as it saves an additional unnecessary copy and thus speeds things up a fair bit(especially for pure remuxing). I can also recommend always requesting a rename, as you don't know whether people might be using say the audio or video codec in their naming scheme. Deferring is not really intended to change the file before it is imported. If you defer to Sonarr no changes should have been made. Good to see some potential usages by people other than me though.

mdhiggins commented 1 year ago

Yeah I was mostly referring to these two features

Custom import scripts that generate additional extra files to be imported. Custom import scripts that remux the original media file to a different container, such that its extension must change

Both of things can and often do happen for SMA processed media, changing containers and ripping or downloading additional subtitles are common so as I understand it that would needed to be supported before adopting the feature

Currently doing things in the download folder is handled by post downloader scripts executed by the downloader before notifying Sonarr/Radarr since they haven't supported this historically, but once this matures it would be nice to offer a script for it

tomislav commented 10 months ago

https://github.com/Sonarr/Sonarr/pull/5956 is now merged