Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ jobs:
server:
- {name: "Jellyfin 10.10", kind: jellyfin, image: "jellyfin/jellyfin:10.10.7"}
- {name: "Jellyfin 10.11", kind: jellyfin, image: "jellyfin/jellyfin:10.11.11"}
- {name: "Jellyfin 12.2", kind: jellyfin, image: "jellyfin/jellyfin:12.2"}
- {name: "Jellyfin 12.4", kind: jellyfin, image: "jellyfin/jellyfin:12.4"}
- {name: "Emby 4.9", kind: emby, image: "emby/embyserver:4.9.5.0"}
- {name: "Emby 4.10", kind: emby, image: "emby/embyserver:4.10.1.0"}
- {name: "Emby 4.10", kind: emby, image: "emby/embyserver:4.10.2.0"}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
fail-fast: false
matrix:
silo:
- {name: "build 1144", image: "ghcr.io/silo-server/silo-server:build-1144"}
- {name: "build 2519", image: "ghcr.io/silo-server/silo-server:build-2519"}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down
19 changes: 16 additions & 3 deletions cinesets/servers/silo.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,19 @@ def problem(cls, r):
body = None
silo = isinstance(body, dict) # Silo answers with problem JSON; anything else is from something in front of it
detail = (str(body.get("detail") or body.get("title") or "") if silo else r.text)[:200]
# A refused field only says "see errors" in detail, and the reason is in errors[].detail: since November 2026
# (Silo-Server/silo-server#3933) that includes a collection name another one in the library has, case aside
reasons = [str(e.get("detail") or "") for e in (body.get("errors") or []) if isinstance(e, dict)] if silo else []
if any(reasons):
detail += " (" + "; ".join(x for x in reasons if x)[:200] + ")"
if r.status_code == 401:
detail += (f" (Silo did not accept the API key: make one under {cls.KEY_PAGE} that belongs to an "
"administrator and has no scopes, and put it in server.api_key)")
elif r.status_code == 403:
detail += (" (CineSets needs an API key that belongs to an administrator and has no scopes: make one under "
f"{cls.KEY_PAGE} in Silo and put it in server.api_key)")
elif r.status_code == 409 and "section" in detail.lower():
detail += " (take the collection out of that Home or library section in Silo first, then run CineSets again)"
elif r.status_code == 404 and not silo:
detail = ("(nothing answered there, so server.url is probably not Silo's own address: use the one its web "
"app opens on, not its Jellyfin-compatible port)")
Expand Down Expand Up @@ -237,13 +244,19 @@ def library_items(self, folder, kind, name):
typ = "movie" if kind == "movie" else "series"
cards = self.pages(f"/catalog?library_id={quote(folder)}&type={typ}&sort=title&skip_total=true"
f"&image_size=small&limit={PAGE}", headers=self.profile())
out, seen = [], set()
out, seen, carded = [], set(), set()
for c in cards:
cid = c.get("content_id")
if not cid or cid in seen:
continue
seen.add(cid)
out.append({"id": cid, "name": c.get("title"), "year": c.get("year"), "ids": content_ids(cid),
# Silo builds from 6 November 2026 (Silo-Server/silo-server#3618) put the title's provider ids on its card,
# the same ones its item details give, so a show needs no lookup and a film known by its IMDb id learns
# its TMDB one. Older builds leave them off, and their shows are looked up as before.
card = {k: v for k in ("tmdb", "imdb", "tvdb") for v in [provider_id(c.get(f"{k}_id"))] if v}
if card:
carded.add(cid)
out.append({"id": cid, "name": c.get("title"), "year": c.get("year"), "ids": {**card, **content_ids(cid)},
"backdrop": bool(c.get("backdrop_url") or c.get("backdrop_thumbhash")),
"poster": bool(c.get("poster_url") or c.get("poster_thumbhash")),
"genres": c.get("genres") or []})
Expand All @@ -253,7 +266,7 @@ def library_items(self, folder, kind, name):
self._where.setdefault(it["id"], []).append(folder)
save_json(self.where_file, self._where)
if kind == "show":
self.add_show_ids(out, name)
self.add_show_ids([it for it in out if it["id"] not in carded], name)
return out

def where(self):
Expand Down
2 changes: 1 addition & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Back to the [README](../README.md).
Running more than one server? Give each its own install: its own folder, `config.yml`, `data/` and schedule. They
share nothing, so one can't affect another, and each install only loads the code for its own server.

Every change is tested against real Emby 4.9 and 4.10, Jellyfin 10.10, 10.11 and 12.2, and a pinned Silo build,
Every change is tested against real Emby 4.9 and 4.10, Jellyfin 10.10, 10.11 and 12.4, and a pinned Silo build,
and each week against the newest release of each. Emby is fully supported; Jellyfin and Silo are beta until more
people have run them. Plex is next.

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/run_silo_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
folder names, and .nfo files give them genres, their other ids and artwork, so nothing depends on online lookups),
then runs `cinesets setup` as a new user would, given Silo's Jellyfin-compatible port. Then it checks that CineSets
creates manual library collections matched by IMDb, TMDb and TVDB ids (one with a genre left out, one matched by a
show's IMDb id, which only Silo's item details have), with the right titles, libraries, description, display order,
show's IMDb id, which older Silo builds give only in item details), with the right titles, libraries, description, display order,
page order and poster. It shrinks and renames them, changes nothing on a repeat run, takes them back with adopt
after losing its record, refuses to touch a collection it did not create and removes only its own.
"""
Expand Down
31 changes: 30 additions & 1 deletion tests/test_silo.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(self):
self.rate_limit = 0
self.not_admin = False
self.no_poster = {"movie-imdb-tt0133093"} # a title Silo has no poster for
self.card_ids = False # builds from 6 November 2026 put provider ids on catalog cards

def add_collection(self, title, lib, kind="manual"):
cid = str(self.next_id)
Expand Down Expand Up @@ -139,7 +140,8 @@ def request(self, method, url, timeout=None, allow_redirects=True, headers=None,
assert headers.get("X-Profile-Id") == "77", "the catalogue needs the profile header"
typ = "movie" if q["type"] == "movie" else "series"
rows = [{"content_id": cid, "type": typ, "title": it["title"], "year": it["year"], "genres": it["genres"],
"backdrop_thumbhash": "x", **({"poster_thumbhash": "p"} if cid not in self.no_poster else {})}
"backdrop_thumbhash": "x", **({"poster_thumbhash": "p"} if cid not in self.no_poster else {}),
**(it["ids"] if self.card_ids else {})}
for cid, it in self.items.items() if it["lib"] == q["library_id"] and cid.startswith(typ)]
return Resp(data=self.page(rows, q))
if parts[:2] == ["catalog", "items"]:
Expand Down Expand Up @@ -322,6 +324,33 @@ def test_show_ids_are_looked_up_once(silo_run):
assert "Concerts" not in json.dumps(silo_run.fake.calls)


def test_newer_silo_gives_the_ids_on_its_cards(silo_run):
"""Silo builds from 6 November 2026 put provider ids on catalog cards: no show is looked up, and a film Silo knows
by its IMDb id also matches by its TMDB one."""
fake = silo_run.fake
fake.card_ids = True
fake.items["movie-imdb-tt0133093"]["ids"] = {"tmdb_id": "603", "imdb_id": "tt0133093"}
cfg, srv, eng = silo_run()
index = eng.build_index()
assert not [c for c in fake.calls if c[1].startswith("/catalog/items/")]
assert index["show"]["imdb"]["tt0944947"] == "series-tvdb-121361"
assert index["show"]["tmdb"]["1399"] == "series-tvdb-121361" # 1399-game-of-thrones, kept as the number
assert index["show"]["tvdb"]["305288"] == "series-tvdb-305288"
assert index["movie"]["tmdb"]["603"] == "movie-imdb-tt0133093" # never known before cards had ids


def test_silo_says_why_it_refused(silo_run):
"""A refused field's reason is only in errors[].detail, and a collection a section uses can't be deleted."""
cfg, srv, eng = silo_run()
clash = Resp(422, {"title": "Unprocessable Entity", "detail": "The request did not pass validation; see errors.",
"errors": [{"detail": "A collection named movies - marvel already exists in this library",
"location": "body.title"}]})
assert "already exists in this library" in srv.problem(clash)
in_use = Resp(409, {"title": "Conflict", "detail": "The collection is used by a section"})
assert "take the collection out of that Home or library section" in srv.problem(in_use)
assert srv.problem(Resp(409, {"title": "Conflict", "detail": "Not a manual collection"})) == "Not a manual collection"


def test_titles_silo_no_longer_has_are_skipped(silo_run, capsys):
cfg, srv, eng = silo_run()
eng.get_index()
Expand Down
Loading