Replies: 6 comments
|
I'd love this too! When we have 20 seasons, the latest one is always at the bottom, which is annoying to have to scroll down all the way to the bottom. See South Park, for example also. |
|
You can add your own custom css code to achieve this. #itemDetailPage #childrenCollapsible #childrenContent .childrenItemsContainer.itemsContainer.vertical-list {
flex-direction: column-reverse;
}
#itemDetailPage #childrenCollapsible #childrenContent .childrenItemsContainer.itemsContainer.vertical-wrap {
flex-direction: row-reverse;
flex-wrap: wrap-reverse;
justify-content: start;
}I only made a quick smoke test with these rules active and can't guarantee that no other pages besides the show and seasons views are affected. |
|
The css worked fine for me, but worked on all my libraries. I only wanted to do it for a single library, which was fairly difficult. I don't think you could do library-specific CSS without javascript, and even then, it's not a great solution because some clients don't support JS (like the androidtv app). I settled for redoing the indices of all episodes in the library, relative to the season. I sorted the indices in reverse premier date such that the newest episode has an index of 1. This results in the newest episode being listed first with any ties (two season episodes with same premier date) broken by the title name. Note that this doesn't sort the seasons ordering. Just the episode listing within the season. I didn't have the need to sort seasons against each other so I didn't look at that. Also note that the API key and associated user needs to have admin access (im not sure if its manage server, manage collections, or both, I didn't test since my admin has both). The I used both the rest API via requests and the python API wrapper. I could never get the I've got this setup as a CRON job since I have shows that are periodically updated which requires reordering. I have a flag to check if any updating needs to be done, and if not, it skips the post of the new data. If anything is updated, a library update is called at the end to update the sorting in clients. edit: Using the library's import os
import requests
import json
from jellyfin_apiclient_python import JellyfinClient
from pathlib import Path
# Jellyfin API settings
jellyfin_url = ''
api_key = ''
user_id = ''
library_path = '/path/to/library'
# Set the API headers
headers = {
'api_key': api_key,
'Content-Type': 'application/json'
}
client = JellyfinClient()
client.config.data["auth.ssl"] = False #enable if ssl/https
client.authenticate({"Servers": [{"AccessToken": api_key, "address": jellyfin_url}]}, discover=False)
client.config.data['auth.user_id'] = user_id
refreshLibrary = False
# Function to update the episode metadata
def update_episode_metadata(episode_id, episode_number):
eps = client.jellyfin.get_item(episode_id)
# only update where needed
if eps['IndexNumber'] != episode_number:
eps['IndexNumber'] = episode_number
client.jellyfin.update_item(eps['Id'],eps)
refreshLibrary = True
return None
# Function to sort episodes by release date and title
def sort_episodes(episodes):
sorted_episodes = sorted(episodes, key=lambda x: (x['PremiereDate'], ''.join(filter(str.isalpha, x['Name']))))
return sorted_episodes
def update_episode_numbers(sorted_episodes):
eplist = reversed(sorted_episodes)
for i, episode in enumerate(eplist):
update_episode_metadata(episode['Id'], i+1)
# Function to get the ID of the parent item (season folder)
# ensures correct ID even if two shows have the same
# season name
def get_parent_id(show_name, season_name):
url = f'{jellyfin_url}/Items?api_key={api_key}&Recursive=true&IncludeItemTypes=Season&Fields=Id,Name,ParentId,Path'
response = requests.get(url, headers=headers)
items = response.json()['Items']
for item in items:
# Here we assume that the path setup is /path/to/show/season
showpath = item['Path']
foldern = Path(showpath).parts[-2]
if foldern == show_name:
return item['SeriesId']
return None
# Main function
def main():
# Get the show folders
show_folders = [f for f in os.listdir(library_path) if os.path.isdir(os.path.join(library_path, f))]
for show_folder in show_folders:
# Get the season folders
season_folders = [f for f in os.listdir(os.path.join(library_path, show_folder)) if os.path.isdir(os.path.join(library_path, show_folder, f))]
for season_folder in season_folders:
# Get the ID of the parent item (season folder)
parent_id = get_parent_id(show_folder, season_folder)
if parent_id is not None:
# Get the episode IDs
url = f'{jellyfin_url}/Items?api_key={api_key}&ParentId={parent_id}&Recursive=true&IncludeItemTypes=Episode&Fields=Id,ReleaseDate,Name'
response = requests.get(url, headers=headers)
episodes = response.json()['Items']
# Sort episodes by release date and title
sorted_episodes = sort_episodes(episodes)
# Update episode numbers
update_episode_numbers(sorted_episodes)
if refreshLibrary:
client.jellyfin.refresh_library()
if __name__ =="__main__":
main() |
|
This would be a lifesaver integration with pinchflat, when I care more about most recent than doing things in order, but I also have libraries that make sense ordered the other way too. It would also be nice if I could change the "default" display order at the show level instead of the series level. |
|
This should be a feature request: https://features.jellyfin.org/ |
|
I a found way to achieve this in release order is to set each episode number to its release date in ISO format, YYYYMMDD. Jellyfin kind of just assumes that you don't have episodes and lists "the ones you do have" in order of release. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi, I've been looking for a way to sort seasons and episodes within a TV series by showing the most recent seasons and episodes first instead of the earliest seasons and episodes first.
For example, I have several episodes of PBS NOVA from across several seasons:
Season 51 is the season with the most recent airdate yet it appears last in the list of seasons. I'd like to reverse this sorting so that Season 51 would appear first.
Furthermore, with this "most recent first" sorting enabled, I'd like for the most recent episodes to appear first within the season. Currently, the sorting shows the most recent episodes last.
For example, this is what the current sorting looks like with several episodes of The Daily Show in season 29:
Ideally these would be sorted in reverse order as well.
How could this be achieved? I've found the "display order" option under edit metadata, but the options don't really offer what I'm looking for. When I modify the display order, the season and episode sorting don't seem to be affected. Does anyone have any tips or tricks for this?
Thanks!
All reactions