Add planning to shows and movies in one merged grid

This commit is contained in:
SirBlob committed 2026-11-01 22:12:39 -05:00
1 parent cd9a8a186a
commit d473aebb79
9 files changed
+56 -41

No files matched your search

+3 -2
View File
@@ -6,7 +6,8 @@ MEDIA_KINDS = {
"show": {"key": "shows", "label": "TV show", "omdb_type": "series"},
"movie": {"key": "movies", "label": "movie", "omdb_type": "movie"},
}
STATUSES = ["watched", "watching"]
STATUSES = ["watched", "watching", "planning"]
STATUS_ORDER = {"watching": 0, "watched": 1, "planning": 2}
def check_rating(rating: int | None) -> int | None:
@@ -33,7 +34,7 @@ def status_of(item: dict) -> str:
def list_items(kind: str) -> list[dict]:
_, items = load_items(kind)
rating = lambda item: item["rating"] if item.get("rating") is not None else -1
return sorted(items, key=lambda item: (status_of(item) != "watching", -rating(item)))
return sorted(items, key=lambda item: (STATUS_ORDER[status_of(item)], -rating(item)))
def collection_names(kind: str) -> list[str]: