mirror of
https://github.com/nirvana-7777/script.service.ultimate.git
synced 2026-09-23 17:42:19 +02:00
magentaeu: change epg_manager
This commit is contained in:
@@ -731,6 +731,15 @@ class EPGProgramDetails:
|
||||
plumbing, only meaningful in combination with the provider it came from.
|
||||
"""
|
||||
|
||||
series_id: Optional[str] = None
|
||||
"""
|
||||
Provider-specific series identifier (e.g. 'HRT1-SH4506209'), distinct
|
||||
from program_id which is episode-scoped (e.g.
|
||||
'HRT1-SH4506209-S4E236'). Not part of EPGContent — EPGEntry has no
|
||||
matching field. Useful as a grouping key if detail fetches are ever
|
||||
batched/cached per-series or per-season rather than per-episode.
|
||||
"""
|
||||
|
||||
# Additional metadata
|
||||
genres: Optional[List[str]] = None
|
||||
parental_rating: Optional[int] = None
|
||||
@@ -762,8 +771,10 @@ class EPGProgramDetails:
|
||||
"cast", "directors", "writers", "producers",
|
||||
"presenter", "composers", "contributors",
|
||||
"backdrop", "poster", "imdb_number", "provider_vod_id",
|
||||
"series_id",
|
||||
"genres", "parental_rating",
|
||||
"release_date", "duration",
|
||||
"season_number", "episode_number",
|
||||
"country_of_origin", "trailer",
|
||||
)
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ Design notes
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import json
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple
|
||||
@@ -375,6 +374,20 @@ class MagentaEUEpgManager:
|
||||
except (ValueError, TypeError):
|
||||
parental_rating = None
|
||||
|
||||
# Season / episode number: string-encoded on this endpoint too
|
||||
# (e.g. "1", "41"), same as the grid item. Populating these here
|
||||
# (rather than leaving them None) matters because they're part
|
||||
# of EPGContent's shared field list - merge_content() can use
|
||||
# them to backfill a schedule entry whose own season_number/
|
||||
# episode_number was missing or filtered out as Gracenote
|
||||
# placeholder junk (e.g. "20230000").
|
||||
season_number = self._parse_episode_number(
|
||||
raw.get("season_number"), max_valid=9998
|
||||
)
|
||||
episode_number = self._parse_episode_number(
|
||||
raw.get("episode_number"), max_valid=None
|
||||
)
|
||||
|
||||
return EPGProgramDetails(
|
||||
program_id=program_id,
|
||||
description=description,
|
||||
@@ -390,6 +403,9 @@ class MagentaEUEpgManager:
|
||||
contributors=credit_map.get("contributors"),
|
||||
genres=genres,
|
||||
parental_rating=parental_rating,
|
||||
season_number=season_number,
|
||||
episode_number=episode_number,
|
||||
series_id=raw.get("series_id") or None,
|
||||
duration=raw.get("runtime_seconds"),
|
||||
country_of_origin=raw.get("country_of_origin") or None,
|
||||
trailer=raw.get("trailer") or None,
|
||||
@@ -586,13 +602,6 @@ class MagentaEUEpgManager:
|
||||
f"[{self._country}] Found details for {program_id} "
|
||||
f"using {endpoint} endpoint"
|
||||
)
|
||||
# TEMP DEBUG: dump raw response to confirm season_number/
|
||||
# episode_number key names for /details/program/ before
|
||||
# mapping them in get_program_details(). Remove once confirmed.
|
||||
logger.info(
|
||||
f"[{self._country}] TEMP DEBUG raw /details/program/ response "
|
||||
f"for {program_id}: {json.dumps(details, ensure_ascii=False)}"
|
||||
)
|
||||
return details
|
||||
except Exception as exc:
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user