LoremPizza commited on
Commit
ed4078c
·
verified ·
1 Parent(s): 8757e5e

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +24 -25
run.py CHANGED
@@ -78,31 +78,30 @@ def addon_catalog(type, id):
78
  "description": f"Watch {channel['title']}"
79
  })
80
  return respond_with(catalogs)
81
-
82
- @app.get('/meta/{type}/{id}.json')
83
- def addon_meta(type, id):
84
- if type != "tv":
85
- raise HTTPException(status_code=404)
86
-
87
- for channel in STREAM["channels"]:
88
- if channel["id"] == id:
89
- meta = {
90
- "id": id,
91
- "type": "tv",
92
- "name": channel["title"],
93
- "poster": channel["poster"], # Add poster URL if available
94
- "description": f"Watch {channel['title']}",
95
- "videos": [{
96
- "title": channel["title"],
97
- "streams": [{
98
- "title": channel["title"],
99
- "url": channel["url"]
100
- }]
101
- }]
102
- }
103
- return respond_with({"meta": meta})
104
-
105
- raise HTTPException(status_code=404)
106
 
107
 
108
  @app.get('/stream/{type}/{id}.json')
 
78
  "description": f"Watch {channel['title']}"
79
  })
80
  return respond_with(catalogs)
81
+
82
+ @app.get('/meta/tv/{id}.json')
83
+ def addon_meta(id: str):
84
+ # Find the channel by ID
85
+ channel = next((ch for ch in STREAM['channels'] if ch['id'] == id), None)
86
+
87
+ if not channel:
88
+ raise HTTPException(status_code=404, detail="Channel not found")
89
+
90
+ meta = {
91
+ 'meta': {
92
+ 'id': channel['id'],
93
+ 'type': 'tv',
94
+ 'name': channel['name'],
95
+ 'poster': channel['poster'],
96
+ 'posterShape': 'landscape',
97
+ 'description': channel['title'],
98
+ # Additional fields can be added here
99
+ 'background': channel['poster'], # Example of using the same poster as background
100
+ 'logo': channel['poster'], # Example of using the same poster as logo
101
+ 'url': channel['url'], # Using the stream URL as a website link
102
+ }
103
+ }
104
+ return respond_with(meta)
 
105
 
106
 
107
  @app.get('/stream/{type}/{id}.json')