caronc / nzb-notify

Push Notifications to a large number of supported services for NZBGet and SABnzbd (based on Apprise)
GNU General Public License v3.0
129 stars 16 forks source link

Support priorities #81

Open Safihre opened 2 years ago

Safihre commented 2 years ago

It seems maybe I was a bit too quick to remove Pushover/Pushbullet support from SABnzbd as with nzb-notify they cannot specify the priorities of the different notifications types.

Do you see a way in which we can support this? If needed I can also change SABnzbd to have this as an additional parameter when calling the script: image

I think for now I will postpone removing Pushbullet/Pusover/Prowl support from SABnzbd in the next release.

caronc commented 2 years ago

Sure,

Keep in mind priorities are 100% supported:

See here

Just add it to the Apprise URL:

pover://credentials/?priority=value

PushBullet works the similar way. Just check out the service you need, and customize the (Apprise) URL to your heart's content.

The whole list of services

Safihre commented 2 years ago

Great! But, I meant more in the way of the sabnzbd-notify.py script: Would there be a way to maybe include it in the URL which type of notification (e.g. shutdown VS warning) has which priority?

caronc commented 2 years ago

No, that might have to happen on your end if you want to provide that level of granularity per action. You would need to adopt Apprise into SABnzbd and do away with the script. If you did this, you could then assign one or more (Apprise) URLs to pause, start, stop, etc. From here you could even do things like where download sends a message to say discord and twitter, while others send to different servers, or the same ones but with different configurations.

That said, i can brush myself up with how the script works again with SABnzbd and see if there is a way to do it through the CLI parameter parsing. If i recall (at the time, maybe not now though), the hand off of information from SAB to any script is somewhat limited. Under the hood, my script just get details on the notification (to send) and the one line of configuration users can provide to it via SAB (i use this for the Apprise URLs). Again, i might be very wrong here 😉

Safihre commented 2 years ago

Let me check if maybe we can do something to put it into the config-URL. Just a quick thought: pover://credentials/?priority_download=value&priority_X=value. I will look into the parsing if I can add that on the nzb-notify side 🙂

caronc commented 2 years ago

Hmm, i'm not sure if that's a good idea. ... it just seems very specific and hacky...

Is there an advantage to controlling the priority per message? When you have 75+ services at your disposal, and you're putting so much effort into the handling of just 1 of them. Am i reading this right?

I can see an on/off type deal. Maybe the notify script could open up the SABnzbd configuration file and read back: download: on, pause: off, etc from some field and apply the filtering to all notifications?

But as i understand it, you're trying to achieve this with high, low, etc.?

Safihre commented 2 years ago

There are more services supporting priorities right? So it would be for any that support it. It happens to be supported for all of the services we have build in and are trying to remove (Growl/Pushbullet/Pushover). So users notice.

What about ?priority[download]=4?

caronc commented 2 years ago

Sure, but some priorities for some protocols take a value in its integer, some take med, high, or low (for example Google FCM), so it really varies from service to service.

I would just hate to see you build a URL parser on top of a URL parser just to accommodate 1 of many services.

I'm wondering if we should leave your notification backend as is... drop support for SABnzbd notify script and just full integrate apprise into SABnzbd itself... You're interface would be as simple as:

  1. Apprise URL string (comma separated if more then one):
  2. a series of check-boxes to represent if they should trigger on download, pause, etc

Or if you really want to get granular... repeat the above... but instead of a series of check-boxes (per action.. .such as download, pause, etc... it's a choice of:

Where on/off are self explanatory... but custom requires you to provide the Apprise URL's again (to over-ride the global one). This will allow those who want to micro-mange the priories of the individual notices (or change who gets what can do so).

I can assure you that your code base will litterally shrink to:

import apprise

obj = apprise.Apprise()
obj.add('url-list-can-be-comma-separarted-even')

obj.notify('body', 'title')

# if there is an over-ride, to the action taking place... add that string of URL's instead of the master one

Food for thought anyhow...

Safihre commented 2 years ago

The reason to remove Growl/Pushover/Pushbullet from SABnzbd was to offload unnecessary features from SABnzbd so it can be a bit more lean. If we integrate Apprise, we sort of do the opposite, we increase the burden on SABnzbd. We would have to package it in our installers, which is quite a lot of work to do reliably (for example due to binary components like PyYAML) and would increase the size of the binaries even more due to the extra requirements. It would also mean that users would come to our forums first if there's problems.

Will try to make a proposal PR, I think you'll see what I intend is not that complicated 🙂

caronc commented 2 years ago

Sure, have at it and we can resume this conversation if needed. 👍

caronc commented 5 months ago

See sabnzbd/2796.

Priorities are simply part of the defined Apprise URL... pover://credentials?priority=3