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

13468967

Comments

  • ljunkieljunkie Plex Dev Team Posts: 4,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013
    war59312 wrote on July 27 2013, 6:03 PM: »

    Indeed, I had not had time to test it beyond simply getting it installed.

    Was not aware I had to have PlexPass. I see you updated first page stating that now.

    Bummer. Well I do NOT even use Plex much so not worth it to me.

    You are of course correct, as master version simply shows:


    Even though I am watching an episode of Burn Notice right now.


    Yea, I should have posted the requirement before. At some point this will work without plexpass once its released to public. I'd get into why buying a plexpass is worth it, but there are other topics already about this an I don't want that to take over this thread :)

    *--recently_added=show, --recently_added=movie, should still work though as that was already part of PMS before 0.9.8.x

  • war59312war59312 Posts: 52Members, Plex Pass Plex Pass
    edited July 2013

    rob@RobsUbuntuServer:~/Desktop$ /opt/plexWatch/plexWatch.pl --recently_added

    * Skipping any Notifictions -- command line options set, use '--notify' or supply no options to enable notifications

    So does NOT appear to work either.

    And I know plexpass has its value. I simply don't require it since my device I use for all my videos (Boxee Box) does NOT require me to transcode anything and I am getting better performance using NFS anyways.

    Thus I rarely use Plex at the moment. I only use it for when a friend wishes to stream a few videos from me, but its pretty rare. Once once this summer thus far.

    So really does NOT to me any good spending money on a minor upgrade of Plex.

    Note: I already donated to the Plex project $20 back in the "good old days".

    God Bless U.S.A - Congrats Ladies. :) Champs of the world!! :D

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    edited July 2013
    war59312 wrote on July 27 2013, 6:38 PM: »

    So does NOT appear to work either.

    And I know plexpass has its value. I simply don't require it since my device I use for all my videos (Boxee Box) does NOT require me to transcode anything and I am getting better performance using NFS anyways.

    Thus I rarely use Plex at the moment. I only use it for when a friend wishes to stream a few videos from me, but its pretty rare. Once once this summer thus far.

    So really does NOT to me any good spending money on a minor upgrade of Plex.

    Note: I already donated to the Plex project $20 back in the "good old days".

    did you enable the notifications for new shows under a type of notification?

    ex:

     'pushover' => {
           'enabled' => 1, ## set to 1 to enable PushOver
           'push_recentlyadded'  => 1,
           'push_watched'        => 0,
           'push_watching'       => 1,
           'token' => '~snip~', ## your app token
           'user' => '~snip~',  ## your user token
           'title' => $appname,
           'sound' => 'intermission',
        },
    

    (as in, 'push_recentlyadded' => 1,)
     

    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)

  • war59312war59312 Posts: 52Members, Plex Pass Plex Pass

    Yes enabled for prowl, growl, and boxcar.

    God Bless U.S.A - Congrats Ladies. :) Champs of the world!! :D

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    edited July 2013

    can you run the command again with --debug and paste the output?, can you check if anything was logged to the plexWatch.log file?

    edit: like so: ./plexWatch.pl --recently_added=show --debug

    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,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013
    EntroX wrote on July 27 2013, 7:32 PM: »

    can you run the command again with --debug and paste the output?, can you check if anything was logged to the plexWatch.log file?

    edit: like so: ./plexWatch.pl --recently_added=show --debug


    exactly, --recently_added will not work. You need --recently_added=show or --recently_added=movie

  • war59312war59312 Posts: 52Members, Plex Pass Plex Pass

    Yea whoops, I was copying and pasting for sure..

    OK well now I am getting this:

    rob@RobsUbuntuServer:~/Desktop$ /opt/plexWatch/plexWatch.pl --recently_added=showFailed to post Boxcar notification - NEW: White Collar: Checkmate s03e11 [TV-PG] [2012] 42min [720p 6ch] [11:24pm 18 Aug 12]
    boxcar Failed: we will try again next time.. NEW: White Collar: Checkmate s03e11 [TV-PG] [2012] 42min [720p 6ch] [11:24pm 18 Aug 12]
    Failed to post Boxcar notification - NEW: White Collar: Stealing Home s03e15 [TV-PG] [2012] 41min [720p 6ch] [11:24pm 18 Aug 12]
    boxcar Failed: we will try again next time.. NEW: White Collar: Stealing Home s03e15 [TV-PG] [2012] 41min [720p 6ch] [11:24pm 18 Aug 12]

    God Bless U.S.A - Congrats Ladies. :) Champs of the world!! :D

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass

    can you try again whith --debug as well like i linked it originally please, it should give a more detailed output (or at least it does for pushover, sadly i do not use boxcar so i'm not sure if it'll be as detailed)

    run it like i mentioned on my post earlier, so ./plexWatch.pl --recently_added=show --debug

    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,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    war59312 wrote on July 27 2013, 11:37 PM: »

    Yea whoops, I was copying and pasting for sure..

    OK well now I am getting this:

    As EntroX said, please run with debug: ./plexWatch.pl --recently_added=show --debug

    Also note, depending on the provider, they seem to possibly rate limit or just fail when requests are too frequent. If it's the case that some go through, then these will probably clear after time. Either way, best to run with --debug so we can see what the real reason is (I hope).

  • war59312war59312 Posts: 52Members, Plex Pass Plex Pass
    edited July 2013

    Yeah sorry, for some reason I thought I had and saw no different output.

    Does not appear to help really:

    update recently_added set file = 1 where item_id = '/library/metadata/5823'
    PROWL - Notification successfully posted.
    update recently_added set prowl = 1 where item_id = '/library/metadata/5823'
    update recently_added set boxcar = 1 where item_id = '/library/metadata/5823'
    update recently_added set file = 1 where item_id = '/library/metadata/5824'
    PROWL - Notification successfully posted.
    update recently_added set prowl = 1 where item_id = '/library/metadata/5824'
    Failed to post Boxcar notification - NEW: Game of Thrones: Blackwater s02e09 [TV-MA] [2012] 54min [1080p 6ch] [4:21pm 24 Feb 13]
    boxcar Failed: we will try again next time.. NEW: Game of Thrones: Blackwater s02e09 [TV-MA] [2012] 54min [1080p 6ch] [4:21pm 24 Feb 13]

    But indeed it appears to be rate limited since some of the messages (146 show up) are now in fact showing up under "plexWatch" on the boxcar website.

    So it does appear to be working but you need to make it not go over rate limit somehow it seems.

    God Bless U.S.A - Congrats Ladies. :) Champs of the world!! :D

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass

    i believe the recently added should be 50 items per section?, the first go should be quite big but after that it should be manageable (well, depending on how much stuff you add per check that is)

    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)

  • war59312war59312 Posts: 52Members, Plex Pass Plex Pass

    I added a lot, a few thousand. :)

    God Bless U.S.A - Congrats Ladies. :) Champs of the world!! :D

  • ljunkieljunkie Plex Dev Team Posts: 4,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited July 2013
    war59312 wrote on July 28 2013, 2:35 AM: »

    Yeah sorry, for some reason I thought I had and saw no different output.

    Does not appear to help really:

    But indeed it appears to be rate limited since some of the messages (146 show up) are now in fact showing up under "plexWatch" on the boxcar website.

    So it does appear to be working but you need to make it not go over rate limit somehow it seems.

    I have noticed certain providers seem to have a rate limit even though they do not provide information about it publicly. I will put in some more time to research each provider and add some sort of rate limit based on what information I can dig up. I also need to look into how many items show up in Plex's recently added api call. I've seem 50 to a couple hundred, so it varies. If you are adding a couple thousand, I am thinking only the last 50 to a couple hundred might show up in Plex's api.

    Do note that even though the script will tell you the notification failed, it is also stating it will try again on next run to send them. --recently_added=... should be run on a cron interval. I have mine running every 5 minutes.

    Edit: the --debug actually does help me. There would have been more output if there was some other issue than the fact boxcars response was something like 'message failed, try again'

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

     Version 0.0.15 released

    I am keeping the first post updated with current release info: http://forums.plexapp.com/index.php/topic/72552-plexwatch-plex-notify-script-send-push-alerts-on-new-sessions-and-stopped/?p=419276

     Change Log0.0.15

     * 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 to disable specific notify types
     * --exclude_user added to all functions. You can specifiy --exclude_user multiple times.. i.e --exclude_user=user1 --exclude_user=otherUsername
     * Boxcar added as provider
       - All you need is a registered account on boxcar (valid email)
       - If enabled, this script with register your boxcar account to the plexWatch service -- simple right?
     * Twitter/OAuth modules ONLY required if you enable twitter (Net::Twitter::Lite::WithAPIv1_1 , Net::OAuth)
     * removed module WWW::Curl::Easy (replaced with LWP which is more standard)
     * removed module URI::Escape (using my own subroutine)
     * --version added -- easier to debug
     
     
    Future tasked items:
    * rate limit: if notifications failed -- back off, possibly exit if we need to wait a longer duration than a couple of seconds. 
    * Add GNTP: allow for multiple growl destinations 
    * Paused Status: hoping to add support to notice if video has been paused.. this way we don't assume someone has been watching the content during the paused state. 
  • ljunkieljunkie Plex Dev Team Posts: 4,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

    Well I already hit a fun road block for twitter. The rate limiting api calls are are NOT related to 'write operations'. Twitter has allowances for writes (tweets) and currently allows 1000 tweets a day, which is a pretty good limit. However, that 1k daily limit is "further broken up into undisclosed roaming windows of time with partial allotments within them". With testing I was able to get about 120 tweets in until the '403: forbidden error' is returned. At this time twitter does not have any way to check current allowances either.

    Other providers might have better rate limit api calls I can use to back off, but for now it just seems twitter is fire and forget. If it fails, plexWatch will know it didn't process and continue trying (as it already does). This means eventually the notifications will process. I am going to set plexWatch to stop processing additional notifications per provider if an error does happen. We will try the notifications again on the next run, but this will at least keep the notifications in order.

    I am also thinking I will set the recently added option to only return the last 25 or so results per section. This should help for the first run on recently added items. With a 5 minutes cron or the script, or maybe even ever minute, it *should* catch all additions (that is if you only add about 25 items per section per cron interval). It's possible you might add hundreds or thousands, but would one really want a notifications at that time for EVERY item? Anyone have any issue with this change?

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass

    i would be okay with it but at the same time there should be a way of "starting" the database by telling it to just pull the last one and go from there maybe?, i just downloaded 0.0.15 and put it on my crontab and i forgot it was going to send the spamfest (not that i care really) so i think there should be a way to work around that.

    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,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    EntroX wrote on July 29 2013, 11:59 PM: »

    i would be okay with it but at the same time there should be a way of "starting" the database by telling it to just pull the last one and go from there maybe?, i just downloaded 0.0.15 and put it on my crontab and i forgot it was going to send the spamfest (not that i care really) so i think there should be a way to work around that.

    I agree. There is also really no reason to be notifying on recently added when they are days if not months old. Sadly I thought the recently_added would have been the easiest feature :) Next release should be better.

    Also note, on 'upgrading', you can keep your existing database.

  • EntroXEntroX Posts: 93Members, Plex Pass Plex Pass
    edited July 2013

    yeah, but on the non-dev one there was no recently added stuff, i should have just copied the dev one before running it so my bad :P

    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,835Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    Anyone have any thoughts on this?

    Recently added content looks to have a limit of around 99 per section. Content could be days, weeks, months old. I am planning to only notify if the content add date is 7 days or newer and limit it to 25 per section each run. It would be best to cron this process every 1-5 minutes.
  • WeeflixWeeflix Posts: 238Members, Plex Pass Plex Pass

    It doesn't need to be 7 days or newer. How about in the 24 hours or newer? that would probably cover things if we are running the processor every 5 minutes.

13468967
Sign In or Register to comment.