Fixed Support for Web Version for Live TV

This commit is contained in:
UrloMythus
2024-08-27 15:11:03 +02:00 Unverified
parent d4984e71d3
commit 4342cbbf8b
+20 -23
View File
@@ -80,32 +80,29 @@ def addon_catalog(type, id):
return respond_with(catalogs) return respond_with(catalogs)
@app.get('/meta/{type}/{id}.json') @app.get('/meta/tv/{id}.json')
def addon_meta(type, id): def addon_meta(id: str):
if type != "tv": # Find the channel by ID
raise HTTPException(status_code=404) channel = next((ch for ch in STREAM['channels'] if ch['id'] == id), None)
if not channel:
raise HTTPException(status_code=404, detail="Channel not found")
for channel in STREAM["channels"]:
if channel["id"] == id:
meta = { meta = {
"id": id, 'meta': {
"type": "tv", 'id': channel['id'],
"name": channel["title"], 'type': 'tv',
"poster": channel["poster"], # Add poster URL if available 'name': channel['name'],
"description": f"Watch {channel['title']}", 'poster': channel['poster'],
"background": "", # Add background image URL if available 'posterShape': 'landscape',
"logo": "", # Add logo URL if available 'description': channel['title'],
"videos": [{ # Additional fields can be added here
"title": channel["title"], 'background': channel['poster'], # Example of using the same poster as background
"streams": [{ 'logo': channel['poster'], # Example of using the same poster as logo
"title": channel["title"], 'url': channel['url'], # Using the stream URL as a website link
"url": channel["url"]
}]
}]
} }
return respond_with({"meta": meta}) }
return respond_with(meta)
raise HTTPException(status_code=404)
@app.get('/stream/{type}/{id}.json') @app.get('/stream/{type}/{id}.json')