LoremPizza commited on
Commit
37fd022
·
verified ·
1 Parent(s): 6ada024

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +15 -12
run.py CHANGED
@@ -11,7 +11,7 @@ import logging
11
  from okru import okru_get_url
12
  from animeworld import animeworld
13
  from dictionaries import okru,STREAM,extra_sources,webru_vary,webru_dlhd
14
- from epg import tivu, tivu_get
15
  from webru import webru
16
  import httpx
17
  # Configure logging
@@ -85,14 +85,8 @@ async def addon_catalog(type: str, id: str, genre: str = None):
85
  for channel in STREAM["channels"]:
86
  if genre and genre not in channel.get("genres", []):
87
  continue # Skip channels that don't match the selected genre
88
- if channel["id"] in tivu:
89
- print("WOW")
90
- print(channel['id'])
91
- description = await tivu_get(channel["id"])
92
- if description == None:
93
- description = f'Watch {channel["title"]}'
94
- else:
95
- description = f'Watch {channel["title"]}'
96
  catalogs["metas"].append({
97
  "id": channel["id"],
98
  "type": "tv",
@@ -114,13 +108,20 @@ async def first_catalog(type: str, id: str, genre: str = None):
114
  return respond_with(catalogs)
115
 
116
  @app.get('/meta/tv/{id}.json')
117
- def addon_meta(id: str):
118
  # Find the channel by ID
119
  channel = next((ch for ch in STREAM['channels'] if ch['id'] == id), None)
120
 
121
  if not channel:
122
  raise HTTPException(status_code=404, detail="Channel not found")
123
-
 
 
 
 
 
 
 
124
  meta = {
125
  'meta': {
126
  'id': channel['id'],
@@ -128,7 +129,7 @@ def addon_meta(id: str):
128
  'name': channel['name'],
129
  'poster': channel['poster'],
130
  'posterShape': 'landscape',
131
- 'description': channel['title'],
132
  # Additional fields can be added here
133
  'background': channel['poster'], # Example of using the same poster as background
134
  'logo': channel['poster'],
@@ -144,6 +145,8 @@ def addon_meta(id: str):
144
  async def addon_stream(type, id):
145
  if type not in MANIFEST['types']:
146
  raise HTTPException(status_code=404)
 
 
147
  streams = {'streams': []}
148
  async with httpx.AsyncClient() as client:
149
  if type == "tv":
 
11
  from okru import okru_get_url
12
  from animeworld import animeworld
13
  from dictionaries import okru,STREAM,extra_sources,webru_vary,webru_dlhd
14
+ from epg import epg_guide, convert_bho_1,convert_bho_2
15
  from webru import webru
16
  import httpx
17
  # Configure logging
 
85
  for channel in STREAM["channels"]:
86
  if genre and genre not in channel.get("genres", []):
87
  continue # Skip channels that don't match the selected genre
88
+
89
+ description = f'Watch {channel["title"]}'
 
 
 
 
 
 
90
  catalogs["metas"].append({
91
  "id": channel["id"],
92
  "type": "tv",
 
108
  return respond_with(catalogs)
109
 
110
  @app.get('/meta/tv/{id}.json')
111
+ async def addon_meta(id: str):
112
  # Find the channel by ID
113
  channel = next((ch for ch in STREAM['channels'] if ch['id'] == id), None)
114
 
115
  if not channel:
116
  raise HTTPException(status_code=404, detail="Channel not found")
117
+ async with httpx.AsyncClient() as client:
118
+ if channel["id"] in convert_bho_1 or convert_bho_2:
119
+ print(channel['id'])
120
+ description,title = await epg_guide(channel["id"],client)
121
+ if description == None:
122
+ description = f'Watch {channel["title"]}'
123
+ else:
124
+ description = f'Watch {channel["title"]}'
125
  meta = {
126
  'meta': {
127
  'id': channel['id'],
 
129
  'name': channel['name'],
130
  'poster': channel['poster'],
131
  'posterShape': 'landscape',
132
+ 'description': title + "\n" + description,
133
  # Additional fields can be added here
134
  'background': channel['poster'], # Example of using the same poster as background
135
  'logo': channel['poster'],
 
145
  async def addon_stream(type, id):
146
  if type not in MANIFEST['types']:
147
  raise HTTPException(status_code=404)
148
+ if "https" or "http" in id:
149
+ raise HTTPException(status_code=404)
150
  streams = {'streams': []}
151
  async with httpx.AsyncClient() as client:
152
  if type == "tv":