Custom script on Synology generating errors

Sonarr version (exact version): 2.0.0.5153
Mono version (if Sonarr is not running on Windows): 5.8.0.108
OS: Synology DSM

So I got my custom subtitle extraction script to work, only quirk I haven’t been able to tackle is an exception thrown which results in all ffmpeg processing to be added as error level in the Sonarr logs. I don’t get this issue when running the script manually.

The script calls ffmpeg:
call ([ffmpeg, '-i', filePath, '-vn', '-an', '-map', '0:m:language:eng', re.sub(r".mkv", ".en.srt", filePath)])

But that throws a lib exception, which doesn’t seem the hinder functionality, but results in a error in the logs. (p.s. I had the same thing with PHP)

18-4-11 15:47:48.6|Debug|CustomScript|Executing external script: /usr/bin/python
18-4-11 15:47:48.6|Debug|python|Starting /usr/bin/python /volume1/Sonarr/extract-NL-EN-subs-Sonarr.py
18-4-11 15:47:49.4|Debug|PendingReleaseService|Removing previously pending release, as it was grabbed.
18-4-11 15:47:49.6|Debug|PendingReleaseService|Removing previously pending release, as it was grabbed.
18-4-11 15:47:50.3|Error|python|ffmpeg: /volume1/@appstore/nzbdrone/lib/libz.so.1: no version information available (required by /lib/libavformat.so.56)
18-4-11 15:47:50.4|Error|python|ffmpeg: /volume1/@appstore/nzbdrone/lib/libz.so.1: no version information available (required by /lib/libavcodec.so.56)
18-4-11 15:47:50.4|Error|python|ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers

Has anyone got any idea on how to mitigate the error, or at least how to supress the FFMPEG processing feedback to limit the clutter?

Edit 1: Lib versions
/volume1/@appstore/nzbdrone/lib/libz.so.1 -> libz.so.1.2.11
/usr/lib/libz.so.1 -> libz.so.1.2.8

ffmpeg is logging those to standard error which in turn Sonarr logs as an error. Having your script redirect the standard error to a file may work, though that could suppress something valid in the future.

Thanks, gonna it a try tomorrow.

A quick Google says that should be as simple as adding
2> /path/to/error.txt
To the ffmpegcommand

You could also try redirecting standard error to standard out and that should prevent Sonarr from seeing it as an error.

I thought a shorts nights sleep might help, but I’m still stuck.

ffmpeg -i /volume1/Sonarr/The\ Flash\ \(2014\)/The.Flash.2014.S04E17.INTERNAL.1080p.WEB.H264-DEFLATE-Obfuscated.mkv -vn -an -map 0:s:0 /volume1/Sonarr/The\ Flash\ \(2014\)/The.Flash.2014.S04E17.INTERNAL.1080p.WEB.H264-DEFLATE-Obfuscated.test.srt 2>&1

from the command line works.

But if I try it from a call, I get a

[NULL @ 0x15742e0] Unable to find a suitable output format for '2>&1'
2>&1: Invalid argument

Edit 2: Nevermind, seems my nights sleep was a bit too short, and I’m closing the command at the wrong place ]. Have to do some more testing, but this seems to work running it manually call([ffmpeg, '-i', filePath, '-vn', '-an', '-map', '0:s:0', srt], stderr=sys.stdout.fileno())

Staying in debug nicely. Gonna retry with 2>&1 now I know where to place the ] as that seems to be the more common annotation.

18-4-12 11:03:21.7|Debug|python|Starting /usr/bin/python /volume1/Sonarr/extract-NL-EN-subs-Sonarr.py
18-4-12 11:03:23.2|Debug|python|ffmpeg: /volume1/@appstore/nzbdrone/lib/libz.so.1: no version information available (required by /lib/libavformat.so.56)
18-4-12 11:03:23.3|Debug|python|ffmpeg: /volume1/@appstore/nzbdrone/lib/libz.so.1: no version information available (required by /lib/libavcodec.so.56)
18-4-12 11:03:23.3|Debug|python|ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers

With the help of someone who actually knows what he doing :wink: the script is coming along nicely. Still some stuff I want to change, but if someone wants a look, here’s the extraction script.

https://pastebin.com/tfDfc1Ve

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