mdhiggins / sonarr-sma

Sonarr docker based on linuxserver/sonarr with SMA built in using python3
MIT License
38 stars 18 forks source link

Sonarr V3 will not accept script arguments #6

Closed player666au closed 4 years ago

player666au commented 4 years ago

Hi,

Just tried the preview tagged image to see how Sonarr V3 looks.

It will not accept an argument for the path as suggested. Entering:

/usr/local/sma/env/bin/python3 /usr/local/sma/postSonarr.py

results in 'File does not exist' message and the save is refused.

A workaround shell script containing '/usr/local/sma/env/bin/python3 /usr/local/sma/postSonarr.py" is also not accepted. Error message is 'Script exited with code: 255'

Any thoughts for a fix or a workaround?

Thanks

player666au commented 4 years ago

I've modified the script as advised by tscibilia to contain:

/usr/local/sma/env/bin/python3 /usr/local/sma/postSonarr.py "$@"

Still get 'Script exited with code: 255'

This is the total script, one line.

The manual.py script is working fine within the container.

There is a note in the dialog 'Testing will execute the script with the EventType set to Test, ensure your script handles this correctly'. Maybe this is not covered in the script?

izeen commented 4 years ago

I also did this yesterday and have the same problem, i have another exit code tho: image image image

PostSonarr.sh is just:

/usr/local/sma/env/bin/python3 /usr/local/sma/postSonarr.py "$@"

[Error] PostSonarr.sh: Traceback (most recent call last): sonarr3 | [Error] PostSonarr.sh: File "/usr/local/sma/postSonarr.py", line 22, in sonarr3 | [Error] PostSonarr.sh: tvdb_id = int(os.environ.get('sonarr_series_tvdbid')) sonarr3 | [Error] PostSonarr.sh: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' sonarr3 | [Warn] SonarrErrorPipeline: Invalid request Validation failed: sonarr3 | -- : Script exited with code: 1

player666au commented 4 years ago

If you add the test logic early enough in postSonarr.py and, in my case, add #!/bin/bash as the first line in the formerly one line wrapper script, then the Sonarr V3 test finally executes, and then passes, and the script is accepted and the setting can be saved.

mdhiggins commented 4 years ago

Yeah looks like the test setting was accidentally deleted This has been fixed I'll start including the .sh script in future docker container updates as well

mdhiggins commented 4 years ago

Done, docker containers should be updating and postSonarr.sh should be included

player666au commented 4 years ago

Thank you! Ummm... postSonarr.sh needs to be executable or Sonarr is still not happy

mdhiggins commented 4 years ago

Shit I’ll take care of that tonight

mdhiggins commented 4 years ago

Alright should be fixed, the docker containers are rebuilding now

player666au commented 4 years ago

New image, postSonarr.sh is executable! However, script dialog test button now gives 'Script exited with code: 1'

And as container user abc: abc@72e97c56f3b0:/$ sonarr_eventtype="Test" /usr/local/sma/postSonarr.sh test Traceback (most recent call last): File "/usr/local/sma/postSonarr.py", line 14, in log = getLogger("SonarrPostProcess") File "/usr/local/sma/log.py", line 28, in getLogger fileConfig(configPath, defaults={'logfilename': logPath}) File "/usr/lib/python3.6/logging/config.py", line 84, in fileConfig handlers = _install_handlers(cp, formatters) File "/usr/lib/python3.6/logging/config.py", line 148, in _install_handlers h = klass(*args) File "/usr/lib/python3.6/logging/handlers.py", line 150, in init BaseRotatingHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.6/logging/handlers.py", line 57, in init logging.FileHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python3.6/logging/init.py", line 1032, in init StreamHandler.init(self, self._open()) File "/usr/lib/python3.6/logging/init.py", line 1061, in _open return open(self.baseFilename, self.mode, encoding=self.encoding) PermissionError: [Errno 13] Permission denied: '/var/log/sickbeard_mp4_automator/index.log'

Sorry.

player666au commented 4 years ago

And as root container user, all looks fine from the command line:

root@72e97c56f3b0:/# date Thu Feb 20 01:30:20 UTC 2020 root@72e97c56f3b0:/# sonarr_eventtype="Test" /usr/local/sma/postSonarr.sh test 2020-02-20 01:30:36 - SonarrPostProcess - INFO - Sonarr extra script post processing started. root@72e97c56f3b0:/#

mdhiggins commented 4 years ago

Yeah apparently the UID and GID aren't set when I expected during the build process, just pushed some new updates to the containers, rebuilding now but between radarr and sonarr there's 6 tags so the rebuild will take a bit

player666au commented 4 years ago

I can wait. And again, thank you for all this trouble and effort!

mdhiggins commented 4 years ago

No problem, I appreciate the testing let me know if this build works, I'll drop a comment when the sonarr preview build has finished

mdhiggins commented 4 years ago

Should be ready to go

player666au commented 4 years ago

Sorry Micheal, but the set of errors ending with 'PermissionError: [Errno 13] Permission denied: '/var/log/sickbeard_mp4_automator/index.log'' is still there. This is running as the abc user. Root works.

The Sonarr custom script still shows 'Script exited with code: 1' when the test button is clicked. Processing of media files does not happen. This is with the 0989abc Commit Source.

tscibilia commented 4 years ago

Yeah when i exec into the container, and do an 'ls -al' on the sma directory, the uid is 911 and group id is 1000 despite what is being set by the PUID and PGID variables

EDIT: I did this same and your radarr container displays all files as 'root:root' despite the PUID and PGID set in variables

mdhiggins commented 4 years ago

Trying to find a solution

mdhiggins commented 4 years ago

Alright, after much trial and error and nonsense I think the containers are working

player666au commented 4 years ago

Looks good to me! Sonarr dialog accepts the script without error, and episodes are being converted. Thanks!