Add support for nzb-notify
sarvesh-lad opened this issue · 1 comments
sarvesh-lad commented
Starting SABnzbd v3.6.0 support for API based notification service will be removed.
Add nzb-notify into the package itself or atleast add the needed libraries to make setup easy for users
Expected Behavior
The scripts from nzb-notify should run without any additional config or user intervention
Current Behavior
Support for nzb-notify is missing.
Steps to Reproduce
- Follow setup instructions as indicated here: https://github.com/caronc/nzb-notify
- Setup a test notification server, I tried pushover as that's what I use.
- Run a test notification it will fail due to incorrect permission on the *.py files
- Fix permissions, I did chmod +x *.py
- Run test. It will fail again due to missing pynzbget / nzbget library
- run pip install -r requirements.txt from the container shell
- Run test, it is now successful
Environment
OS: Debian
CPU architecture: x86_64
How docker service was installed:
From github contianer repo.
Command used to create docker container (run/create/compose/screenshot)
Compose as provided in example/documentation
Docker logs
Permission errors:
2022-03-09 15:24:36,831::INFO::[api:894] Executing notification script
2022-03-09 15:24:36,832::INFO::[notifier:123] Sending notification: Error - Python script "/config/scripts/sabnzbd-notify.py" does not have execute (+x) permission set (type=error, job_cat=None)
2022-03-09 15:24:36,832::ERROR::[misc:1121] Python script "/config/scripts/sabnzbd-notify.py" does not have execute (+x) permission set
2022-03-09 15:24:36,832::INFO::[notifier:372] Failed script sabnzbd-notify.py, Traceback:
Traceback (most recent call last):
File "/app/sabnzbd/sabnzbd/notifier.py", line 368, in send_nscript
p = build_and_run_command([script_path, gtype, title, msg] + nscript_parameters, env=create_env())
File "/app/sabnzbd/sabnzbd/misc.py", line 1122, in build_and_run_command
raise IOError
OSError
2022-03-09 15:24:36,832::INFO::[notifier:123] Sending notification: Error - Notification script returned exit code -1 and output "None" (type=error, job_cat=None)
2022-03-09 15:24:36,832::ERROR::[notifier:375] Notification script returned exit code -1 and output "None"
Error of missing nzbget library
2022-03-09 15:25:04,341::INFO::[api:894] Executing notification script
2022-03-09 15:25:04,342::INFO::[misc:1161] [N/A] Running external command: ['/config/scripts/sabnzbd-notify.py', 'other', 'SABnzbd: Other Messages', 'Test Notification', 'pover://usertoken@apptoken']
2022-03-09 15:25:05,183::ERROR::[notifier:375] Notification script returned exit code 1 and output "Traceback (most recent call last):
File "/config/scripts/Notify.py", line 174, in <module>
from nzbget import SCRIPT_MODE
ModuleNotFoundError: No module named 'nzbget'
Installing requirement and successful notification:
root@sabnzbd:/config# pip install -r requirements.txt
WARNING: The directory '/config/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Requirement already satisfied: apprise>=0.7.0 in /usr/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.9.7)
Requirement already satisfied: setuptools in /usr/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (52.0.0)
Collecting pynzbget
Downloading pynzbget-0.6.4-py2.py3-none-any.whl (90 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.5/90.5 KB 2.8 MB/s eta 0:00:00
Requirement already satisfied: chardet in /usr/lib/python3.9/site-packages (from -r requirements.txt (line 4)) (4.0.0)
Requirement already satisfied: six in /usr/lib/python3.9/site-packages (from -r requirements.txt (line 5)) (1.16.0)
Requirement already satisfied: markdown in /usr/lib/python3.9/site-packages (from apprise>=0.7.0->-r requirements.txt (line 1)) (3.3.6)
Requirement already satisfied: requests in /usr/lib/python3.9/site-packages (from apprise>=0.7.0->-r requirements.txt (line 1)) (2.27.1)
Requirement already satisfied: click>=5.0 in /usr/lib/python3.9/site-packages (from apprise>=0.7.0->-r requirements.txt (line 1)) (8.0.4)
Requirement already satisfied: PyYAML in /usr/lib/python3.9/site-packages (from apprise>=0.7.0->-r requirements.txt (line 1)) (6.0)
Requirement already satisfied: requests-oauthlib in /usr/lib/python3.9/site-packages (from apprise>=0.7.0->-r requirements.txt (line 1)) (1.3.1)
Collecting lxml>=2.7
Downloading lxml-4.8.0-cp39-cp39-musllinux_1_1_x86_64.whl (7.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.7/7.7 MB 41.5 MB/s eta 0:00:00
Requirement already satisfied: importlib-metadata>=4.4 in /usr/lib/python3.9/site-packages (from markdown->apprise>=0.7.0->-r requirements.txt (line 1)) (4.11.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3.9/site-packages (from requests->apprise>=0.7.0->-r requirements.txt (line 1)) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.9/site-packages (from requests->apprise>=0.7.0->-r requirements.txt (line 1)) (1.26.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.9/site-packages (from requests->apprise>=0.7.0->-r requirements.txt (line 1)) (2020.12.5)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/lib/python3.9/site-packages (from requests->apprise>=0.7.0->-r requirements.txt (line 1)) (2.0.7)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/lib/python3.9/site-packages (from requests-oauthlib->apprise>=0.7.0->-r requirements.txt (line 1)) (3.2.0)
Requirement already satisfied: zipp>=0.5 in /usr/lib/python3.9/site-packages (from importlib-metadata>=4.4->markdown->apprise>=0.7.0->-r requirements.txt (line 1)) (3.7.0)
Installing collected packages: lxml, pynzbget
Successfully installed lxml-4.8.0 pynzbget-0.6.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@sabnzbd:/config# tail -f logs/sabnzbd.log
2022-03-09 15:25:04,341::INFO::[api:894] Executing notification script
2022-03-09 15:25:04,342::INFO::[misc:1161] [N/A] Running external command: ['/config/scripts/sabnzbd-notify.py', 'other', 'SABnzbd: Other Messages', 'Test Notification', 'pover://usertoken@apptoken']
2022-03-09 15:25:05,183::ERROR::[notifier:375] Notification script returned exit code 1 and output "Traceback (most recent call last):
File "/config/scripts/Notify.py", line 174, in <module>
from nzbget import SCRIPT_MODE
ModuleNotFoundError: No module named 'nzbget'
"
2022-03-09 15:29:46,794::INFO::[api:894] Executing notification script
2022-03-09 15:29:46,795::INFO::[misc:1161] [N/A] Running external command: ['/config/scripts/sabnzbd-notify.py', 'other', 'SABnzbd: Other Messages', 'Test Notification', 'pover://usertoken@apptoken']
2022-03-09 15:29:51,638::INFO::[notifier:378] Successfully executed notification script /config/scripts/sabnzbd-notify.py
github-actions commented