[PP-Script / Queue-Script] Notifications (All In One)

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
b0mb
Posts: 8
Joined: 26 Apr 2016, 07:57

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by b0mb » 12 Feb 2019, 20:43

When i send a telegram message with dl stats i get an error because the message is too long...

so it would be nice if you could the script making split messages longer than 4096 bytes ;)

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by l2g » 16 Feb 2019, 06:23

@douche: Thank you for being so patient. I will try to have a look at this and push an update to nzb-notify soon.

@b0mb: This was a very large undertaking, but i 'think' I've implemented it in a development branch of apprise (which is what nzb-notify is based on now-a-days). The only problem with this request (and splitting the message into smaller sizes) is there is no way i can ever know the proper place to 'cut' the message.

I could cut it right in the middle of an html tag or mid sentence. I haven't gone through all the additional logic needed to get smart where the cut takes place. The thing is, services like telegram expect the content to arrive in an HTML format. It doesn't accept ill formatted messages and this can/will happen once we start snipping it up :). So while this will be a new feature i'll unveil hopefully in the next release, it comes with it's caveats.

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by l2g » 16 Feb 2019, 20:22

@douche: You issue should be fixed in the latest code sitting in the master branch of NZB-Notify here. I've stripped out all of the provided dependencies in the latest release though as well. You'll need to make sure you do the following though first:

Code: Select all

# This must be done on the same node as NZB-Notify is installed on
# The requirements are really light weight:
#  - apprise
#  - pynzbget
#  - chardet
pip install -i requirements.txt
@b0mb: I'm going to need more time on this; but I'm getting close. Here is the link the the Apprise branch you can pull into your system if you want to try what is present sooner. You just need to change the overflow method; this is done in the URL.
  • overflow=upstream : this is the default (and used if no overflow over-ride is specified). Simply send all message content upstream and let that service handle the data. Some handle this well, others don't (like you're finding with Telegram).
  • overflow=truncate : Force there still to be only one single message pushed upstream, but ensure that it's contents fit within the remote servers criteria. If you send 1000 characters to a server only expecting 100, then with this flag set, 900 characters will be truncated. You will in fact just send the first 100 characters.
  • overflow=split : Similar to truncate, however the whole message will make it's way to the remote server split into as many smaller messages as it will take to do so.
Those are the only 3 i can think of for now (as per how one might want their data handled). split and truncate currently are not smart. They do not carefully carve their messages around words and/or HTML tags.

douche
Posts: 55
Joined: 08 Feb 2014, 23:50

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by douche » 08 Apr 2019, 22:09

l2g wrote:
16 Feb 2019, 20:22
@douche: You issue should be fixed in the latest code sitting in the master branch of NZB-Notify here. I've stripped out all of the provided dependencies in the latest release though as well. You'll need to make sure you do the following though first:

Code: Select all

# This must be done on the same node as NZB-Notify is installed on
# The requirements are really light weight:
#  - apprise
#  - pynzbget
#  - chardet
pip install -i requirements.txt
Thanks for the update - I'll see about making the update on my system.
Cheers

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by l2g » 19 Jul 2019, 22:42

It's been a while, so I felt the need to update this script and slap a new build number on it.

Release v0.9.3 (Direct Download Link) is now in place.

The release details (and new documentation) can be found at the head of this thread (quick link). I added all of the new supported notification services here; there are more then 40 of them now (as of today).

Only 2 really major changes with this release:
  • it is it's fully Python 3 compatible (in addition to still being backwards compatible with v2).
  • it no longer ships with all of it's dependencies but instead includes a requirements.txt file. You will be required (just 1 time) to install them with

    Code: Select all

    pip install -r requirements.txt
    . While this may seem annoying, it only has to be done once. But when done again later, you'll get new security patches... and even more notification services as they become available through Apprise.

Happy notifying! :)

chanster
Posts: 2
Joined: 21 Sep 2019, 08:59

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by chanster » 21 Sep 2019, 09:04

I was able to install your script into my nzbget installation and everything works in the command line (I'm using Telegram). However, when I try to add the script into nzbget, I'm getting the following error messages when I try to test the connection :
Executing script Notify.py with command TestServers
Notify: Traceback (most recent call last):
Notify: File "/downloads/scripts/Notify.py", line 181, in <module>
Notify: from apprise import Apprise
Notify: File "/usr/lib/python2.7/site-packages/apprise/__init__.py", line 49, in <module>
Notify: from .Apprise import Apprise
Notify: File "/usr/lib/python2.7/site-packages/apprise/Apprise.py", line 29, in <module>
Notify: from markdown import markdown
Notify: File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 25, in <module>
Notify: from .core import Markdown, markdown, markdownFromFile
Notify: File "/usr/lib/python2.7/site-packages/markdown/core.py", line 29, in <module>
Notify: import pkg_resources
Notify: ImportError: No module named pkg_resources
Script Notify.py with command TestServers failed (terminated with unknown status)

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by l2g » 22 Sep 2019, 14:19

Hi,

Your issue seems really similar to this one. You could try:

Code: Select all

pip install setuptools
What OS are you using?

chanster
Posts: 2
Joined: 21 Sep 2019, 08:59

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by chanster » 23 Sep 2019, 00:15

l2g wrote:
22 Sep 2019, 14:19
Hi,

Your issue seems really similar to this one. You could try:

Code: Select all

pip install setuptools
What OS are you using?
I'm running Unraid and thanks for that link - it worked ! Followed the process to add the "custom-cont-init.d" directory etc. Thanks !

Krocko
Posts: 4
Joined: 21 Nov 2019, 08:28

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by Krocko » 22 Nov 2019, 08:28

Hello.
I use this great script on an Synology NAS and it is working great.
Thank you very much for your work.
I configured the telegram service.
I use

Code: Select all

?format=markdown
in the url. Ist it possible to use

Code: Select all

?format=markdown
and

Code: Select all

?image=yes
together?

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Queue-Script] Notifications (All In One)

Post by l2g » 22 Nov 2019, 14:09

Sure thing Krocko,

Think of the Apprise URLs just like regular Web URLs (like the websites you visit with your browser). The first parameter always starts with a question mark (?) signifying then end of the URI and the start of the parameters. Parameters are separated by ampersand (&).

Code: Select all

{schema}://{host}/{path}?{key}={value}&{key2}={value2}
In your case:

Code: Select all

tgram://{bot_token}?format=markdown&image=yes
Good luck!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests