Plex Reporting Script - For seeing what clients have watched

Hi everyone,

I spent a few hours putting together a quick script that will tell you what files have been accessed by your plex clients on a daily basis. As I have a few people watching stuff remotely on mine, I wanted to keep track of how much use my PMS was getting etc. It’s written in Perl, and while it still needs some improvement it works nicely on Linux/OSX platforms (for OSX you require macports, see the readme file). I use it to send me an email every evening so I can see what the server has been upto.



GitHub: https://github.com/stuarthopkins/Plex-Reporter



I will continue to work on it as its still a bit rough around the edges, but it works pretty nice (and it can email you the report if you enable it). I’ve pasted some sample below for all to see. As always, comments/suggestions/cake welcome :slight_smile:



---- Sample ----



Plex Reporter Script - Version 0.2



2 client(s) connected to your plex server today



Examining activity for client: 192.168.0.10 (testclient.local)

  • 5 video file(s) have been accessed today by this client

    Futurama S01E02 - Episode Two: The Series Has Landed.mkv

    Futurama S01E03 - I, Roommate.mkv

    Futurama S01E06 - A Fishful Of Dollars.mkv

    Futurama S01E09 - Hell Is Other Robots.mkv

    Futurama S02E05 - I Second That Emotion.mkv



    Examining activity for client: aaa.bbb.ccc.ddd (Unknown)
  • 1 video file(s) have been accessed today by this client

    Celebrity Juice S06E12 - Amy Childs, Paddy Mcguinness, Michelle Keegan.avi

Just a quick update for anyone interested, i’ve pushed version 0.3 to GitHub now… It is much improved and now allows you to specify what date you actually want to check (rather than just todays). I’m working on getting date range support added (and the ability to see all viewed files recorded in the logfile etc).



Hope its of use :slight_smile:

This sounds like a cool idea, I think I’ll give it a whirl!

Forgot to point out… version 0.3 also supports running on a Mac (providing you have macports etc installed). Instructions are in the readme file.

Seems to work ok on my ubuntu 11.10 server, I also have a suggestion, what about writing to an rss feed?



What did you have in mind?


Well my isp blocks port 25 so it makes emailing more complicated.

I was thinking along the lines of an rss feed with updates a bit like a news feed

so you would have each client listed in the feed with what they have watched listed

I hope that makes sense?


Yeah that makes sense, will have a look into it this weekend...

As for your ISP blocking port 25, do they not give you their own SMTP server to use? I have the same issue in the UK, but you are allowed to send mail through your ISP's SMTP server instead (helps them cut down on spam etc).


Yeah, o2 let me use their server but it's in my dads name and he said it requires me to get him to create an account and some other stuff

When I was setting up FlexGet I gave up and used prowl for notifications


Just found this on a forum...

You can also change the outgoing SMTP mail server to
relay.o2broadband.co.uk instead of SMTP.o2.co.uk and this will allow you to send email without authentication.

Not sure if it works, but it might be worth testing :-)

hmm, I’ll have a look and see if it works



Doesn't seem to want to work :(

When I installed libmime-lite-perl I got a config screen and may have messed it up, I've purged the package and reinstalled but can't get back to the config screen

Is there a way to re-configure?


Try
dpkg-reconfigure libmime-lite-perl

Are you sure the config screen was from that module? It wouldn't surprise me if it has pulled in Postfix (which does have a config screen).


That didn't seem to do anything

I tried it with postfix but it said it wasn't installed

I installed it and ran the script but still no email :(


I take it you have configured the script with your smtp details etc. Failing that, google for 'SMTP telnet' and it shows you how to test if an SMTP relay is working (in essence, send yourself an email by hand). If it works by hand, we can dig a little deeper and see what is going on. If it doesn't, their mail relay isn't working.


ah telnet, I remember doing that frequently last year when on my university placement

I'll see what happens


telnet mail was received ok (albeit in my spam box)

but still not from the script


OK, can you PM me the top part of the script (with your settings etc) so I can make sure it looks ok.

done

I’ve tried this out for a couple of days and it doesn’t appear to work.



I’m using plex remotely over myplex, would that be the reason?



It just keeps saying no clients connected, right after watching something