Request: add support for SABnzbd "pause_resume" notifications
wegotourselvesareader opened this issue Β· comments
π‘ The Idea
SABnzbd offers the option to send a notification on pausing/resuming the queue:
However, sabnzbd-notify.py throws an error if the "Pause / Resume" option is enabled:
2021-12-12 14:00:11,695::INFO::[misc:1098] [N/A] Running external command: ['/downloads/scripts/sabnzbd-notify.py', 'pause_resume', 'SABnzbd: Pause/Resume', 'Paused', 'tgram://redacted_token/redacted_chat_id/']
2021-12-12 14:00:11,780::ERROR::[notifier:374] Notification script returned exit code 1 and output "2021-12-12 14:00:11,772 - sabnzbd-notify - 459 - ERROR - Invalid <Type> specified (argument 1)
Syntax: sabnzbd-notify.py <Type> <Title> <Message> url1[,url2[,urlN]]
* The <Type> can be one of the following:
startup: Startup/Shutdown
download: Added NZB
pp: Post-Processing Started
complete: Job Finished
failed: Job Failed
warning: Warning
error: Error
disk_full: Disk Full
queue_done: Queue Finished
new_login: User Logged In
other: Other Messages
* The <Title> and <Message> are self explanitory. If the <Title> is however left
blank, then the description of the <Type> is used instead.
* All remaining arguments are treated as URLs. You can also delimit multiple
URLs in a single string/argument with the use of a comma (,).
"
Would it be possible to add support for the pause_resume
notification, please?
π¨ Breaking Feature
I don't believe this would break anything, only augment the existing functionality. All the other notification types are supported by sabnzbd-notify.py; it's just pause_resume
which isn't.
I figured I'd give it a go to see if I could work out how to do it. I edited sabnzbd-notify.py to add a few lines into the notification map, between 'startup' and 'download':
SABNZBD_NOTIFICATION_MAP = {
# Startup/Shutdown
'startup': (
'Startup/Shutdown',
'info',
),
# Pause / Resume
'pause_resume': (
'Pause/Resume',
'info',
),
# Added NZB
'download': (
'Added NZB',
'info',
),
# Post-processing started
[...]
I tested it and got both "Paused" and "Resuming" notifications.
Great work! If you want to do a PR you can have all of the credit! I also don't mind doing one myself, but it won't probably be until this weekend. π
thanks for sharing all of your success! π
I've never done a pull or push in GitHub (rank novice, me), but I can give it a go. I've got some time towards the end of the week; I'll take a look at it then.
I've never done a pull or push in GitHub (rank novice, me), but I can give it a go. I've got some time towards the end of the week; I'll take a look at it then.
That was easier and quicker than I thought it might be. Done!
Fantastic! It's now merged into the master branch! Great work! Thanks for the PR!