plexWatch - Windows Branch

when i run it with any task scheduler it does not work. I see a cmd window flash quickly but, no notices. If i manually click on the plexwatch.exe it works fine and i get all the notices, 

Check a few posts back where I said about setting the start in location in task manager to fix that problem.

When I run plexwatch.exe -- stats I get the following error after each user, any ideas?

user: Local's total duration 4 minutes
Argument "2013-9-2" isn't numeric in localtime at plexWatch.pl line 618, 
line 176.
 %a %b %e %Y: Local 4 minutes

The line of code its complaining about is this:

my $h_date = strftime "%a %b %e %Y", localtime($epoch);

--stats is fixed now ( should be ) Found the bug.. squashed it. https://github.com/ljunkie/plexWatch/tree/v0.0.19-win32 You just need to replace the exe

download: https://github.com/ljunkie/plexWatch/raw/v0.0.19-win32/plexWatch.exe

Messages working fine with Pushover, thanks ;)

I found it a bit better, to not schedule the plexWatch.exe directly but rather make and schedule a very simple vbs script for win7.

Simply make a new text file and name it to plexWatch.vbs

paste the following:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\plexWatch\plexWatch.exe" & Chr(34), 0
Set WshShell = Nothing

save it and schedule to run the plexWatch.vbs file.

No more pop-ups every minute. But probably there is an easier way.

I run an Unraid PMS server and run plexWatch on a Win7 machine. Can I get IP-logging function to work?

The 2 machines are on the same network.

Messages working fine with Pushover, thanks ;)

I found it a bit better, to not schedule the plexWatch.exe directly but rather make and schedule a very simple vbs script for win7.

Simply make a new text file and name it to plexWatch.vbs
paste the following:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\plexWatch\plexWatch.exe" & Chr(34), 0
Set WshShell = Nothing

save it and schedule to run the plexWatch.vbs file.
No more pop-ups every minute. But probably there is an easier way.

I run an Unraid PMS server and run plexWatch on a Win7 machine. Can I get IP-logging function to work?
The 2 machines are on the same network.


Nice! I ha no idea if pops up a cli on every run. I will look into adding this vbs script to the repo. I think I might be able to compile the exe differently too, so I'll put this on the list.

As for IP addresses, you would have to mount the PMS log dir on your windows machine. You can then edit your config.pl to point at the log file locally.

Tried the mapped drive in windows, unfortunately command line doesn't have access to mapped drives. There is a reg fix for that but not advisable. But tried it anyway.

In a cmd prompt I can access the mapped Z drive, I can view the dir content in cmd, however,

When I run plexWatch.exe it gives me:

warning: $server_log is specified in config.pl and Z:\\ does not exist (required f
or logging of the clients IP address)

Does Anyone have a suggestion?

Tried the mapped drive in windows, unfortunately command line doesn't have access to mapped drives. There is a reg fix for that but not advisable. But tried it anyway.

In a cmd prompt I can access the mapped Z drive, I can view the dir content in cmd, however,
When I run plexWatch.exe it gives me:

warning: $server_log is specified in config.pl and Z:\\ does not exist (required f
or logging of the clients IP address)

Does Anyone have a suggestion?

Nice work. I think I must have not documented the $server_log variable well. I even wrote a warning about it, but I now realize it's ambiguous :)

$server_log = full path to the server log file, not just the directory. Try putting in the full path to the file and let me know how that goes.

That worked nicely! thanks, directly given full path for example: z:\\logs\\Plex Media Server.log

So far so good, will play around a bit more tomorrow ;)

this works great! thats for all your work!!

I'm a bit stuck - I just keep getting "config file missing data" when I run plexWatch.exe - running on windows server 2012. Tried changing from localhost to the IP, the correct port and some other settings, always the same result. What beginners mistake am I making?

I'm a bit stuck - I just keep getting "config file missing data" when I run plexWatch.exe - running on windows server 2012. Tried changing from localhost to the IP, the correct port and some other settings, always the same result. What beginners mistake am I making?

That could also just mean the config.pl could not be parsed correctly. Maybe there is a typo. Can you post the config or PM me if you don't want to post any private data?

Haven't really done much to it, perhaps something I'm forgetting? I have a technical background, but when it comes to code I'm at kindergarden level.

$data_dir = 'c:\\plexWatch\\'; ## to store the DB, logfile - can be the same as this script

$server_log = ‘C:\Users\hermanna\AppData\Local\Plex Media Server\Logs\Plex Media Server.log’; ## used to log IP address of user (alpha)
$log_client_ip = 0; ## requires $server_log to be available too. (requires File::ReadBackwards)

$debug_logging = 0; ## logs to $data_dir/debug.log ( not verbose enought yet… still todo )

myplex user/pass ONLY required if you have set the PMS to ‘Require authentication on local networks’ and $server is not set to localhost

$myPlex_user = ‘AntiTrust’;
$myPlex_pass = ‘removed’;

$server = ‘192.168.1.50’; ## IP of PMS - or localhost
$port = 443;         ## port of PMS

$notify_started = 1;   # !deprecated – does nothing anymore (use push_watched, push_watching in $notify)
$notify_stopped = 1;   # !deprecated – does nothing anymore (use push_watched, push_watching in $notify)

$appname = ‘plexWatch’;

Give a user a more friendly name. I.E. REAL_USER will now be Frank

you may also specify the platform with user+platform

$user_display = {‘REAL_USER1’ => ‘Frank’,
‘REAL_USER2’ => ‘Rob & Carrie’,
‘REAL_USER2+Roku 3’ => ‘Family Room’,
‘REAL_USER2+Roku’ => ‘Family Room’,
‘REAL_USER2+iOS’ => ‘Rob’,
};

format of alert - default. You can also override this per provider  ($notify below)

run ./plexWatch.pl --format_options – to see all

      start = notification for start of video

      stop = notification for stop of video

      watched = cli output for watched content

      watching = cli output content being watched

$alert_format = {‘start’    =>  ‘{user} watching {title} [{streamtype}] [{year}] [{rating}] on {platform} [{progress} in] {ip_address}’,
‘stop’     =>  ‘{user} watched {title} [{streamtype}] [{year}] [{rating}] on {platform} for {duration} [{percent_complete}%] {ip_address}’,
‘watched’  =>  ‘{user} watched {title} [{streamtype}] [{year}] [{length}] [{rating}] on {platform} for {duration} [{percent_complete}%] {ip_address}’,
‘watching’ =>  ‘{user} watching {title} [{streamtype}] [{year}] [{rating}] [{length}] on {platform} [{time_left} left] {ip_address}’
};

$notify = {

    ‘file’ => {
    ‘enabled’ => 1,  ## 0 or 1 - set to 1 to enable File Logging
    ‘filename’ => “$data_dir/plexWatch.log”, ## default is plexWatch.log
    },
    
   ‘prowl’ => {
       ‘enabled’ => 0, ## 0 or 1 - set to 1 to enable PROWL
       ‘push_recentlyadded’  => 0,
       ‘push_watched’        => 0,
       ‘push_watching’       => 0,
       ‘apikey’ => ‘YOUR API KEY’, ## your API key
       ‘application’ => $appname,
       ‘priority’ => 0,
       ‘url’ => ‘’,
       ‘collapse’ => 0, ## will change for mating if collapsed notification are set in prowl   (deprecated)
    },
    
    ‘pushover’ => {
       ‘enabled’ => 0, ## set to 1 to enable Pushover
       ‘push_recentlyadded’  => 0,
       ‘push_watched’        => 0,
       ‘push_watching’       => 0,
       ‘token’ => ‘YOUR APP TOKEN’, ## your app token
       ‘user’ => ‘YOUR USER TOKEN’,  ## your user token
       ‘title’ => $appname,
       ‘sound’ => ‘intermission’,
    },

    ‘growl’ => {
       ‘enabled’ => 0, ## set to 1 to enable local growl (You should probably used GNTP - growl supported for multiple platforms - below)
       ‘push_recentlyadded’  => 0,
       ‘push_watched’        => 0,
       ‘push_watching’       => 0,
       ‘application’ => $appname,
       ‘script’ => ‘/usr/local/bin/growlnotify’,
       ‘icon’ => ‘/Applications/Plex Media Server.app/Contents/Resources/MyPlex.icns’,
    },

    ‘twitter’ => {
        ‘enabled’             => 0, ## set to 1 to enable local growl
‘push_recentlyadded’  => 0,
‘push_watched’        => 0,
‘push_watching’       => 0,
        ‘application’         => $appname,
‘consumer_key’        => ‘’,
        ‘consumer_secret’     => ‘’,
        ‘access_token’        => ‘’,
        ‘access_token_secret’ => ‘’,
    },

    ‘boxcar’ => {
        ‘enabled’ => 0, ## set to 1 to enable local growl
‘push_recentlyadded’  => 0,
‘push_watched’        => 0,
‘push_watching’       => 0,
‘email’ => ‘’,                          ## YOUR email address registered at boxcar
‘from’ => ‘Your From Name’,              ## From Name displayed on boxcar
‘provider_key’ => ‘o2eI7rcwya5XFETaXdlh’,                        ## plexWatch app is ‘o2eI7rcwya5XFETaXdlh’. You may supply your own.
‘provider_secret’ => ‘h4pJjyBoEMk1rwK2EH3NLemO4fQ0ql9HnRgVfwg4’, ## plexWatch app is ‘h4pJjyBoEMk1rwK2EH3NLemO4fQ0ql9HnRgVfwg4’. You may supply your own.
‘icon_url’ => ‘’, # Leave empty (’’) for plexWatch icon. You may supply your own (57x57)
    },

    ## GNTP (GROWL) – multiple destinations are supported 
    ‘GNTP’ => { 
‘1’ => {
   ‘enabled’ => 0, ## set to 1 to enable local growl
   ‘push_recentlyadded’  => 0,
   ‘push_watched’        => 0,
   ‘push_watching’       => 0,
   ‘application’ => $appname,
   ‘server’ => ‘10.0.0.1’, # destination ip/host
   ‘port’ => ‘23053’,      # default 23053
   ‘password’ => ‘’,       # ‘’ for no pass
   ‘icon_url’ => ‘https://rarforge.com/images/plexWatch.57x57.png’,
   ‘sticky’ => 1,
},

‘2’ => {
   ‘enabled’ => 0, ## set to 1 to enable local growl
   ‘push_recentlyadded’  => 0,
   ‘push_watched’        => 0,
   ‘push_watching’       => 0,
   ‘application’ => $appname,
   ‘server’ => ‘192.168.10.100’, # destination ip/host
   ‘port’ => ‘23053’,      # default 23053
   ‘password’ => ‘’,       # ‘’ for no pass
   ‘icon_url’ => ‘https://rarforge.com/images/plexWatch.57x57.png’,
   ‘sticky’ => 0,
},
    },

};

$push_titles = {
    ‘push_watched’        =>  ‘Watched’,
    ‘push_watching’       =>  ‘Watching’,
    ‘push_recentlyadded’  =>  ‘New’,
};

 


Haven't really done much to it, perhaps something I'm forgetting? I have a technical background, but when it comes to code I'm at kindergarden level.

....

The config.pl checks out. However two things. I don't think SSL works correctly yet for windows -- I will see if I can make it work. For now, please change the port to 32400 ( also if it is ssl, the port should be 32443 )

I don't see why it would complain about missing variables. See if changing the port to 32400 works. If not try from the beginning and  just copy the config.pl-dis-win32 to config.pl and make sure it's in the same directory as plexWatch.exe. Let me know

Just tried with a fresh extract, clean untouched files. Now, If I create the config.pl folder, inside the plexWatch folder (C:\plexWatch\config.cl), and run plexWatch.exe, I get the 'config file missing data' error. After I copy the config.pl-dist-win32 file into the config.cl folder I get that very same error.

EDIT: Just tried the same thing in a virtual machine with XP, same error. 

What I do.

1. Extract files

2. Create config.cl inside the plexWatch folder, which holds the plexWatch.exe file.

3. Copy paste the config.pl-dis-win32 into the config.cl folder

4. Run the plexWatch.exe from cmd. 
5. Error.. 

 

Just tried with a fresh extract, clean untouched files. Now, If I create the config.pl folder, inside the plexWatch folder (C:\plexWatch\config.cl), and run plexWatch.exe, I get the 'config file missing data' error. After I copy the config.pl-dist-win32 file into the config.cl folder I get that very same error.

the config.pl is not a folder it's a file in c:\plexWatch.  You should have the following:

c:\plexWatch\plexWatch.exe

c:\plexWatch\config.pl

I also just pushed a new version that will work with SSL. I also downloaded it and ran it, works great with just the defaults. Try downloding this zip https://github.com/ljunkie/plexWatch/archive/dev-win32.zip

Ah, the misunderstanding is when reading "* copy config.pl-dist-win32 to c:\plexWatch\config.pl"- I thought you meant to copy the config file into another folder, perhaps you could rephrase it to "rename the config.pl-dist-win32 to config.pl." ? :)

Not getting the error now, thanks for the help and for the ssl update!

Ah, the misunderstanding is when reading "* copy config.pl-dist-win32 to c:\plexWatch\config.pl"- I thought you meant to copy the config file into another folder, perhaps you could rephrase it to "rename the config.pl-dist-win32 to config.pl." ? :)

Not getting the error now, thanks for the help and for the ssl update!

Yea, further up in this thread has the exact same problem discussed. I will change the verbiage now :)

Everything's working now, including the Push notifications through pushover - Love this, much needed as my userbase is growing by the day, thank you again!

I’ll be adding two vbs scripts to the repo for you all to use to call plexWatch as a scheduled task. One will call plexWatch notify and the other will run the recently added notifications. Please let me know if anyone has issues.

These vbs scripts will stop the constant popup.

Edit: in case anyone has an issue setting a “minutely” task: http://www.lazywinadmin.com/2012/03/run-this-task-every-minute.html?m=1

I’m also thinking I might add a couple bat files to enable/disable the tasks instead of manually creating them.

I'm trying to get the IP logging enabled, but keep getting the error that it doesn't exist. Something I'm forgetting?

$server_log = 'c:\\Users\\hermanna\\AppData\\Local\\Plex Media Server\\Plex Media Server.log'; ## used to log IP address of user (alpha)
$log_client_ip = 1; ## requires $server_log to be available too. (requires File::ReadBackwards)
 


Also, watched/watching push notifications work fine, but recently added don't, even though it's enabled. Is there anything other then the Pushover config part I need to configure for this to work?

'push_watching'       => 1,