diff --git a/lib/streaming_providers/base/models/epg_models.py b/lib/streaming_providers/base/models/epg_models.py index 5a0ba11..5d35d8c 100644 --- a/lib/streaming_providers/base/models/epg_models.py +++ b/lib/streaming_providers/base/models/epg_models.py @@ -140,6 +140,23 @@ class EPGEntry: program_id: Optional[str] = None + epg_event_id: Optional[str] = None + """ + Provider-native LISTING guid (e.g. "das_erste_hd_031eace5" for Magenta2) — + distinct from program_id, which holds the PROGRAM guid (e.g. + "telekom.de-031eace5"). These are two different identifiers on the + upstream API: the listing guid identifies a specific broadcast slot on a + specific channel/time, while the program guid identifies the underlying + content regardless of when/where it airs. + + This is the identifier required to schedule an nPVR recording (passed to + the client as part of the EPG entry, cached client-side against + broadcast_id, and sent back as "epg_event_id" when the user creates a + timer for this broadcast). Populate it whenever the upstream provider + exposes a listing-level guid separate from the program guid; leave as + None for providers where no such distinction exists. + """ + # Optional fields - Program Information description: Optional[str] = None """Full program description/plot. C++ expects 'description' key.""" diff --git a/lib/streaming_providers/providers/magenta2/epg_manager.py b/lib/streaming_providers/providers/magenta2/epg_manager.py index eb0e286..cac0922 100644 --- a/lib/streaming_providers/providers/magenta2/epg_manager.py +++ b/lib/streaming_providers/providers/magenta2/epg_manager.py @@ -613,6 +613,10 @@ class Magenta2EpgManager: program: Dict[str, Any], ) -> Optional[EPGEntry]: program_guid = program.get("guid", "") + # The listing's OWN guid - distinct from program_guid above. This is + # what the nPVR API needs to schedule a recording for this specific + # broadcast slot (see EPGEntry.epg_event_id docstring). + listing_guid = item.get("guid") or None title = program.get("title", "Unknown") broadcast_id = EPGEntry.encode_broadcast_id("magenta2", channel_id, start) @@ -664,6 +668,7 @@ class Magenta2EpgManager: start=start, end=end, program_id=program_guid, + epg_event_id=listing_guid, description=description, plot_outline=None, episode_name=episode_name,