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

ljunkie can you add to the stopped notifications the Duration?  For example: User stopped watching: title on platform after 1 hour 2 minutes.  

It would be great for troubleshooting.  I'll be able to easily tell if a user is keeps getting cut off from their stream.

Thanks again!

This is already part of prowl. I will see about adding it into the pushover notifications for the next update. 

Long term I am going to change and hopefully make it easier to tailor the alert to the way anyone wants it. The idea is to have a default alert for all and allow anyone to change the format of the alert per providers.

I.E. default would be

%u = user

%t = title

watching: '%u watching %t'   

 stopped: '%u stopped %s'

There would of course be many more options like:

%d: duration

%se: season+episode

%s: season

%e: episode

etc...

The format would be per start/stop and provider.  

ljunkie can you add to the stopped notifications the Duration?  For example: User stopped watching: title on platform after 1 hour 2 minutes.  

It would be great for troubleshooting.  I'll be able to easily tell if a user is keeps getting cut off from their stream.

Thanks again!

 Version 0.0.12 released

 
* config options in the perl script have been moved into config.pl. You should no longer need to edit the plexWatch.pl script directly. Download the config.pl-dist file. Edit the file an place it in the same folder as your plexWatch.pl script as config.pl.
 
* You can edit the format of your alerts and cli output or --watching --watched. This can be done  in the config.pl or on the cli 
 
   cli options:
 --format_options        : list all available formats for notifications and cli output

 --format_start="…"     : modify start notification 

 --format_stop="…"      : modify stop nottification

 --format_watched="…"   : modify cli output for --watched 

 --format_watching="…"  : modify cli output for --watching 

    Edit format in the config.pl  *note that you still can override this by use the cli format
 $alert_format = {
                 'start'    =>  '{user} watching {title} on {platform}',
		 'stop'     =>  '{user} watched {title} on {platform} for {duration}',
		 'watched'  =>  '{user} watched {title} on {platform} for {duration}',
		 'watching' =>  '{user} watching {title} on {platform}'
                 };
* the notification logic and cli output have now been merged into the same routines. This means that the output you see should  be the same, whether it be a notification or output from the script using something like --watched. This also means it will be much easier and quicker to push any changes to the formatting when/if needed.
 
* along with changing the logic of the notifications, I am now parsing the original XML used from the sessions status when the video was first started. This will allow the script to give users more options on output. I.E. tagline of video, genres, directors, etc.. the only issue is this data is not always available, so the output might look funky depending on the content available. This is something I will look into in future releases.
 
 
Let me know if there are any issues or questions with the new release. I need to go through and update the WIKI and README along with updating --help with the new features. For now, I hope this has covered it. 

Gonna test this new release and let you know.  Thanks!

I noticed when i disable start notifications and but leave stop notifications enabled I get this error:

config file missing data

I noticed when i disable start notifications and but leave stop notifications enabled I get this error:

config file missing data

fixed. I need to make those checks a little more useful, but you can now disable either.

I also left the notifications a little plain for defaults.

This is what I currently use in the config.pl as I like to see the year and rating.

$alert_format = {'start'    =>  '{user} watching {title} [{year}] [{rating}] on {platform}',
                 'stop'     =>  '{user} watched {title} [{year}] [{rating}] on {platform} for {duration}',
                 'watched'  =>  '{user} watched {title} [{year}] [{rating}] on {platform} for {duration}',
                 'watching' =>  '{user} watching {title} [{year}] [{rating}] on {platform}'
};

Let me know if there are more that seem useful and I will look into it. I plan on adding more, I just haven't researched what other data really seems useful in an alert or while viewing history.

Working well for me. Many thanks ljunkie.

One request: this build doesn't include Growl notidication mod rcork shared, as an OS X user having the script also support Growl would be a nice +. 

Working well for me. Many thanks ljunkie.

One request: this build doesn't include Growl notidication mod rcork shared, as an OS X user having the script also support Growl would be a nice +. 

You are welcome. I am glad it's working! I definitely plan on adding growl. I just didn't have the time to add it in this release. Next one will include it! I am leaving on vacation until 7/12.. so I probably won't have any updates to this until after. 

The modification from rcork should still work if you plug it into the right places. 

You are welcome. I am glad it's working! I definitely plan on adding growl. I just didn't have the time to add it in this release. Next one will include it! I am leaving on vacation until 7/12.. so I probably won't have any updates to this until after. 

The modification from rcork should still work if you plug it into the right places. 

ljunkie, many thanks have a nice holiday.

I've already patched the latest version to include rcork's Growl mod. All working nicely.

Good stuff

Hi @ everyone,

first my english is not good...

I have a problem with the script.

It stops the work and no notification is going on.

I`ve deleted everything and download / install new.

no error log but no notification

I have a debian Server with Plex (newest Version)

Please Help me.

Thanks

PS the problem is with the old Version from the Script and with the new Version

Problem Solved...

My PlexPass was not active :-)

Sorry and thank you for the Script

 Version 0.0.13 released

* GROWL has been added into this release - make sure to pull a new config.pl-dist and make your changes in your config.pl. Requires growlnotify from http://growl.info/downloads

Change log for 0.0.13

 * duration_exact changed to durationrr (time precision will be up to minutes)
    --stats time precision will still be seconds

 

 * formatting options added
     {time_left}  :: time left until video is done - only works with --watching
     {length}      :: length of video (works for any)
     {progress}  :: current time watched in video

 * --stats can be used by itself now. No longer required to have --watched
 

 Version 0.0.14 released

Minor update: --watched ::  join the same show title on one line if it was watched into the next day. 

Previously  

/opt/plexWatch/plexWatch.pl --watched --user frank
  • Limiting results to FrankTest [Frank]

======================================== Watched ========================================

Date Range: Anytime through Now

User: Frank
Fri Jul 12 21:42:02 2013: Frank watched Snitch [2013] [PG-13] on Roku for 1 hour and 42 minutes
Sat Jul 13 00:12:02 2013: Frank watched Snitch [2013] [PG-13] on Roku for 1 hour and 2 minutes

Now 

/opt/plexWatch/plexWatch.pl --watched --user frank

* Limiting results to FrankTest [Frank]

======================================== Watched ========================================

Date Range: Anytime through Now

User: Frank
 Fri Jul 12 21:42:02 2013: Frank watched Snitch [2013] [PG-13] on Roku for 2 hours and 44 minutes

 Version 0.0.13 released

* GROWL has been added into this release - make sure to pull a new config.pl-dist and make your changes in your config.pl. Requires growlnotify from http://growl.info/downloads

Change log for 0.0.13

 * duration_exact changed to durationrr (time precision will be up to minutes)
    --stats time precision will still be seconds

 

 * formatting options added
     {time_left}  :: time left until video is done - only works with --watching
     {length}      :: length of video (works for any)
     {progress}  :: current time watched in video

 * --stats can be used by itself now. No longer required to have --watched
 

awesome job, i was thinking of banging up a shell script to monitor people using my PMS and i figured i'd check if someone had done something similar and look what i found!

running it on CentOS 5.8 x64 and it works like a charm, thanks!

awesome job, i was thinking of banging up a shell script to monitor people using my PMS and i figured i'd check if someone had done something similar and look what i found!

running it on CentOS 5.8 x64 and it works like a charm, thanks!

It always makes me happy to see that it 'just' works :)

I am going to push another update pretty soon. Might be later tonight or tomorrow.

New Features coming

 * Twitter added as a provider

 * Recently Added notifications for movies and shows

 * Notification providers have a flag now in the config.pl to enable/disable push alerts based alert type: 'watching' , 'watched' and the new 'recently added' notification (you can still enable/disable the provider globally with 'enabled' => 0|1 )

I mainly added twitter for the 'recently added' notifications so a group could be notified when new shows or movies were added. I extended the recently added notifications all ALL providers (growl, prowl, etc) so one does not need to use Twitter. If twitter is used though, it sadly does requires some more perl modules.

It always makes me happy to see that it 'just' works :)
 
I am going to push another update pretty soon. Might be later tonight or tomorrow.
 
New Features coming
 * Twitter added as a provider
 * Recently Added notifications for movies and shows
 * Notification providers have a flag now in the config.pl to enable/disable push alerts based alert type: 'watching' , 'watched' and the new 'recently added' notification (you can still enable/disable the provider globally with 'enabled' => 0|1 )
 
I mainly added twitter for the 'recently added' notifications so a group could be notified when new shows or movies were added. I extended the recently added notifications all ALL providers (growl, prowl, etc) so one does not need to use Twitter. If twitter is used though, it sadly does requires some more perl modules.

well, "just works" is true after spending 30 minutes getting the Perl re-reqs installed but that is not an issue from your end, other than that yeah - it works out of the box.

i haven't had a chance to actually sit down and check the code itself in detail but do you have a way to filter out certain users for notifications?, say i don't want to get notifications from user X. i took a peek at the help/git/wiki and didn't see any mentions of this (but then again, i didn't check that hard)

well, "just works" is true after spending 30 minutes getting the Perl re-reqs installed but that is not an issue from your end, other than that yeah - it works out of the box.

i haven't had a chance to actually sit down and check the code itself in detail but do you have a way to filter out certain users for notifications?, say i don't want to get notifications from user X. i took a peek at the help/git/wiki and didn't see any mentions of this (but then again, i didn't check that hard)

I have thought about it, but no one has really asked for it yet, so I haven't looked into it. It *shouldn't be much work to make that happen and I will see if I can add it in the next release.

I have thought about it, but no one has really asked for it yet, so I haven't looked into it. It *shouldn't be much work to make that happen and I will see if I can add it in the next release.

that would be awesome, i could just throw it in but i figured someone else might want it as a "feature", thus i mentioned it.

that would be awesome, i could just throw it in but i figured someone else might want it as a "feature", thus i mentioned it.

* --exclude_user= will be an option with the next release. Will probably be tomorrow as I will be testing this version tonight.
* --exclude_user=.. can be specified multiple times to exclude multiple users.

If you'd like, you can test it and let me know if it's working as you'd expect. You can use the DEV branch (which I would normally stay away from)

Dev Branch:
https://github.com/ljunkie/plexWatch/tree/dev

config.pl: https://raw.github.com/ljunkie/plexWatch/dev/config.pl-dist
plexWatch.pl: https://raw.github.com/ljunkie/plexWatch/dev/plexWatch.pl


Main new feature:

--recently_added=movie -- will notify when new movies are added to the PMS
--recently_added=show -- will notify when new episodes are added to the PMS
* Requires the notification provider in config.pl to have 'push_recentlyadded' => 1


Change Log:
* 0.0.15-dev
* added recently_added=[movie,show] -- notify on recently added items to PMS
* Twitter added as a provider
- requires Net::Twitter::Lite::WithAPIv1_1 ( install with: 'cpan Net::Twitter::Lite::WithAPIv1_1' )
- requires Net::OAuth >= 0.28 ( install with: 'cpan Net::OAuth' )
- twitter OAUTH required - create a new app @ https://dev.twitter.com/apps
-- make sure to set set ApplicationType to read/write
* config.pl: added push_watched => 1, push_watching => 1, push_recently_added => 1 to all providers. Enable or Disable specific notify types per provider
* --exclude_user added to all functions. You can specifiy --exclude_user multiple times.. i.e --exclude_user=user1 --exclude_user=otherUsername