[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.
morback
Posts: 4
Joined: 31 Oct 2016, 11:23

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

Post by morback » 24 Dec 2016, 09:54

l2g wrote:I do provide all of those statistics and information you're requesting, but it's restricted for certain services. The problem is that some notification services (like Join Notification for example) can't support a lot of characters (PushBullet has no problem). As a result these Notification responses are 'significantly shortened'.

If you want, you can open up the Notify.py script (with a text editor and look for lines 660 - 663). These lines are exclusively for the Join Notification itself; they look like this:

Code: Select all

                # Limit results to just the first 2 line otherwise
                # there is just to much content to display
                body = re.split('[\r\n]+', body)
                body[0] = body[0].strip('#').strip()
                body = '\r\n'.join(body[0:2])
You'll want to comment out (place a hashtag (#) in front of) these lines which will disable this filter i've (intentionally) got in place for JOIN Notifications. Make it so your change looks like:

Code: Select all

                # Limit results to just the first 2 line otherwise
                # there is just to much content to display
                # body = re.split('[\r\n]+', body)
                # body[0] = body[0].strip('#').strip()
                # body = '\r\n'.join(body[0:2])
Save the file and reload NZBGet. I think you'll find that Join Notifications won't handle the large message how you'd have hoped it would. Its certainly no comparison to PushBullet. Another thing you could try is switching to another notification service that supports more characters (like Telegram, or Slack for example). Good luck! :)
Thank you so much! I kept using pushbullet until I received a notification "you're close to your 500 API pushes month limit"
I guess join is still actively developed and what we loose by using it instead of pb is compensated with presence of other features.

Anyways, I'll consider a donation (after Christmas :3)
Happy Holidays

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

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

Post by l2g » 25 Jan 2017, 00:58

There were lots of mini bug fixes since the last release (mostly related to the Telegram Service). I just figured I'd bundle them up and mark a stable release from it all.

Thus: Release v0.5.6 (Direct Download Link) is in place.

The release details (and new documentation) can be found at the head of this thread (quick link).

Happy notifying! :)

Tadsz
Posts: 3
Joined: 25 Feb 2017, 20:48

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

Post by Tadsz » 25 Feb 2017, 20:57

l2g wrote:mostly related to the Telegram Service
Thank you for making such a wonderful script! I've just gotten into setting up bots in telegram and I've got it all working with Sonarr notification, but when I set it up in NZBget, I'm receiving errors. The same bot does work with notifications through Sonarr so I guess I'm doing something wrong with your script.

I've downloaded the latest version from Git (about one hour ago) and placed 'Notify.py' and the directory 'Notify' into the scripts folder and I was able to configure everything as needed. However, when I run a notification (either through nzbget or directly through python) I receive the following reports:

Code: Select all

Traceback (most recent call last):
  File "Notify.py", line 290, in <module>
    from pnotify import *
  File "/opt/nzbget/scripts/Notify/pnotify/__init__.py", line 26, in <module>
    from NotifyBoxcar import NotifyBoxcar
  File "/opt/nzbget/scripts/Notify/pnotify/NotifyBoxcar.py", line 23, in <module>
    import requests
  File "/opt/nzbget/scripts/Notify/requests/__init__.py", line 53, in <module>
    from urllib3.contrib import pyopenssl
  File "/opt/nzbget/scripts/Notify/urllib3/contrib/pyopenssl.py", line 53, in <module>
    import OpenSSL.SSL
  File "/opt/nzbget/scripts/Notify/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/opt/nzbget/scripts/Notify/OpenSSL/SSL.py", line 112, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'FFILibrary' object has no attribute 'Cryptography_HAS_SSL_ST
Is there some part I've missed or could you help me figure out what I need to do get the notification script running?

I'm using Python 2.7.9 on Debian Jessie (osmc for Raspberry Pi 2) and NZBget 17.0

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

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

Post by l2g » 26 Feb 2017, 02:33

AttributeError: 'FFILibrary' object has no attribute 'Cryptography_HAS_SSL_ST
Your issue seems close to this one.

There are 'a lot' of people having it with tons of other systems and packages (not just mine - see here). It's a result of an incompatibility with pyOpenSSL introduced in pyOpenSSL v16.1.0. This is probably what you're running. It was fixed in v16.2.0; try seeing if this is the case for you.
Last edited by l2g on 26 Feb 2017, 19:10, edited 1 time in total.

Tadsz
Posts: 3
Joined: 25 Feb 2017, 20:48

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

Post by Tadsz » 26 Feb 2017, 14:28

l2g wrote:This is probably what you're running (see here). It was fixed in v16.2.0; try seeing if this is the case for you.
Thank you for the quick response! Apparently I was still on 0.14. I think I'm almost done setting everything up! If I send a notification through command-line, I receive a correct notification in Telegram.

However, when I configure Notify.py as the scan/PP-script I receive the following errors. I've checked Python and I'm already on the latest version. Where can I start to figure out how to solve this? (It seems to be an error in Python self, so I guess it's not really your script anymore, but I was hoping you could still help me out :D )

Code: Select all

Sun Feb 26 15:10:54 2017	INFO	Executing post-process-script Notify.py for MPfKsQRxh8vpwUMJPqSL1
Sun Feb 26 15:10:56 2017	WARNING	Notify: NZBParse - NZB-File is missing: MPfKsQRxh8vpwUMJPqSL1.nzb
Sun Feb 26 15:10:57 2017	WARNING	Notify: RCP Connection Failure (1): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Sun Feb 26 15:10:58 2017	ERROR	Notify: Traceback (most recent call last):
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/opt/nzbget/scripts/Notify/nzbget/ScriptBase.py", line 2723, in run
Sun Feb 26 15:10:58 2017	INFO	Notify:     exit_code = main_function(*args, **kwargs)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/opt/nzbget/scripts/Notify.py", line 1070, in postprocess_main
Sun Feb 26 15:10:58 2017	INFO	Notify:     logs = self.get_logs(25)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/opt/nzbget/scripts/Notify/nzbget/ScriptBase.py", line 2271, in get_logs
Sun Feb 26 15:10:58 2017	INFO	Notify:     logs = self.api.postqueue(10000)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
Sun Feb 26 15:10:58 2017	INFO	Notify:     return self.__send(self.__name, args)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request
Sun Feb 26 15:10:58 2017	INFO	Notify:     verbose=self.__verbose
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
Sun Feb 26 15:10:58 2017	INFO	Notify:     return self.single_request(host, handler, request_body, verbose)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/xmlrpclib.py", line 1301, in single_request
Sun Feb 26 15:10:58 2017	INFO	Notify:     self.send_content(h, request_body)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/xmlrpclib.py", line 1448, in send_content
Sun Feb 26 15:10:58 2017	INFO	Notify:     connection.endheaders(request_body)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
Sun Feb 26 15:10:58 2017	INFO	Notify:     self._send_output(message_body)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/httplib.py", line 850, in _send_output
Sun Feb 26 15:10:58 2017	INFO	Notify:     self.send(msg)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/httplib.py", line 812, in send
Sun Feb 26 15:10:58 2017	INFO	Notify:     self.connect()
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/httplib.py", line 1212, in connect
Sun Feb 26 15:10:58 2017	INFO	Notify:     server_hostname=server_hostname)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/ssl.py", line 350, in wrap_socket
Sun Feb 26 15:10:58 2017	INFO	Notify:     _context=self)
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/ssl.py", line 566, in __init__
Sun Feb 26 15:10:58 2017	INFO	Notify:     self.do_handshake()
Sun Feb 26 15:10:58 2017	ERROR	Notify:   File "/usr/lib/python2.7/ssl.py", line 788, in do_handshake
Sun Feb 26 15:10:58 2017	INFO	Notify:     self._sslobj.do_handshake()
Sun Feb 26 15:10:58 2017	ERROR	Notify: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Sun Feb 26 15:10:58 2017	ERROR	Post-process-script Notify.py for MPfKsQRxh8vpwUMJPqSL1 failed
Edit: It seems I only receive this error when a download fails. If a download is successful I do get a notification, but I still get this warning (Notify: RCP Connection Failure (1): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)) When I set this script up on my desktop (W10, NZBget 18.0, Pyton 2.7) everything works directly, without any error whatsoever.

And one last thing, which is more of a luxury problem: if I try to manually send a notification to a group, I receive the following error. If I replace the ChatID with my personal ChatID everything works fine, but when I use a group ChatID, I receive this error. Could it be because the Group ChatID is a negative number?

Code: Select all

2017-02-26 14:51:51,166 - 11054 - WARNING - Failed to send Telegram:@-123456789 notification: (400) Bad Request: chat not found.
Thank you for taking the time to read all of this!

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

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

Post by l2g » 26 Feb 2017, 19:33

Sun Feb 26 15:10:58 2017 ERROR Notify: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Hmm.... it would appear my script can't handle SSL connections to NZBGet when your API is set up to be Secure.

I pushed an update to the master branch (shortcut); would you mind downloading it and giving it a try for me? Let me know how it goes! :)

marciano37
Posts: 2
Joined: 27 Feb 2017, 00:36

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

Post by marciano37 » 27 Feb 2017, 08:00

Hi there,

Thank you for this great script!
Sadly i get this error with telegrambot.

ERROR Mon Feb 27 2017 01:22:00 Post-process-script nzb-notify/Notify.py for The.Big.Bang.Theory.S10E17.1080p.WEB-DL.DD5.1.H264-RARBG failed (terminated with unknown status)
INFO Mon Feb 27 2017 01:22:00 Notify: SyntaxError: invalid syntax
INFO Mon Feb 27 2017 01:22:00 Notify: ^
INFO Mon Feb 27 2017 01:22:00 Notify: context = ssl._create_unverified_context())

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

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

Post by l2g » 27 Feb 2017, 13:23

marciano37 wrote:INFO Mon Feb 27 2017 01:22:00 Notify: context = ssl._create_unverified_context())
Ooops! that's a result of the last thing i pushed for the previous issue I'm tackling. I'm very sorry about that; you can check out the latest master and try again. Alternatively, if you want stability: stay away from the master branch and use one of the official releases. I don't mind you testing new stuff though! ;)
Tadsz wrote: And one last thing, which is more of a luxury problem: if I try to manually send a notification to a group, I receive the following error. If I replace the ChatID with my personal ChatID everything works fine, but when I use a group ChatID, I receive this error. Could it be because the Group ChatID is a negative number?
I got distracted with the first issue you pointed out, i had forgotten to address this. That's interesting, i didn't realize that there were negative values in the URL. Could you PM your group id (don't worry, you can regenerate a new one later), or at the very least post it here (but skew it's content slightly - don't add/remove negative signs where they don't exist though).

marciano37
Posts: 2
Joined: 27 Feb 2017, 00:36

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

Post by marciano37 » 27 Feb 2017, 18:23

l2g wrote:
marciano37 wrote:INFO Mon Feb 27 2017 01:22:00 Notify: context = ssl._create_unverified_context())
Ooops! that's a result of the last thing i pushed for the previous issue I'm tackling. I'm very sorry about that; you can check out the latest master and try again. Alternatively, if you want stability: stay away from the master branch and use one of the official releases. I don't mind you testing new stuff though! ;)

Thank you very much!

I took the latest master and all working again now!

Cheers!

Tadsz
Posts: 3
Joined: 25 Feb 2017, 20:48

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

Post by Tadsz » 27 Feb 2017, 20:58

l2g wrote:
Sun Feb 26 15:10:58 2017 ERROR Notify: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Hmm.... it would appear my script can't handle SSL connections to NZBGet when your API is set up to be Secure.

I pushed an update to the master branch (shortcut); would you mind downloading it and giving it a try for me? Let me know how it goes! :)
This fixed my errors! Thank you very much! :D

I've PM'ed you for the group ChatID.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest