Jump to content

Playback Reporting


TeamB

Recommended Posts

Thuzad

Hello, what is this part for? I've tried to create a playlist but I don't see it anywhere and I don't understand what it's for, thanks for your help.

Screenshotfrom2023-08-1800-50-23.png.80355cafd5a07f315982e278bf67f846.png

Link to comment
Share on other sites

TeamB
12 minutes ago, Thuzad said:

Hello, what is this part for? I've tried to create a playlist but I don't see it anywhere and I don't understand what it's for, thanks for your help.

Screenshotfrom2023-08-1800-50-23.png.80355cafd5a07f315982e278bf67f846.png

create a new playlist item here and then run the scheduled task:

Playback Reporting : Create Playlists

Its creates playlists for the most watched items

Edited by TeamB
  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
Zhalianna

Hello, 

I noticed this under the schedule tasks section but it doesn't seem to really work. How can I get it to work? I click on it, nothing really happens, and as you see, it takes 0 seconds to run. 

 

image.thumb.png.5d2c1045b3d1f18316e9666574386af3.png

Link to comment
Share on other sites

9 minutes ago, Zhalianna said:

Hello, 

I noticed this under the schedule tasks section but it doesn't seem to really work. How can I get it to work? I click on it, nothing really happens, and as you see, it takes 0 seconds to run. 

 

image.thumb.png.5d2c1045b3d1f18316e9666574386af3.png

Hi, this is related to the playback reporting plugin, so I'm going to move this into the topic for it so that the developer will see it. @Zhalianna

Link to comment
Share on other sites

TeamB
Posted (edited)
33 minutes ago, Zhalianna said:

Hello, 

I noticed this under the schedule tasks section but it doesn't seem to really work. How can I get it to work? I click on it, nothing really happens, and as you see, it takes 0 seconds to run. 

 

image.thumb.png.5d2c1045b3d1f18316e9666574386af3.png

Under the Playback Reporting plugins settings tab set up an activity playlist action:

image.png.7a916f957cebb4e2fd06a71c6ffec2d9.png

Then run the Schedule Task. It should now create a new Playlist with the name you used and the types of items you requested.

This feature will use recent playback activity to build a sorted playlist so you can see and easily play back what users on the server are watching have watched.

 

 

Edited by TeamB
  • Agree 1
Link to comment
Share on other sites

bruor

This plugin is great and I use it regularly, one thing I'm interested in seeing on my server is the number of concurrent playback sessions during a time interval.  

Any chance you could add this functionality to the time tab?

A friend helped me create a custom query that gives me what I need at a given point in time, but it would be great if I could get a sense of how much load the server is under over time by plotting the max number of concurrent streams active hourly/daily.  

Since Emby dedupes TV streams it would be great if the tuner consumption was plotted as well. 

Link to comment
Share on other sites

TeamB
Posted (edited)
26 minutes ago, bruor said:

This plugin is great and I use it regularly, one thing I'm interested in seeing on my server is the number of concurrent playback sessions during a time interval.  

Any chance you could add this functionality to the time tab?

A friend helped me create a custom query that gives me what I need at a given point in time, but it would be great if I could get a sense of how much load the server is under over time by plotting the max number of concurrent streams active hourly/daily.  

Since Emby dedupes TV streams it would be great if the tuner consumption was plotted as well. 

for a while there the plugin was capturing this sort of info as well as things like CPU, GPU and mem ect but noone was using it and it became hard to maintain across multiple platforms so I removed it and just stuck to the original playback info. Noone at the time cared so it was not a big deal dropping it.

I have found the best way to monitor your server from a performance point of view is with off the shelf moitoring tools, there are some interestig ones out there like Grafana with support for promethius and other plugins https://prometheus.io/docs/visualization/grafana/

I wrote a simple tool at one point to log session info from emby into a DB table so it could be queried and displayed in Grafana, it was a fun project but I think I looked at the data 2 or 3 times and when I rebuilt the server last I never reinstated the system. It was just a python script that queried Emby using an API key and saved the session info like how many sessions where running, what was playing and what was transcoding etc, it just logged the data each minute to an Sqlite DB and then I used Grafana and the Slqite data plugin to read and display the data. It took an afternoon to build and set up, was a fun project but like I said I looked at the data 3 times only.

Edited by TeamB
Link to comment
Share on other sites

bruor

I don't have much experience with sqlite, is it safe for me to run a python script to read the database this plugin is storing data in while the server is running? 

I'll probably just set up a cron that runs weekly to do the math and spit the data out to disk so I can look at it. 

Link to comment
Share on other sites

TeamB
Posted (edited)
21 minutes ago, bruor said:

is it safe for me to run a python script to read the database this plugin is storing data in while the server is running? 

no. I dont mean the Emby Sqlite DB, a seperate DB I was collecting data in so Grafana could read the data.

I was querying the Emby server using the API

http://localhost:8096/emby/Sessions?api_key=<api_key_from_emby>

Then logging this info to a new DB and then using this DB in Grafana to chart the results.
Just use requests lib in python to grab the above URL and it returns JSON so in 1 line of code you have your session data, just pull it apart and save it to whatever format you want.

Edited by TeamB
Link to comment
Share on other sites

  • 2 weeks later...
EmbyOak

Is there a way to have Playback Reporting report on the IP address that was used for the stream?

Thank you.

Link to comment
Share on other sites

  • 1 month later...
vaise

I love this plugin - I just want to check these figures however - as to their accuracy.........

This script :

SELECT UserId, SUM(PlayDuration - PauseDuration) AS PlayTime
FROM PlaybackActivity
WHERE DateCreated >= '2023-03-23' AND DateCreated < '2024-03-23'
GROUP BY UserId
ORDER BY PlayTime DESC

Says I have been watching TV for 7356694 seconds, which is 2043.53 hours, and that means 8 hour days of 255.44 if my calculations are correct ........

I mean..... I dont work, but still - 255 days!!!!!

There are some others that just dont see right also - the second place guy - he does work (not full time), but still managed 1663.95 hours - 207 days (8 hour days).

 

 

 

Link to comment
Share on other sites

TeamB
33 minutes ago, vaise said:

I love this plugin - I just want to check these figures however - as to their accuracy.........

This script :

SELECT UserId, SUM(PlayDuration - PauseDuration) AS PlayTime
FROM PlaybackActivity
WHERE DateCreated >= '2023-03-23' AND DateCreated < '2024-03-23'
GROUP BY UserId
ORDER BY PlayTime DESC

Says I have been watching TV for 7356694 seconds, which is 2043.53 hours, and that means 8 hour days of 255.44 if my calculations are correct ........

I mean..... I dont work, but still - 255 days!!!!!

There are some others that just dont see right also - the second place guy - he does work (not full time), but still managed 1663.95 hours - 207 days (8 hour days).

 

 

 

Sometimes weird entries can skew the data, have a loot for outliers, run the query without the aggregation to find long playing sessions:

SELECT *, PlayDuration - PauseDuration AS PlayTime
FROM PlaybackActivity
WHERE DateCreated >= '2023-03-23' AND DateCreated < '2024-03-23'
ORDER BY PlayTime DESC
LIMIT 10

 

Link to comment
Share on other sites

vaise
12 hours ago, TeamB said:

Sometimes weird entries can skew the data, have a loot for outliers, run the query without the aggregation to find long playing sessions:

SELECT *, PlayDuration - PauseDuration AS PlayTime
FROM PlaybackActivity
WHERE DateCreated >= '2023-03-23' AND DateCreated < '2024-03-23'
ORDER BY PlayTime DESC
LIMIT 10

 

That came back with 10 records - none are for my user though..... :

image.png.b5eb7bcfdb0ea9f1c970842ca3f38cba.png

Link to comment
Share on other sites

vaise
12 hours ago, TeamB said:

Sometimes weird entries can skew the data, have a loot for outliers, run the query without the aggregation to find long playing sessions:

SELECT *, PlayDuration - PauseDuration AS PlayTime
FROM PlaybackActivity
WHERE DateCreated >= '2023-03-23' AND DateCreated < '2024-03-23'
ORDER BY PlayTime DESC
LIMIT 10

 

I can see what you are saying with a few records there - no way they could have played for those timeframes.

So I can delete those ones ? - say limit 30 should wack them...... but none are for my user.....

Link to comment
Share on other sites

TeamB
34 minutes ago, vaise said:

I can see what you are saying with a few records there - no way they could have played for those timeframes.

So I can delete those ones ? - say limit 30 should wack them...... but none are for my user.....

the main question is why does emby think a user played something for 282806 seconds, i see this a few times where playback sessions get stuck in emby.

have you been running the emby beta at any time?

you can limit the query to just your user id.

you can delete the items manually when you find them.

or you can run a query that deletes all records with a play time greater then longest media you have in your system, just keep a backup of the playback plugin data in case you screw it up.

Link to comment
Share on other sites

Happy2Play

Should backup be capturing all tables?  Or just the current one per db changes?

As the db has three tables in this instance but backups only exist for PlaybackActivity.

image.png.6f2422b212a0590ec4b289ef904f7168.png

Link to comment
Share on other sites

TeamB
18 minutes ago, Happy2Play said:

Should backup be capturing all tables?  Or just the current one per db changes?

As the db has three tables in this instance but backups only exist for PlaybackActivity.

image.png.6f2422b212a0590ec4b289ef904f7168.png

Those old tables are not used, when the schema changes the plugin renames the current table and creates a new one with the new schema, I never got around to writing auto migration code so the old tables are just backups that are never touched.

The Plugins back up does not back up the old tables unless you migrate the data to the current working table.

  • Like 1
Link to comment
Share on other sites

Happy2Play

Thanks, I migrated the tables into one and deleted the old ones.

Link to comment
Share on other sites

vaise
1 hour ago, TeamB said:

the main question is why does emby think a user played something for 282806 seconds, i see this a few times where playback sessions get stuck in emby.

have you been running the emby beta at any time?

you can limit the query to just your user id.

you can delete the items manually when you find them.

or you can run a query that deletes all records with a play time greater then longest media you have in your system, just keep a backup of the playback plugin data in case you screw it up.

Yep - I was running the beta all the time until this month and have moved to the prod system - and I copied my database across for your thing.

I had hoped going forward it should be good then - but I did the same query for the last 10 days (on prod), it the durations are still bogus :

image.thumb.png.3cdc79ceb8c23e0a3086577ffaa3dfa7.png

If this is caused by the emby prod, maybe its something @luke should be investigating.

.

Link to comment
Share on other sites

vaise
1 hour ago, TeamB said:

the main question is why does emby think a user played something for 282806 seconds, i see this a few times where playback sessions get stuck in emby.

have you been running the emby beta at any time?

you can limit the query to just your user id.

you can delete the items manually when you find them.

or you can run a query that deletes all records with a play time greater then longest media you have in your system, just keep a backup of the playback plugin data in case you screw it up.

Can you help me with a delete statement ?

Delete all records with PlayDuration > 10800

That would be anything over 3 hours.......

Link to comment
Share on other sites

vaise
Just now, vaise said:

Can you help me with a delete statement ?

Delete all records with PlayDuration > 10800

That would be anything over 3 hours.......

Or maybe it should be updated rather than deleted to a reasonable figure - say 1 hour ????  so the actual playback is still there.

Link to comment
Share on other sites

Happy2Play
18 minutes ago, vaise said:

Yep - I was running the beta all the time until this month and have moved to the prod system - and I copied my database across for your thing.

I had hoped going forward it should be good then - but I did the same query for the last 10 days (on prod), it the durations are still bogus :

image.thumb.png.3cdc79ceb8c23e0a3086577ffaa3dfa7.png

If this is caused by the emby prod, maybe its something @luke should be investigating.

.

Little different query but pretty similar.

And would suggest another Roku quirk. 

But with latest query above can say currently everything looks correct on mine.

image.png.fe4f78709e1ad129c6f01e098c47ce6b.png

Link to comment
Share on other sites

TeamB
Posted (edited)

it is very weird, the plugin just monitors the sessions and saved play state like start and stop times when a Playback Session is running, for the times to be so long the session needs to exist for that time, i.e. the playback session is stuck, I have heard of this happening but never been able to reproduce the issue in Emby, I have tried everything from terminating emby clients (killing them in Task Manager etc) to fast pause/play/leaving them in a paused state for hours and hours but the Playback session in the Emby dashboard always shows the correct state for me and thus the Playback reporting the correct times.

I have a few of these weird entries in my system also, I have absolutely no idea how they got there, one movie play session run for 6 hours in my system, that is not true and I dont know why the Emby Session did this.

Yeah you can update the times to say 1 hour to keep item play event in the system.

Edited by TeamB
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...