Files
media_crawler/backend/adapters/emby_adapter.py
renjue 82581d2949 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>
2026-05-09 16:16:18 +08:00

24 lines
665 B
Python

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