• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Saving a Person's Info Locally

     
    • 0 Vote(s) - 0 Average

    Saving a Person's Info Locally

    How to save and load info about cast offline
    PriestMarmore
    Offline

    Junior Member

    Posts: 2
    Threads: 2
    Joined: 2023 Aug
    Reputation: 0
    #1
    2024-05-25, 09:11 PM
    I only have my stuff offline and I know there are plugins for getting information about the actors (but it's not for Hollywood actors if you know what I mean). 

     Here's my first problem. I know there are folders for each person and when I move a photo to someone's folder, and that photo is named "folder", the Primary photo of that actor will change, however if I do the same with a photo named backdrop, it will not change on jellyfin. Why is that? Do I really need to upload it through jellyfin.

     Secondly, I thought about creating a program that would read a folder and that folder contained 3 things: a Primary photo, a Backdrop and a .txt file with info about the person. I wanted that program to change the info of the actor in question based on what was there on the folder. Does that exist? Is there any way I can have information on a .txt file or a .nfo and I'm able to run a program that updates that information about the actor in question?

     I wrote a bit of code, I'll leave bellow, but it's not working. This is only for the information, I didn't touch on the photos yet

    import os
    import requests
    import json
    # Jellyfin server details
    jellyfin_url = 'http://localhost:8096'
    api_key = ''
    # Function to read person info from the info.txt file
    def read_person_info_from_file(file_path):
        person_info = {}
        with open(file_path, 'r', encoding='utf-8') as f:
            lines = f.readlines()
            for line in lines:
                if ':' in line:
                    key, value = line.split(':', 1)
                    person_info[key.strip()] = value.strip()
        return person_info
    # Function to update person information
    def update_person_info(person_id, new_info):
        headers = {
            'X-Emby-Token': api_key,
            'Content-Type': 'application/json'
        }
        url = f'{jellyfin_url}/Items/{person_id}'
        response = requests.post(url, headers=headers, data=json.dumps(new_info))
        print(f'Updating person info at {url} with data: {json.dumps(new_info, indent=2)}')
        print(f'Response: {response.status_code} - {response.text}')
        if response.status_code == 204:
            print('Person information updated successfully.')
        else:
            print(f'Failed to update person information: {response.status_code} - {response.text}')
    # Example usage
    folder_path = r'D:\Quick Access\Downloads\jelly'
    info_file_path = os.path.join(folder_path, 'info.txt')
    person_id = ''  # Tom Cruise's person ID
    person_info = read_person_info_from_file(info_file_path)
    # Prepare person info payload
    update_info = {
        "Name": person_info.get("Name"),
        "Overview": person_info.get("Overview"),
        "PremiereDate": person_info.get("BirthDate"),
        "ProductionYear": int(person_info.get("BirthDate")[:4]),  # Assuming the birth year is the production year
        "Type": "Person"
    }
    update_person_info(person_id, update_info)
    HERIGROSIR
    Offline

    Junior Member

    Posts: 20
    Threads: 6
    Joined: 2024 Jun
    Reputation: 0
    Country:Indonesia
    #2
    2024-07-13, 05:04 AM (This post was last modified: 2024-07-19, 09:47 PM by Efficient_Good_5784. Edited 1 time in total.)
    The solution you are waiting for is here, at the bottom of the information
    https://forum.jellyfin.org/t-feature-requests
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode