plexWatch - Windows Branch

I spent a couple hours tonight doing various tests… Reverting back works fine other than not being able to push to a channel. No repeats occur. Using the V2 API and a channel causes the same last release to keep repeating each time the script is run.

I even started with a fresh copy of both config.pl and plexWatch.pl (0.3.2) to ensure my running copies didn’t have any oddities. Same result.

–debug mode is not being issued.

I’d be curious to see if both of you can recreate the repeating.

I haven’t had time to look, but I can probably guess as to what’s happening. The api url was modified, so I assume their response has changed. The response is used to verify the post was successful, and it’s probably not marking it as a success, so it’ll try again and again for a few days.

I spent a couple hours tonight doing various tests… Reverting back works fine other than not being able to push to a channel. No repeats occur. Using the V2 API and a channel causes the same last release to keep repeating each time the script is run.


I even started with a fresh copy of both config.pl and plexWatch.pl (0.3.2) to ensure my running copies didn’t have any oddities. Same result.


–debug mode is not being issued.


I’d be curious to see if both of you can recreate the repeating.

According to the Pushbullet changelog there hasn't been a change made to the response, maybe the change was so minor that it didn't find it's way into the changelog. I haven't had time to test this but I will try to look into this tonight.

KG

I haven't had time to look, but I can probably guess as to what's happening. The api url was modified, so I assume their response has changed. The response is used to verify the post was successful, and it's probably not marking it as a success, so it'll try again and again for a few days.
 

Just spend all last night skimming the entire thread. I finally got Prowl notifications working. However, my ultimate goal is to get email notifications, which isn't working for right now for me. Any tips on what I might be doing wrong?

EMAIL – multiple destinations are supported

'EMAIL' => {

    '1' => 	{
        'enabled' => 1, ## set to 1 to enable local EMAIL
        'push_recentlyadded'  => 0,
        'push_watched'        => 1,
        'push_watching'       => 1,
        'push_paused'         => 1,
        'push_resumed'        => 1,
        'server' => 'smtp-relay.gmail.com', # your mail server
        'port' => '25', # your mail server port defalt 25 (587 is also a good choice)
        'from' => 'myemail@gmail.com',   # your From email address: 'user@domain.com'
        'to' => 'myemail@gmail.com',     # Email address to receive notification: 'user@domain.com'
        'username' => 'myemail@gmail.com', # AUTH if needed [optional]
        'password' => 'mypassword', # AUTH if needed [optional]
        'subject' => '{user} {push_title} {title}', ## push_title is special for EMAIL (for now)
        'enable_tls' => 0,  # ENABLE for TLS support ( your smtp server must allow STARTTLS )
        'alert_format' => {
            'start'    =>  '{title} [{streamtype}] [{year}] [{rating}] on {platform} [{progress} in] {ip_address} {all_details}',
            'paused'   =>  '{title} [{streamtype}] [{year}] [{rating}] on {platform} [{progress} in] [{percent_complete}%] {ip_address} {all_details}',
            'resumed'  =>  '{title} [{streamtype}] [{year}] [{rating}] on {platform} [{progress} in] [{percent_complete}%] {ip_address} {all_details}',
            'stop'     =>  '{title} [{streamtype}] [{year}] [{rating}] on {platform} for {duration} [{percent_complete}%] {ip_address} {all_details}',
        },
    },

    '2' => 	{
        'enabled' => 0, ## set to 1 to enable EMAIL
        ## fill in the rest if you need more then 1 email notification
    },
},

};

Edit: Nevermind, I got it working. I changed server to smtp.gmail.com, port 587 and enabled tls. And I had to allow less secure apps in an email gmail sent me.

Well I did some more research into the Pushbullet API and i found out the following.

  1. The reply when pushing to a device (or an account by leaving the device_iden field blank) has changed. The first line now reads
     {"active":true, ......
    

    with the V2 API, instead of 

    {“created”:…


    with the V1 API, so the check on line 2573 is bound to fail.




  2. When pushing to a device (device_iden field used) or to an account (device_iden field left blank) the service sends a response. However when pushing to a channel, no response is sent.




  3. I have been playing around with these modifications and I’m not able to duplicate the multi-pushing experienced by eleese. I have however noted that on the windows version of the pushbullet client the pushes appear to be persistent despite having a time-out. What i mean by this is that once a push is recieved, displayed and automatically goes away after the set amount of time, it will reapper the next time you get another puss unless you specifically dismiss the push.




  4. Although a “success” reply is not sent when pushing to a channel, an “error” reply appears to be transmitted everytime something goes wrong, channel_tag problems, device_iden problems and api key problems. This means that checking for errors would perhaps be the way to go instead of checking for success. So changin the aformentioned line 2573 from:

     



    if ($content !~ /“created”:/) {

    to 

     



    if ($content =~ /“error”:/) {

@eleese: As stated earlier i was unable to reproduce the multiple pushes. Only time a get a new push is if something has changed (play, pause status) or if something has been added. I'm not running plexwatch as a cron but manually, I don't see that affecting the outcome. Can you hypothesize as to what is causing the multiple pushes?  

This explains the duplicates. It thought the notification failed, so it tried to send it again the next time. I'd be tempted to ignore parsing the response and just rely on LWP user agents response code. To be honest, I am n

-    if ($content !~ /\"created\":/) {
+    if (!$response->is_success) {

full diff (to fix some style nits)

index 93c1916..291f2f2 100755
--- a/plexWatch.pl
+++ b/plexWatch.pl
@@ -2566,14 +2566,13 @@ sub NotifyPushbullet() {
                                  "title" => $po{'title'},
                                  "body" => $po{'message'},
                              ]);
-    my $content  = $response->decoded_content();
-
  • if ($content !~ /"created":/) {
  •   print STDERR "Failed to post Pushbullet notification -- $po{'message'} result:$content
    

";

  •   $provider_452->{$provider} = 1;
    
  •   my $msg452 = uc($provider) . " failed: $alert -  setting $provider to back off additional notifications
    

";

  •   &ConsoleLog($msg452,,1);
    
  • if (!$response->is_success) {
  •    my $content  = $response->decoded_content();
    
  •    print STDERR "Failed to post Pushbullet notification -- $po{'message'} result:$content
    

";

  •    $provider_452->{$provider} = 1;
    
  •    my $msg452 = uc($provider) . " failed: $alert -  setting $provider to back off additional notifications
    

";

  •    &ConsoleLog($msg452,,1);
    
      return 0;
    
    }

Well I did some more research into the Pushbullet API and i found out the following.

  1. The reply when pushing to a device (or an account by leaving the device_iden field blank) has changed. The first line now reads
     {"active":true, ......
    

    with the V2 API, instead of 

    {“created”:…


    with the V1 API, so the check on line 2573 is bound to fail.




  2. When pushing to a device (device_iden field used) or to an account (device_iden field left blank) the service sends a response. However when pushing to a channel, no response is sent.




  3. I have been playing around with these modifications and I’m not able to duplicate the multi-pushing experienced by eleese. I have however noted that on the windows version of the pushbullet client the pushes appear to be persistent despite having a time-out. What i mean by this is that once a push is recieved, displayed and automatically goes away after the set amount of time, it will reapper the next time you get another puss unless you specifically dismiss the push.




  4. Although a “success” reply is not sent when pushing to a channel, an “error” reply appears to be transmitted everytime something goes wrong, channel_tag problems, device_iden problems and api key problems. This means that checking for errors would perhaps be the way to go instead of checking for success. So changin the aformentioned line 2573 from:

     



    if ($content !~ /"created":/) {

    to 

     



    if ($content =~ /"error":/) {

@eleese: As stated earlier i was unable to reproduce the multiple pushes. Only time a get a new push is if something has changed (play, pause status) or if something has been added. I'm not running plexwatch as a cron but manually, I don't see that affecting the outcome. Can you hypothesize as to what is causing the multiple pushes?  

I am thrilled that it is turning out to, what appears to be, some simple code modifications for channel support. I realize this is all still for linux right now - but please update us when it gets compiled for Windows branch!

Hi guys i have this is awesome and i really want this to work but i have one problem.
I have both of the scripts running and updating like instructed on the first page.
but i have to run the .EXE for some functions to work.
let me know if i should ask this elsewhere. In that case i'm sorry.

On this page everything 
![post-321856-0-37032100-1425841999.png|690x338](upload://ml4wwruDzozHvVxcpuqHZSXdLot.png)
But i have to run the EXE file manually if i want any of this to work.
![post-321856-0-22529200-1425842001.png|690x182](upload://7CGt7Hqac4aghz6U47hJN20zy7Q.png)
![post-321856-0-24300700-1425842002.png|690x213](upload://yrh7544zllIrhV03lbWpc32w5Nr.png)
![post-321856-0-72662000-1425842003.png|690x188](upload://v6gUuAUlP0VDY6rVKk015jCDmkj.png)
![post-321856-0-94343100-1425842005.png|690x158](upload://9ibHUaAQXspy0LdgEuLuGJJZ9rE.png)



Thank you for this app it is awesome and helpful wish you all the best.

I second this, It would be great to be able to push to a channel.

Edit: I looked into this a little more.

Looking at the plexwatch.pl file, specifically the NotifyPushbullet() function on lines 2453 - 2511, there appears to be the call to the Pushbullet API on line 2490. It appears that the call is to the V1 API but the channels feature is a part of the V2 API. I'm guessing that changing the call to use the V2 API instead of the V1 API would solve this. 

...

I spent a couple hours tonight doing various tests... Reverting back works fine other than not being able to push to a channel. No repeats occur. Using the V2 API and a channel causes the same last release to keep repeating each time the script is run.

I even started with a fresh copy of both config.pl and plexWatch.pl (0.3.2) to ensure my running copies didn't have any oddities. Same result.

--debug mode is not being issued.

I'd be curious to see if both of you can recreate the repeating.

This explains the duplicates. It thought the notification failed, so it tried to send it again the next time. I'd be tempted to ignore parsing the response and just rely on LWP user agents response code. To be honest, I am n

-    if ($content !~ /\"created\":/) {
+    if (!$response->is_success) {

...

@ljunkie I created a pull request that pulled all of this together, which is working at least on my personal install. Feel free to close it if you already have all of this work done on your own (just push it up already  :P ).

@eleese I could not replicate your issues, even before incorporating the new error checking code. In any case the new check that @ljunkie posted is incorporated in the pull request.

For anyone interested this can be found here: https://github.com/ljunkie/plexWatch/pull/80

Hopefully this helps somebody!

when I run plexwatch.exe it shows this message:

The locale codeset (cp950) isn't one that perl can decode, stopped at /Encode/Locale.pm line 94, line 176.

please help, thx.

Can you tell me how you fixed this? I'm stuck at the same problem

EDIT: Fixed by changing Locale to English.

But I'm getting a different error now, its saying I MUST specify a myplex user/pass but in the config file it says I only need to if it's not localhost (which it is) or I Require Authentication on Local Networks (Which I don't). Is it mandatory now?

When I schedule a task for this it doesn't seem to work correctly. Running the task results in it saying "The task is currently running. (0x41301)" it never completes.

When I run the .exe under cmd with admin everything is fine, but this .vbs file doesn't work.

other info...

.vbs and .exe are in the same forlder

action is set to "start program -> C:\plexWatch\plexWatchNotify.vbs"

Starting folder is set to "C:\plexWatch\"

Any help is greatly appreciated 

*****Updated*****

I figured it out.

I ran the program once from Explorer by double clicking, then unchecked the box that says "always ask to run this program"

Are there any known bugs right now? I'm seeing an issue where the notify script runs, sees I start playing something, and reports it. It will also pick up when I stop playing something, but then every time it runs* it says I watched that thing and it never stops adding it to the database. It thought I "watched" Agents of Shield at 48% for 48 hours. I haven't used this in months so when I updated to the latest  version I cleared my database and started fresh. I've got PlexWatchWeb installed as well so it just makes the problem with the data stick out even more when it shows Currently Watching all the time.

I'm using 0.3.2.0 on Windows and it's behaving as expected, I don't have the behavior you've described. plexWatch.log shows "Watching" and "Watched" more/else once per title.

Hmm. Maybe I'll wipe the directory and start from scratch.

I have been running plexWatch since mid-2013 and I've noticed the db has grown quite large over this time. I have it automatically going to my web server for plexWatch/Web every two hours, this is taking up a lot of bandwidth. I am looking to cut down the size of the db and was looking to purge everything older than 2015, any suggestions on a good way to go about this? Open the db in a sql manager and drop the rows?

So far got it up and running fine. couple questions..

How do i get the IP address' to show up? I cant for the life of me figure it out. I am on windows.

Also is it possible to secure the site? i want to be able to use this for my users so they can see live stats but don't want them changing settings.

i am using this externally. let me know. Thank you!

Have installed plexWatch and got it working. If i manually open the .vbs files they work and update the plexwatch.db, test complete.

Create Tasks to run the .vbs but they don't work, really driving me mad as one minute they work the next they dont.

So if i manually open vbs they work.

If i let task Scheduler do its thing it fails with different error every time http://screencast.com/t/KVnsQj37wzv

If i manually right click on the task and click run http://screencast.com/t/O1w3xYllit works with no errors http://screencast.com/t/DPjcJxsUv surely its correctly setup then?

Tried muliple suggestions from other pages, Used highest priv, have start folder set, made sure.vbs is on end of link to script ect.

Any suggestions

0×8004131F: An instance of this task is already running.

Your scheduled task doesnt seem to be finishing before the next run is instructed to start.

0×8004131F: An instance of this task is already running.

Your scheduled task doesnt seem to be finishing before the next run is instructed to start.


Thanks for pointing me in the right direction. I have got them running smoothly now.

Thanks for pointing me in the right direction. I have got them running smoothly now.

Also make sure you add another trigger at startup.