Implement full media crawler workflow with Flask backend and Vue frontend.
Add TMDB search and media detail pages, HDHive resource ingestion flow, unified error handling, Docker single-container runtime, and project docs/config updates for local deployment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
23
backend/adapters/emby_adapter.py
Normal file
23
backend/adapters/emby_adapter.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from config import Config
|
||||
from http_client import request_json
|
||||
|
||||
|
||||
def _headers():
|
||||
headers = {"Content-Type": "application/json"}
|
||||
if Config.EMBY_TOKEN:
|
||||
headers["X-Emby-Token"] = Config.EMBY_TOKEN
|
||||
return headers
|
||||
|
||||
|
||||
def exists_by_tmdb_id(tmdb_id):
|
||||
url = f"{Config.EMBY_BASE_URL}/Items?AnyProviderIdEquals=Tmdb.{tmdb_id}&Recursive=true&Limit=1"
|
||||
result = request_json(
|
||||
url,
|
||||
headers=_headers(),
|
||||
max_retry=Config.MAX_RETRY,
|
||||
retry_delay_ms=Config.RETRY_DELAY_MS,
|
||||
provider="emby",
|
||||
)
|
||||
total = ((result.get("data") or {}).get("TotalRecordCount")) or 0
|
||||
result["exists"] = total > 0
|
||||
return result
|
||||
Reference in New Issue
Block a user