plexWatch - Plex Notify Script - Send Push Alerts On New Sessions and Stopped

Version 0.0.17 released

https://github.com/ljunkie/plexWatch


config.plhttps://raw.github.c.../config.pl-dist
plexWatch.plhttps://raw.github.c...er/plexWatch.pl

Change Log:  0.0.17

 * GNTP: Provider added.
       -- Supports multiple destinations.
       -- Currently tested with Growl For Windows as I don't have OSX available. Need to test with others
       -- install Centos ( yum install perl\(Data::UUID\) , cpan Growl::GNTP )   -- CPAN install failed until I installed perl\(Data::UUID\)
       -- install Ubuntu ( cpan Growl::GNTP )
       -- install OSX ( cpan Growl::GNTP )
 * --recently_added allows comma separated list. --recently_added=movie,show   ( preferred way if you are running multiple cron jobs for RA )
      -- fixes some SQLite lock issues by running it once
      -- fixes out of order content when running shows/movies
 * fixed --test_notify=  -- now works with =start, =stop, =recently_added
 * cleanup of empty variables for notification: stripping "[]" from alert.
 * excluding length of video from notification when Plex API doesn't return length: (00 min)
 * spell check - cleaned up :)
 * cleanup of unitialized values

Swordh - I had the same issue and a CHMOD of the plexwatch directory fixed it for me.

Thx jasonlh, that made the trick! I used 777, don't know if there is another better combination to use.

777 is perfectly fine. The issue stems from the instructions. The wget is ran as sudo so it create the directory with the owner and group of root. I later explain to run plexWatch.pl without sudo.. which would fail unless you are root.

 Instructions updated: 

1) sudo wget -P /opt/plexWatch/ https://raw.github.com/ljunkie/plexWatch/master/plexWatch.pl
  1. sudo chmod 777 /opt/plexWatch && sudo chmod 755 /opt/plexWatch/plexWatch.pl


  2.  

You could prepend sudo before any call to plexWatch.pl, but it is unnecessary to do so with the instructions above. 

Thanks for the clarification. I created a LaunchAgent and it's running every second. So far so good.

could you post your launchagent?  i keep getting an error

thanks

could you post your launchagent?  i keep getting an error

thanks

<?xml version="1.0" encoding="UTF-8"?>



	Label
	com.rcork.plexwatch
	ProgramArguments
	
		/usr/bin/perl
		/Users/rob/Development/plexWatch/plexWatch.pl
		-notify
		-recently_added=movie
		-recently_added=show
	
	StartInterval
	30


thanks

Version 0.0.17 released

https://github.com/ljunkie/plexWatch


config.plhttps://raw.github.c.../config.pl-dist
plexWatch.plhttps://raw.github.c...er/plexWatch.pl

Change Log:  0.0.17

 * GNTP: Provider added.
       -- Supports multiple destinations.
       -- Currently tested with Growl For Windows as I don't have OSX available. Need to test with others
       -- install Centos ( yum install perl\(Data::UUID\) , cpan Growl::GNTP )   -- CPAN install failed until I installed perl\(Data::UUID\)
       -- install Ubuntu ( cpan Growl::GNTP )
       -- install OSX ( cpan Growl::GNTP )
...

Anybody got the spell I need to make this work on Unraid?

Sorry if this has been mentioned before, but how do I exclude specific users from the notifications?

I would like to exclude my personal Plex clients :)

Sorry if this has been mentioned before, but how do I exclude specific users from the notifications?

I would like to exclude my personal Plex clients :)


Yea, it was mentioned but sadly it looks like I have not documented it well yet. I'll put this on my list (better docs/howto).

--exclude_user added to all functions. You can specifiy --exclude_user multiple times..
i.e --exclude_user user1 --exclude_user otherUsername

./plexWatch.pl --notify --exclude_user myuser

./plexWatch.pl --watched --exclude_user myuser --exclude_user user2


Anybody got the spell I need to make this work on Unraid?


The install for Ubuntu/Debian should work -- any apt-get/cpan command. I'd comment more, but I'm mobile. Take a look at those install instructions, step #4, https://github.com/ljunkie/plexWatch/blob/master/README.md

No apt/cpan on unraid :(

No apt/cpan on unraid :(

Sad. I did a quick google search for unraid apt-get and links came up, so I though maybe.. but now I see that is not an option. Anyone here have experience with perl modules and unraid?

Sad. I did a quick google search for unraid apt-get and links came up, so I though maybe.. but now I see that is not an option. Anyone here have experience with perl modules and unraid?

its been a while since i last used UnRAID i seem to remember following this:

http://lime-technology.com/forum/index.php?topic=2999.0

i also found this initially, seems fairly reasonable as well:

http://lime-technology.com/forum/index.php?topic=24367.0

Anyone willing to test the DEV branch? I believe it's ready for release. 

* any time you upgrade, please copy your plexWatch.db to a safe location for a backup.

 

Dev Branch: 0.0.18-dev

https://github.com/l...xWatch/tree/dev

config.plhttps://raw.github.c.../config.pl-dist
plexWatch.plhttps://raw.github.c...ev/plexWatch.pl

 

Major changes:

* The ability to specify a myPlex user/pass: will allow this script to be ran from any computer instead of the local PMS. If you are an existing user and want to run this on a different computer, make sure you copy your existing database to the new location. 

* Automatic DB backups

 

 

Change Log

 
* MyPlex Login Token: The script can now be ran from any computer.
       -- Specify a $myPlex_user and $myPlex_pass in config.pl
       -- Will only retrieve a token from my.plexapp.com if the PMS server returns a 401 (authorization required)
 
 * Backup SQLite DB
    -- automatically happens daily, weekly and monthly
    -- force Daily backup with --backup
 
 * format_options update/new:
    -- {streamtype} [T|D] for Transcoded/Direct
    -- {transcoded} [1|0] for Transcoded/Direct
    -- {percent_complete} - percent of video watched ( not dependent on time watched, but where progress of video/length.
    -- {state} - playing/paused/buffering
    -- {progress} - exact time spot the user is at  (I.E. "15 minutes" )
 
 * XML is now updated on every run -- allows us to view current state of content ( i.e. paused, playing, percent_completed, etc)
 
 * CheckLock fixed: script can NOT to be ran multiple times at once (fixed repeat notifications when providers are offline)
 
 * Provider notifications: timeout is now 20 seconds instead of 3 minutes (we should not wait 3 minutes to reach a provider!)
 
 

I'm getting this error with Growl enabled.

Use of uninitialized value $ret in pattern match (m//) at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 100.
Use of uninitialized value $ret in string ne at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 104.
Use of uninitialized value $ret in string ne at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 114.

I'm getting this error with Growl enabled.

Use of uninitialized value $ret in pattern match (m//) at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 100.
Use of uninitialized value $ret in string ne at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 104.
Use of uninitialized value $ret in string ne at /usr/local/share/perl/5.14.2/Growl/GNTP.pm line 114.



I experienced that error with Growl when I did not allow for network messages in the growl server – or – if the password did not match. I will check later tonight, but GNTP was not new in 0.0.18-dev, so it shouldn’t have just broke.


Also, have you tried with --debug to see if it gives any more of a reason.

EDIT: I have verified this is the exact same error when you do not allow network notifications. In the Growl for windows, it's in the security tab and is a simple checkbox to allow network notifications. I am guessing other growl 'servers' have the exact same config option somewhere. 

I was able to fix that issues thanks.  Now I'm getting this error

Wide character in send at /usr/lib/perl/5.14/IO/Socket.pm line 269.

and it's resending the same notification 

I was able to fix that issues thanks. Now I'm getting this error

Wide character in send at /usr/lib/perl/5.14/IO/Socket.pm line 269.
and it's resending the same notification


What is the full command you are using? and please run it with --debug

I'm just running the same command as i always do. --debug doesn't return anything

sudo /opt/plexWatch/plexWatch.pl

I've reverted to 0.13 and it stopped the loop.

I'm just running the same command as i always do. --debug doesn't return anything

sudo /opt/plexWatch/plexWatch.pl

the command would be :

sudo /opt/plexWatch/plexWatch.pl --notify --debug