Trickily8214 0 Posted October 8, 2024 Posted October 8, 2024 Hi there, I have a bunch of youtube videos that are in a single folder. Emby scans them fine and imports them. But places them all in "season 1". I would like to show each video in a season named after the year it was published. for example: Season 2024 | - 2024-11-01 - Video 1.mkv | - 2024-10-01 - Video 2.mkv Season 2023 | - 2023-08-01 - Video 3.mkv | - 2023-05-01 - Video 4.mkv Season 2022 | - 2022-03-01 - Video 5.mkv | - 2022-01-01 - Video 6.mkv I'm unable to change the folder structure of the video files themselves, so I have written some python code that loops through the shows and episodes and updates the metadata. But I'm stuck at creating an Item to represent the season folder under a show. I cant seem to find a create endpoint for items? (there is an update, which works great for updating existing items) What end point do I use to create season folders under a tv show? Thanks!
Luke 42077 Posted October 8, 2024 Posted October 8, 2024 Hi, I would just use the metadata editor to edit the season number for each episode.
Trickily8214 0 Posted October 9, 2024 Author Posted October 9, 2024 (edited) Hi Luke, Thanks for the reply. That was my initial thought too. I tried copying the interface's API calls I noticed there is no "SeasonNumber" in the JSON request. But the value does seem to go into the "ParentIndexNumber" in the request. After setting the "ParentIndexNumber" to the "ProductionYear" the videos seem to remain in their seasons and the "SeasonNumber" has changed but they seem to stay in the "Season 1" folder. Seems like the update doesn't take? The part of my code doing the update: for episode in requests.get(f'{server_url}/Shows/{show["Id"]}/Episodes?SeasonId={season["Id"]}&api_key={key}', verify=verify_ssl).json()['Items']: print(f'\t\tChecking: {episode["Name"]} with id of \'{episode["Id"]}\'') episode_edit = requests.get(f'{server_url}/Users/{user_id}/Items/{episode["Id"]}??Fields=ChannelMappingInfo&ExcludeFields=Chapters,MediaSources,MediaStreams,Subviews&api_key={key}', verify=verify_ssl).json() episode_edit["ParentIndexNumber"] = episode_edit["ProductionYear"] print(f'\t\tSaving...') episode_update = requests.post(f'{server_url}/Items/{episode["Id"]}?api_key={key}', json=episode_edit, verify=verify_ssl) Any thoughts on what I'm doing wrong? Edited October 9, 2024 by Trickily8214
Luke 42077 Posted October 10, 2024 Posted October 10, 2024 You may also need to set the IndexNumber on the parent season, if that's not set or incorrect.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now