[PP-Script] NotifyPlex - Library Update and GUI Notification

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.
mannibis
Posts: 60
Joined: 29 Jul 2014, 15:10

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by mannibis » 27 Mar 2015, 20:32

Ok, so it didnt ERROR. That's good. How are you configuring it? I would suggest using Custom mode and using Section #'s because Auto mode relies on the category setting and not sure if NZBPO_Category or whatever it is, is used for Scheduler scripts. Try Custom mode and put in the section #'s (1,2,3, etc.)

joq3
Posts: 13
Joined: 01 Mar 2015, 20:09

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by joq3 » 27 Mar 2015, 21:18

mannibis wrote:Ok, so it didnt ERROR. That's good. How are you configuring it? I would suggest using Custom mode and using Section #'s because Auto mode relies on the category setting and not sure if NZBPO_Category or whatever it is, is used for Scheduler scripts. Try Custom mode and put in the section #'s (1,2,3, etc.)
Yes, I'm using Custom mode, and I went to http://192.168.1.2:32400/library/sections to find out my section number for TV Shows, which is 6.
Running the script gives me this:
INFO Fri Mar 27 2015 22:11:01 NotifyPlex: NOTIFYPLEX: Targeted PLEX Update for Section 6 Complete
INFO Fri Mar 27 2015 22:11:01 NotifyPlex: NOTIFYPLEX: Plex.tv Authentication Successful
INFO Fri Mar 27 2015 22:11:00 Executing scheduler-script NotifyPlex.py for Task2

If I update the page http://192.168.1.2:32400/library/sections exactly when the scheduler is set I see that it says refreshing="1" under section 6, which means it works.
But it still doesn't add my subtitles in Plex, even though I now it is there.
So I went and edited the .py to add "?force=1" after each refresh, to do a force refresh. This works too, as it seems to stay at refreshing="1" for a little longer. But still the subtitles doesn't show up?

Then I tried doing it manually, by entering this to my browser:
http://192.168.1.2:32400/library/sectio ... sh?force=1
Now it actually seems to work. But why doesn't it work with the script, even though I clearly see that it does indeed refresh?

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

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by mannibis » 27 Mar 2015, 21:33

That's odd. Perhaps it needs a force refresh. Try altering the URL in the .py to add the force=1 parameter.

Code: Select all

def refreshCustomSections(rawPlexSections,plexIP):

   plexSections=rawPlexSections.replace(' ','')
   plexSectionsSplit=plexSections.split(',')

   params = {
      'X-Plex-Token':getAuthToken(plexUsername,plexPassword)
   }

   for plexSection in plexSectionsSplit:
      url = 'http://%s/library/sections/%s/refresh?force=1' % (plexIP, plexSection)

EDIT: Nevermind, I see you already tried that. Did you edit the URL for the refreshCustomSections function? If so, that's just really weird.

joq3
Posts: 13
Joined: 01 Mar 2015, 20:09

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by joq3 » 27 Mar 2015, 21:37

mannibis wrote:That's odd. Perhaps it needs a force refresh. Try altering the URL in the .py to add the force=1 parameter.

Code: Select all

def refreshCustomSections(rawPlexSections,plexIP):

   plexSections=rawPlexSections.replace(' ','')
   plexSectionsSplit=plexSections.split(',')

   params = {
      'X-Plex-Token':getAuthToken(plexUsername,plexPassword)
   }

   for plexSection in plexSectionsSplit:
      url = 'http://%s/library/sections/%s/refresh?force=1' % (plexIP, plexSection)

Thank you, but as I wrote above, I did try that. Without any luck. I don't understand why it would work in the browser, but not in the script.

rxp
Posts: 55
Joined: 07 Mar 2014, 18:51

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by rxp » 23 May 2015, 13:45

Any chance of adding Music support?

robertpolson
Posts: 13
Joined: 19 Nov 2013, 20:14

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by robertpolson » 29 May 2015, 01:05

How does the script know which Plex section to notify. Although, I get a success confirmation from the plugin, the movies library does not get refreshed in Plex unless I manually specify the section and choose custom. My movies section in Plex is called "New Movies" and it is section one; does this matter?

I also use Video Sort plugin, which is set to run before NotifyPlex.

P.S. Thank you for an excellent plugin!

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

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by mannibis » 31 May 2015, 21:16

@robertpolson:

Can you pastebin me a link of your sections XML data using the following URL?

http://IP:32400/library/sections

The script parses the XML from the sections output to see which sections are TV Shows and which are Movies. So if it's not auto-detecting a section properly, something is going wrong in there. I could take a closer link if I know what your sections look like

@rxp:

I'll look into adding music support. I'm currently away on vacation, so I'll try and get to it next week. In the meantime, you can add the Music section # into the Custom field and set the Refresh Mode to "Both" to have the script refresh the music section.

robertpolson
Posts: 13
Joined: 19 Nov 2013, 20:14

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by robertpolson » 01 Jun 2015, 04:02

When I put in http://MyIP:32400/library/sections, I get to "401 Unauthorized"

I had to figure out my PlexToken first.

Here is the XML output http://f.cl.ly/items/0W3X0I2r2M1i3t2v2f0m/PlexXML.txt

By the way, I have no interest in the Music section. This was something another user requested.

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

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by mannibis » 02 Jun 2015, 20:29

Ok, I see the issue now. My code assumed that everyone's sections titles were the same. Example: "Movies" or "TV Shows". If you just change these two lines code below (edit the NotifyPlex.py file and Save), all the "movie" type sections and all the "shows" type sections will be auto-refreshed. Let me know if it works. I will test it later (as I'm not at home now) and if all is good, I will push the changes and update the script. Thanks for bringing this to my attention.

Code: Select all

   for elem in tree.getiterator('Directory'):
      if (elem.attrib['type'] == 'show'):
         tvSections.append(elem.attrib['key'])
      elif (elem.attrib['type'] == 'movie'):
         movieSections.append(elem.attrib['key'])
Basically, in that section of code, change 'title' to 'type' and 'TV Shows' to 'show' and 'Movies' to 'movie'

Also, make sure you entered the category names you created in NZBGet into the moviesCat and tvCat fields. That will make sure to only refresh the 'show' sections when the download is categorized as a TV show and 'movie' sections when it's categorized under Movies (or whatever you named your NZBGet categories).

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

Re: [PP-Script] NotifyPlex - Library Update and GUI Notifica

Post by mannibis » 02 Jun 2015, 23:44

I tested the fix and everything should work properly now. That was a dumb oversight on my part. Regardless of the section name, the script will now refresh library based on the section type instead of section title.

Download: http://bit.ly/notifyplex

Link is updated in first post as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests