[PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

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.
fleXible
Posts: 12
Joined: 29 Aug 2019, 07:48

[PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by fleXible » 23 Sep 2019, 22:50

Introduction:
A NZBGet Post-processing script to notify your Plex Server to update/refresh a library upon finished downloads.

This let's you deactivate Scan my library automatically, Scan my library periodically and the broken Run a partial scan when changes are detected in Plex. This brings you a long way to support your HDD suspend feature when installed on a NAS. But you will still have to find a way to manage the logfiles.

Reason:
The original author seem to have been inactive since late 2017 and lately I found myself in the situation with the need to download it again, but couldn't find a working source.

NotifyPlex Script Details
Download: Releases and Readme
Source: GitHub
Original: [PP-Script] NotifyPlex - Library Update and GUI Notification

Changelog

[2.1.4] - 2020-05-12

Changed
Use persistent auth-token instead of username/password to authenticate with plex
Your plex password is no longer stored in plaintext on disk
Updated README with instructions for Auth-Token
Changed README to be better readable

[2.1.3] - 2020-03-12
Added
compatibility to Python 3.x
depedency handling for external module "requests"
.gitignore file
Changed
reodered and simplified default settings
modernized codebase to be much more pythonic
refactored "request" section of code
use system's default python version

[2.1.2] - 2019-10-23
First GitHub release.

Added
Readme and Changelog files.
Fixed
Fix for NOTIFYPLEX: Skipping Plex Update because download failed error.

[2.1.1] - 2019-10-23
Semantically unchanged release of latest NotifyPlex file I was able to find.

Fixed
File formatting following PEP 8 -- Style Guide for Python Code
Last edited by fleXible on 12 May 2020, 17:04, edited 4 times in total.

geewhiz
Posts: 6
Joined: 23 Sep 2019, 21:27

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by geewhiz » 27 Sep 2019, 02:28

Thanks for fixing the script, but I'm getting the following error when the script runs:

NotifyPlex: requests.exceptions.InvalidURL: Invalid URL u'http://:3005/jsonrpc': No host supplied

I've entered the correct Plex URL in the plexIP field. Any idea what's going on? Thanks.

fleXible
Posts: 12
Joined: 29 Aug 2019, 07:48

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by fleXible » 27 Sep 2019, 09:50

I just check with my installation, there it's working correctly. Pls check your plexIP setting again. I entered IP:Port there

geewhiz
Posts: 6
Joined: 23 Sep 2019, 21:27

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by geewhiz » 28 Sep 2019, 18:07

Thanks. Figured it out. It was the clientsIP that was missing and I had guiShow enabled. I disabled guiShow and all is well.

fleXible
Posts: 12
Joined: 29 Aug 2019, 07:48

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by fleXible » 01 Oct 2019, 21:15

Glad to hear, everything is fine. Enjoy!

mannibis
Posts: 60
Joined: 29 Jul 2014, 15:10

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by mannibis » 25 Oct 2019, 16:57

Hey fleXible,

So I was bored these past few days and decided to update the script. I cleaned up a bunch of the code and made it more python "compliant", and more efficient with the XML parsing. I've also fixed some code formatting that was bugging me. I am also now using the requests module in this version 2.5, which is faster and more efficient than the old urllib2 module. There are no configuration changes whatsoever with regards to the options set in the NZBGet Web UI--it is simply a backend code update. You can simply replace NotifyPlex.py in your NZBGet scripts folder (and make sure it has execute priveleges AKA chmod +x) and that is all.

Here is a DropBox link to the updated v2.5 script: https://www.dropbox.com/s/ar5nf9kko66xx ... ex.py?dl=0

Thanks for taking up a support role with this script and I'm glad to see people are still finding it useful (I still use it as well). If you have any questions or concerns or want me to add/remove/update something let me know!

EDIT: I took a look at the script on GitHub and edited my updated version to reflect a minor change I noticed you made on line 109. Let me know if there is anything else I should edit or update. It's been quite a while and I can't remember if everything was working the way it was or not. I've tested my latest version and it works for me, so let me know!

-mannibis

fleXible
Posts: 12
Joined: 29 Aug 2019, 07:48

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by fleXible » 04 Nov 2019, 23:48

Hi manabis,

it took me a while to go through your code and take in the changes. I've created a pull-request on github, so you can check and comment. I didn't take all the changes proposed, because I wanted to stay close to the NZBGet community especially regarding message output.

I don't really get, why the jump to version 2.5, so I changed it into my versioning scheme.

To be honest, I had quite a hard time to implement your changes, as they were quite a lot and from a different code base as it seems. That's one of the reasons I set-up the github repository, so there is a common ground and method for discussing and introducing changes to the code-base.

But still, thanks for your work and welcome back!

geewhiz
Posts: 6
Joined: 23 Sep 2019, 21:27

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by geewhiz » 06 Nov 2019, 01:26

Thanks to both of your for your work on this. I use this script every day so I appreciate you keeping it updated.

With python 2 support sun setting in 2020, does this script support python 3 yet? Thanks.

fleXible
Posts: 12
Joined: 29 Aug 2019, 07:48

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by fleXible » 06 Nov 2019, 23:45

Good call! I heard it and just finished testing and making the needed changes.
I've updated the Pull-Request to let it sink in for a couple of days.

deoneR
Posts: 22
Joined: 30 May 2013, 16:35

Re: [PP-Script] NotifyPlex - Library Update and GUI Notification (now on GitHub)

Post by deoneR » 19 Nov 2019, 09:11

hi i just installed it but getting this error:
Tue Nov 19 2019 10:04:25 NotifyPlex: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='my.plexapp.com', port=443): Max retries exceeded with url: /users/sign_in.xml (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003D38D48>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: raise ConnectionError(e, request=request)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Python27\lib\site-packages\requests\adapters.py", line 516, in send
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: r = adapter.send(request, **kwargs)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Python27\lib\site-packages\requests\sessions.py", line 646, in send
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: resp = self.send(prep, **send_kwargs)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Python27\lib\site-packages\requests\sessions.py", line 533, in request
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: return session.request(method=method, url=url, **kwargs)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Python27\lib\site-packages\requests\api.py", line 60, in request
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: return request('post', url, data=data, json=json, **kwargs)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Python27\lib\site-packages\requests\api.py", line 116, in post
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: auth = requests.post(urlAuth, headers=headers, auth=HTTPBasicAuth(plexUser, plexPass))
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Program Files\NZBGet\scripts\NotifyPlex.py", line 149, in getAuthToken
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: 'X-Plex-Token': getAuthToken(plexUsername, plexPassword)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Program Files\NZBGet\scripts\NotifyPlex.py", line 181, in refreshAuto
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: refreshAuto(mCats, tCats, plexIP)
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: File "C:\Program Files\NZBGet\scripts\NotifyPlex.py", line 305, in <module>
INFO Tue Nov 19 2019 10:04:25 NotifyPlex: Traceback (most recent call last):
any ideas what am i doing wrong?

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests