Tautulli
Tautulli copied to clipboard
Library Media Stats
Description
This PR adds the total media runtime
and total file size
as indicators to several sections of the library.
The table header of the Media Info section of the library now directly displays those indicators.
If Calculate Total File Size
is enabled in the config the duration aka. runtime is now included for each item. This column, like the other ones, an be shown/hidden.
The Libraries overview also includes those as fields in two new configurable columns.
For this a new method get_library_media_stats
got added to the API which returns the total size, the total duration aka. runtime and total storage of a library.
This data gets cached into a new file media_stats_<section_id>
to allow for faster loading times. For this the caching methods for saving and loading have been rebuild to a generic version.
After first updating to this version, when enabled in the config, the file size and duration will be recalculated and saved to the cache for the items.
The API documentation got updated.
Issues Fixed or Closed
- Implements #2141.
Type of Change
- [x] New feature (non-breaking change which adds functionality)
Checklist
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated the docstring for new or existing methods
My idea was to decouple the media info from the total. We can get the total directly from Plex without adding up all the individual items. This means the total can be shown regardless of the file sizes setting.
Refer to the Plex API library here:
https://github.com/pkkid/python-plexapi/blob/a3af807c6bb2f4bb5a150f4ddff05314a30093db/plexapi/library.py#L462C17-L462C17
This also opens up the option to add the totals to columns on the Libraries table (cache to database library_sections
on libraries list refresh).
My idea was to decouple the media info from the total. We can get the total directly from Plex without adding up all the individual items. This means the total can be shown regardless of the file sizes setting.
Refer to the Plex API library here:
https://github.com/pkkid/python-plexapi/blob/a3af807c6bb2f4bb5a150f4ddff05314a30093db/plexapi/library.py#L462C17-L462C17
Interesting. This would save both on loading time and also on complexity, but would mean to replace the calculation logic entirely. It would also allow to make a new call which can be used internally for the total, but also provided via the API.
I will start working on that, but keep the visual changes so far made as those still seem fitting to me.
Since when is this call supported by Plex? Do we need to check for a special plex server version.
This also opens up the option to add the totals to columns on the Libraries table (cache to database
library_sections
on libraries list refresh).
Good call👍
Since when is this call supported by Plex? Do we need to check for a special plex server version.
Over 3 years when Plex Dash was released.
Might need to verify that the API endpoint isn't Plex Pass only because Plex Dash is Plex Pass only. I don't think it is.
Ready for review. I updated the main message to reflect the new changes.
I also decided to keep the addition of the duration in the file size calculation per item as it seems like a logical addition and doesn't increase the runtime as no additional call is made. The fields containing the total indicators use the new call including caching.
Did you verify if the calls for the properties are Plex Pass only? Does the python-plexapi include a field or indication for premium required functions/calls, if not this would seem like a good addition.
I dont know if this is a bug or not. But i wanted to sort out which of my movies that have been watched. If i choose a movie that i know have been seen by me and others the all time watch time is 0. Why is that? I installed Tautulli using the simple way with the EXE file. Is there anything else that i need? Will it only count from the day that i installed Tautulli?
I dont know if this is a bug or not. But i wanted to sort out which of my movies that have been watched. If i choose a movie that i know have been seen by me and others the all time watch time is 0. Why is that? I installed Tautulli using the simple way with the EXE file. Is there anything else that i need?
Please use the issue section of github to report a problem or ask for support in the future (https://github.com/Tautulli/Tautulli/issues) as this discussion is only regarding the content of the PR.
Will it only count from the day that i installed Tautulli?
Yes as Tautulli tracks informations far more detailed then Plex does and so needs to run to gather this data.
This PR is stale because it has been open for 30 days with no activity. Remove the stale label or comment, otherwise this will be closed in 5 days.
This PR was closed because it has been stalled for 5 days with no activity.
@JonnyWong16 Still ready for review. Any timeframe the review will be done?
I will get to this soon. I've been busy.