If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

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

1356767

Comments

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

    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.  

    bauerknight wrote on July 4 2013, 12:29 PM: »

    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!

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013

     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. 
  • WeeflixWeeflix Posts: 238Members, Plex Pass Plex Pass
    edited July 2013

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

  • WeeflixWeeflix Posts: 238Members, Plex Pass Plex Pass

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

    config file missing data
    
  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    bauerknight wrote on July 5 2013, 11:31 PM: »

    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.

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013

    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.

  • DrZeussDrZeuss Posts: 214Members, Plex Pass Plex Pass

    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 +. 

    iMac i5QC as Plex Media Server + TV Shows + Trakt.TV + PRS
    2x ATV 2 with Plex Client | iPhone 4S and iPad 2 with Plex iOS Client | MacMini with Plex Client
  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    DrZeuss wrote on July 6 2013, 12:42 AM: »

    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. 

  • DrZeussDrZeuss Posts: 214Members, Plex Pass Plex Pass
    ljunkie wrote on July 6 2013, 1:21 AM: »

    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.

    iMac i5QC as Plex Media Server + TV Shows + Trakt.TV + PRS
    2x ATV 2 with Plex Client | iPhone 4S and iPad 2 with Plex iOS Client | MacMini with Plex Client
  • mottapiemottapie Posts: 2Members, Plex Pass
    Good stuff
  • djalexzdjalexz Posts: 8Members, Plex Pass Plex Pass
    edited July 2013

    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

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013

     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
     

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

     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
    
    
    ljunkie wrote on July 16 2013, 4:51 PM: »

     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
     

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass

    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!

    Current Library: http://stoleyour.com/plex/ (around 8TB)
    PMS: Mac Mini 5,3 (Mid 2011) | i7 QC @ 2Ghz | 16GB DDR3 | 2x 128GB Samsung 840 Pro SSD's | WS2008R2
    NAS: Drobo 5N | 5x HGST Ultrastar | 14.5TB RAID5 | 1x 64GB Crucial m4 mSATA SSD (Cache) | Firmware 3.1.0

    Clients: 5x iOS 6.0+ Devices | 3x Roku2 XS | 1x HP TouchPad | 3x Laptops (OSX 10.8.X) | 2x Desktops (Windows 7)

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    EntroX wrote on July 23 2013, 9:09 PM: »

    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.

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    edited July 2013
    ljunkie wrote on July 23 2013, 10:18 PM: »

    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)

    Current Library: http://stoleyour.com/plex/ (around 8TB)
    PMS: Mac Mini 5,3 (Mid 2011) | i7 QC @ 2Ghz | 16GB DDR3 | 2x 128GB Samsung 840 Pro SSD's | WS2008R2
    NAS: Drobo 5N | 5x HGST Ultrastar | 14.5TB RAID5 | 1x 64GB Crucial m4 mSATA SSD (Cache) | Firmware 3.1.0

    Clients: 5x iOS 6.0+ Devices | 3x Roku2 XS | 1x HP TouchPad | 3x Laptops (OSX 10.8.X) | 2x Desktops (Windows 7)

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    EntroX wrote on July 23 2013, 10:43 PM: »

    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.

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    ljunkie wrote on July 23 2013, 11:45 PM: »

    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.

    Current Library: http://stoleyour.com/plex/ (around 8TB)
    PMS: Mac Mini 5,3 (Mid 2011) | i7 QC @ 2Ghz | 16GB DDR3 | 2x 128GB Samsung 840 Pro SSD's | WS2008R2
    NAS: Drobo 5N | 5x HGST Ultrastar | 14.5TB RAID5 | 1x 64GB Crucial m4 mSATA SSD (Cache) | Firmware 3.1.0

    Clients: 5x iOS 6.0+ Devices | 3x Roku2 XS | 1x HP TouchPad | 3x Laptops (OSX 10.8.X) | 2x Desktops (Windows 7)

  • ljunkieljunkie Plex Dev Team Posts: 4,862Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013
    EntroX wrote on July 23 2013, 11:54 PM: »

    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
  • WeeflixWeeflix Posts: 238Members, Plex Pass Plex Pass

    ljunkie,

    I tried installing 0.0.15-dev and am getting this error

    Can't locate Net/Twitter/Lite/WithAPIv1_1.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /opt/plexWatch/plexWatch.pl line 1069.
    BEGIN failed--compilation aborted at /opt/plexWatch/plexWatch.pl line 1069.
     
    I tried installing Net::Twitter::Lite::WithAPIv1_1 by using the command: sudo cpan Net::Twitter::Lite::WithAPIv1_1
Sign In or Register to comment.