mirror of
https://github.com/nirvana-7777/script.service.ultimate.git
synced 2026-09-25 02:22:44 +02:00
restructure epg
This commit is contained in:
@@ -266,6 +266,13 @@ def setup_epg_routes(app, manager, service):
|
||||
country=country,
|
||||
)
|
||||
|
||||
# Serialize EPGEntry objects to dicts here, at the response
|
||||
# boundary — epg_ops returns EPGEntry objects (not JSON-safe).
|
||||
grid_data = {
|
||||
cid: [entry.to_dict() for entry in entries]
|
||||
for cid, entries in grid_data.items()
|
||||
}
|
||||
|
||||
response.content_type = "application/json; charset=utf-8"
|
||||
return {
|
||||
"provider": provider,
|
||||
@@ -321,6 +328,10 @@ def setup_epg_routes(app, manager, service):
|
||||
country=country,
|
||||
)
|
||||
|
||||
# Serialize EPGEntry objects to dicts here, at the response
|
||||
# boundary — epg_ops returns EPGEntry objects (not JSON-safe).
|
||||
programs = [entry.to_dict() for entry in programs]
|
||||
|
||||
response.content_type = "application/json; charset=utf-8"
|
||||
return {
|
||||
"provider": provider,
|
||||
@@ -364,6 +375,13 @@ def setup_epg_routes(app, manager, service):
|
||||
response.content_type = "application/json; charset=utf-8"
|
||||
return {"error": f"Program '{program_id}' not found for provider '{provider}'"}
|
||||
|
||||
# Serialize EPGEntry objects to dicts here, at the response
|
||||
# boundary — epg_ops returns EPGEntry objects (not JSON-safe)
|
||||
# on the native path. The generic fallback path can return a
|
||||
# plain dict, so only convert if it's actually an EPGEntry.
|
||||
if hasattr(program_data, "to_dict"):
|
||||
program_data = program_data.to_dict()
|
||||
|
||||
response.content_type = "application/json; charset=utf-8"
|
||||
return {
|
||||
"provider": provider,
|
||||
|
||||
Reference in New Issue
Block a user