Jellyfin Forum
Help Needed: Extracting Size and Resolution of Movies from Jellyfin API - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Development (https://forum.jellyfin.org/f-development)
+--- Forum: Client Development (https://forum.jellyfin.org/f-client-development)
+--- Thread: Help Needed: Extracting Size and Resolution of Movies from Jellyfin API (/t-help-needed-extracting-size-and-resolution-of-movies-from-jellyfin-api)



Help Needed: Extracting Size and Resolution of Movies from Jellyfin API - BoBBer446 - 2024-04-01

Hello everyone,

I've been working on a Python script to find and manage duplicate movies in my Jellyfin media server. The script's goal is to identify duplicates based on movie names, then sort them by size and resolution to help decide which duplicates to keep or delete. However, I've hit a snag with extracting accurate size and resolution data for each movie.

Here's what I've attempted:

1. Fetching All Media Items: I used the /Items?IncludeItemTypes=Movie&Recursive=true endpoint to get a list of all movies. This part works fine, and I can retrieve basic information about each movie.

2. Extracting Size and Resolution: To get detailed information about each movie, including its size and resolution, I tried using the /Items/{itemId}/PlaybackInfo endpoint, expecting it to return the necessary data. Here's a simplified version of my approach:

python
def get_media_playback_info(self, item_id):
    url = f"{self.base_url}/Items/{item_id}/PlaybackInfo"
    response = requests.get(url, headers=self.headers)
    return response.json()


From this, I aimed to extract the Size and Resolution for sorting purposes. Unfortunately, the API response does not seem to include the data in the format or location I expected. Instead of receiving actual size and resolution values, I'm getting zeros or placeholder texts like "Unbekannter Pfad" for the path, which means "Unknown path" in German.

3. Attempts at Solutions: I've thoroughly checked the API documentation and tried different endpoints that might offer the needed details, such as /Environment/NetworkShares and /Items/{itemId}/PlaybackInfo, but to no avail. My attempts either result in incomplete data or do not directly address my needs for size and resolution.

I'm reaching out for help in this forum because I believe there might be something I'm overlooking or misinterpreting in the Jellyfin API responses. Has anyone successfully extracted movie file sizes and resolutions using the Jellyfin API? If so, could you share how you achieved it? Examples or snippets of your approach would be immensely helpful.

Additionally, if there are alternative methods or endpoints I should consider, please let me know. My primary goal is to accurately identify duplicates by comparing their file size and resolution, making the management of my media library more efficient.

Thank you in advance for any assistance or insights you can provide!


RE: Help Needed: Extracting Size and Resolution of Movies from Jellyfin API - BoBBer446 - 2024-04-01

Ich habe es rausgefunden.

Wer Interesse hat darf es gerne Verwenden, kopieren und verbessern:
https://github.com/BoBBer446/jellyfin_duplicates_finder/


RE: Help Needed: Extracting Size and Resolution of Movies from Jellyfin API - mcarlton00 - 2024-04-01

Easiest way is likely going to be to add &fields=Height,Width to your /Items request