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!

Plex Reporting Script - For seeing what clients have watched

DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
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 :-)

---- 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
«13456713

Comments

  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    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 :-)
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    This sounds like a cool idea, I think I'll give it a whirl!
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    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.
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    Seems to work ok on my ubuntu 11.10 server, I also have a suggestion, what about writing to an rss feed?
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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?
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    DodgyGeeza wrote:

    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?
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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).
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    DodgyGeeza wrote:

    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
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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 :-)
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    hmm, I'll have a look and see if it works
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    marty wrote:

    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?
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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).
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    DodgyGeeza wrote:

    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 :(
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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.
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    DodgyGeeza wrote:

    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
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    marty wrote:

    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
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    marty wrote:

    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.
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    done
  • martzukmartzuk Posts: 513Members, Plex Pass Plex Pass
    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
  • DodgyGeezaDodgyGeeza Posts: 94Members, Plex Pass Plex Pass
    Hmm, are you manually specifying a date? It works fine with myPlex (thats why I originally wrote it).

    The logfile format should (hopefully) be the same, but if it is slightly different that could explain why it isn't finding any... Can you PM me the output of the following command please so I can take a look (only need a few lines of it, and you can change the IP's for security reasons)

    cat '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log' | grep 'progress?key'
«13456713
Sign In or Register to comment.