sonarr rename script stopped working

Any questions? Need some help?
Post Reply
chc
Posts: 8
Joined: 22 Apr 2020, 14:01

sonarr rename script stopped working

Post by chc »

I have a rename script as a bat file which is called from Connect (On Import, On Upgrade) in Sonarr.
It use to work fine until a few months ago, possibly when Sonarr was upgraded to v3. I noticed the files are not renaming and when I go into Sonarr and validate the script via Save, I get the following error "Script exited with code: 3".

rename.bat script:

Code: Select all

filebot -rename "%sonarr_series_path%" -r --db TheTVDB --format "{n.upperInitial().space('.')}.S{any{s.pad(2)}{'00'}}E{es*.pad(2).join('-E')}.{t.upperInitial().space('.')}.{'.'+fn.match(/UNRATED|UNCUT|INTEGRAL|IMAX|EXTENDED/).upper()}.{any{fn =~ /AMZN.WEB-DL|WEB-DL|.WEB.|.INTERNAL./ ? /WEBDL/ : source}{'BluRay'}}{'-'+vf}{fn =~ /DolbyVision|DV/ ? /.DolbyVision/ : null}.{aco.replace('Dolby TrueHD with Dolby Atmos', 'TrueHD.Atmos').replace('Dolby TrueHD', 'TrueHD').replace('DTS-HD Master Audio', 'DTS-HD').replace('Dolby Digital Plus with Dolby Atmos', 'DD+.Atmos').replace('Dolby Digital Plus', 'DD+').replace('Dolby Digital', 'DD')}.{channels}{'.'+fn.match(/REMUX/).upper()}"
chc
Posts: 8
Joined: 22 Apr 2020, 14:01

Re: sonarr rename script stopped working

Post by chc »

Additional context, I know everything within the format statement works, as that is my default format setting within the filebot app.

Something is failing between the call from sonarr and the response from the script.

I also validated my radarr script, which is basically the same (different format statement and path name) and it works just fine.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sonarr rename script stopped working

Post by rednoah »

:?: What happens if you call the script manually? (make sure to pre-set the %variables% to simulate a call by Sonarr)


:?: What does the console output say?


:?: Did you confirm that Sonarr does in fact call your *.bat script? Note that *.bat scripts are not executables, and only work like executables in the context of a CMD shell. You might need to explicitly call your *.bat script with cmd.exe or skip the *.bat script entirely and call filebot.exe directly. If filebot is called, but doesn't work, then we can check the console output and see what's going awry. But if filebot is never called, then you'll probably want to check the Sonarr forums for advice on how to make this work in general independent of filebot.
:idea: Please read the FAQ and How to Request Help.
chc
Posts: 8
Joined: 22 Apr 2020, 14:01

Re: sonarr rename script stopped working

Post by chc »

Thanks for the troubleshooting suggestions.

I ran the bat manually, pre-populating the $variables$ and it ran but with suggested considerations.

Code: Select all

* Consider using -non-strict to enable advanced auto-selection
* Consider using --filter "id in [TvDB ID]" or --q "Series Name" to select one specific series
* Consider using --mode interactive to enable interactive mode
So I added --q "Series Name" to the script and reran manually, which worked. I added --q "%sonarr_series_title" as another variable input. I'll wait and see if that resolves the issue with the next auto triggered run.
Last edited by chc on 29 Nov 2021, 14:30, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sonarr rename script stopped working

Post by rednoah »

-non-strict is generally required for files that aren't guaranteed to be well-named yet:
https://www.filebot.net/cli.html

--q is typically ill-suited for automated setups. Unless you happen to have a variable at hand that literally is the series name verbatim. Sonarr could be the exception to the rule here.
:idea: Please read the FAQ and How to Request Help.
chc
Posts: 8
Joined: 22 Apr 2020, 14:01

Re: sonarr rename script stopped working

Post by chc »

I had two real auto runs happen and it is now working with the --q addition. Thanks for the troubleshooting tip.
Post Reply