mirror of
https://github.com/myronblair/kino-app
synced 2026-07-31 21:12:43 -05:00
Codec-aware transcode routing, two-stage queue, request candidate picker, admin reorg
- Requests approval now shows a Radarr/Sonarr candidate picker instead of grabbing the first search result (fixes wrong-title/wrong-year matches) - approve_request reuses an existing Radarr/Sonarr entry instead of erroring when content is already in the library - New codec-check queue (step 1) probes source codecs and skips transcoding entirely for already browser-native files; only non-native content reaches the transcode queue (step 2) - Fixes ffmpeg hard-failing on non-H.264 sources via the h264_mp4toannexb bitstream filter (root cause of the fix-audio-all failures) - Added Codec Check Worker / Transcode Worker to the services health panel with restart - Reorganized the admin page into Pipeline/Utilities dropdowns; added the missing Sonarr Import link - Bumped VERSION 1.0.0 -> 1.1.0
This commit is contained in:
+15
-1
@@ -28,7 +28,11 @@ def search_series(base_url: str, api_key: str, term: str) -> List[Dict]:
|
||||
|
||||
|
||||
def add_series(base_url: str, api_key: str, tvdb_id: int, title: str, year) -> Dict:
|
||||
"""Adds a series by tvdb_id with monitoring + an immediate missing-episode search enabled."""
|
||||
"""Adds a series by tvdb_id with monitoring + an immediate missing-episode search enabled.
|
||||
If the series is already in Sonarr's library (common for older/library titles carried over
|
||||
from a past migration), Sonarr rejects the add with a 400 SeriesExistsValidator — in that
|
||||
case, reuse the existing series and just kick off a missing-episode search instead of
|
||||
surfacing the add as a failure."""
|
||||
base_url = base_url.rstrip("/")
|
||||
h = _h(api_key)
|
||||
profiles = requests.get(f"{base_url}/api/v3/qualityprofile", headers=h, timeout=15).json()
|
||||
@@ -42,6 +46,16 @@ def add_series(base_url: str, api_key: str, tvdb_id: int, title: str, year) -> D
|
||||
"addOptions": {"searchForMissingEpisodes": True, "monitor": "all"},
|
||||
}
|
||||
r = requests.post(f"{base_url}/api/v3/series", json=payload, headers=h, timeout=20)
|
||||
if r.status_code == 400 and any(e.get("errorCode") == "SeriesExistsValidator" for e in (r.json() or [])):
|
||||
existing = requests.get(f"{base_url}/api/v3/series", params={"tvdbId": tvdb_id}, headers=h, timeout=15).json()
|
||||
if not existing:
|
||||
raise RuntimeError("Sonarr reported series already exists but it could not be found")
|
||||
series = existing[0]
|
||||
requests.post(f"{base_url}/api/v3/series/editor", json={
|
||||
"seriesIds": [series["id"]], "monitored": True,
|
||||
}, headers=h, timeout=15)
|
||||
requests.post(f"{base_url}/api/v3/command", json={"name": "SeriesSearch", "seriesId": series["id"]}, headers=h, timeout=15)
|
||||
return {"sonarr_id": series["id"], "title": series.get("title"), "year": series.get("year")}
|
||||
r.raise_for_status()
|
||||
added = r.json()
|
||||
return {"sonarr_id": added["id"], "title": added.get("title"), "year": added.get("year")}
|
||||
|
||||
Reference in New Issue
Block a user