Page 3 of 6

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

Posted: 16 Mar 2015, 11:42
by joq3
hugbug wrote:Line endings changed to windows format. Change them back to unix format (LF).
Now it is running, but I get this "error":

"NotifyPlex: This script is supposed to be called from NZBGet v13.0 or later.
NotifyPlex: *** NZBGet scheduler script ***
Executing scheduler-script NotifyPlex.py for Task2"

I am using NZBGet 14.0

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

Posted: 18 Mar 2015, 11:59
by joq3
Can anyone help me? I might have broken the script when I changed it to SCHEDULED instead of POST-PROCESS.
If the creator could add this option (to use scheduled) I would be very thankful!

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

Posted: 18 Mar 2015, 19:52
by minimeh
There is a "sanity check" in notifyplex.py:

Code: Select all

if not 'NZBPP_STATUS' in os.environ:
        print('*** NZBGet post-processing script ***')
        print('This script is supposed to be called from NZBGet v13.0 or later.')
        sys.exit(POSTPROCESS_ERROR)
This check is valid only for post processing scripts (NZBPP_STATUS is post process status). You can try commenting it out (insert # in front of the lines above) and cross your fingers that other dependencies on post processing resources don't exist. The sanity check itself does nothing more than try to verify that the script is being executed from an appropriate version of nzbget and is otherwise non-functional.

[EDIT]
A quick check shows that NZBPP_STATUS is used again a few lines lower:

Code: Select all

#Check to see if download was successful
ppStatus=os.environ['NZBPP_STATUS']=='SUCCESS/ALL'
Try changing that to:

Code: Select all

#Check to see if download was successful
#ppStatus=os.environ['NZBPP_STATUS']=='SUCCESS/ALL'
ppStatus=True

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

Posted: 18 Mar 2015, 23:00
by mannibis
Thanks minimeh :) Just got around to checking the thread but saw you already offered help. If there are any issues, OP, let me know.

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

Posted: 19 Mar 2015, 12:53
by joq3
minimeh wrote:There is a "sanity check" in notifyplex.py:

Code: Select all

if not 'NZBPP_STATUS' in os.environ:
        print('*** NZBGet post-processing script ***')
        print('This script is supposed to be called from NZBGet v13.0 or later.')
        sys.exit(POSTPROCESS_ERROR)
This check is valid only for post processing scripts (NZBPP_STATUS is post process status). You can try commenting it out (insert # in front of the lines above) and cross your fingers that other dependencies on post processing resources don't exist. The sanity check itself does nothing more than try to verify that the script is being executed from an appropriate version of nzbget and is otherwise non-functional.

[EDIT]
A quick check shows that NZBPP_STATUS is used again a few lines lower:

Code: Select all

#Check to see if download was successful
ppStatus=os.environ['NZBPP_STATUS']=='SUCCESS/ALL'
Try changing that to:

Code: Select all

#Check to see if download was successful
#ppStatus=os.environ['NZBPP_STATUS']=='SUCCESS/ALL'
ppStatus=True
Did this, and this is the output:

Code: Select all

INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: KeyError: 'NZBPP_NZBNAME'
INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: raise KeyError(key)
INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: nzbName=os.environ['NZBPP_NZBNAME']
INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: File "/usr/share/nzbget/scripts/NotifyPlex.py", line 125, in <module>
INFO	Thu Mar 19 2015 13:50:00	NotifyPlex: Traceback (most recent call last):
INFO	Thu Mar 19 2015 13:50:00	Executing scheduler-script NotifyPlex.py for Task2
INFO	Thu Mar 19 2015 13:45:28	nzbget 14.0 daemon-mode
mannibis wrote:Thanks minimeh :) Just got around to checking the thread but saw you already offered help. If there are any issues, OP, let me know.
I think this got abit out of my league, if you can add this option to the script I would be grateful!

Thank you!

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

Posted: 19 Mar 2015, 12:58
by mannibis
Yea there is also a dependency on the NZB name for the GUI notification. I'll see what I can do.

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

Posted: 22 Mar 2015, 16:02
by joq3
mannibis wrote:Yea there is also a dependency on the NZB name for the GUI notification. I'll see what I can do.
Any progress? Thank you!

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

Posted: 26 Mar 2015, 09:13
by joq3
mannibis wrote:Yea there is also a dependency on the NZB name for the GUI notification. I'll see what I can do.
Is this something I can edit myself?
Thank you!

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

Posted: 26 Mar 2015, 20:51
by mannibis
Hey ! Sorry bud, I've been going crazy planning my wedding soon and I haven't had much free time. You would basically need to edit the .py to remove every instance of an nzb-specific post-proc environmental variable, which includes NZBPP_NZBNAME and the NZBPR variables. you can play around and just put # in front of problem areas when u get errors.

For me to do this right, I would need a good few hrs to test, as making this a Scheduler script would require me to strip alot of the features such as GUI notification and other stuff that is meant to run directly after the nzb file is finished.

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

Posted: 27 Mar 2015, 12:51
by joq3
mannibis wrote:Hey ! Sorry bud, I've been going crazy planning my wedding soon and I haven't had much free time. You would basically need to edit the .py to remove every instance of an nzb-specific post-proc environmental variable, which includes NZBPP_NZBNAME and the NZBPR variables. you can play around and just put # in front of problem areas when u get errors.

For me to do this right, I would need a good few hrs to test, as making this a Scheduler script would require me to strip alot of the features such as GUI notification and other stuff that is meant to run directly after the nzb file is finished.
No problem at all, you have your priorities right ;)
I tried doing this, put a # infront of thing that gave me error.
Finally I got this:
INFO Fri Mar 27 2015 13:30:01 NotifyPlex: NOTIFYPLEX: Targeted PLEX Update for Section Complete
INFO Fri Mar 27 2015 13:30:01 NotifyPlex: NOTIFYPLEX: Plex.tv Authentication Successful
INFO Fri Mar 27 2015 13:30:00 Executing scheduler-script NotifyPlex.py for Task2

But I went to Plex to check if it had refreshed everything it hasn't. Subliminal had downloaded a subtitle to a show that was added to the folder after the show itself (that way Plex showed it as no subtitles), but even after NotifyPlex did the refresh it didn't work. Still can't find the subtitle.
If I manually refresh this episode it shows up.

Something is wrong!