Added async support
This commit is contained in:
@@ -104,80 +104,81 @@ def addon_meta(type, id):
|
||||
}
|
||||
return respond_with({"meta": meta})
|
||||
|
||||
abort(404)
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
|
||||
@app.get('/stream/{type}/{id}.json')
|
||||
def addon_stream(type, id):
|
||||
async def addon_stream(type, id):
|
||||
if type not in MANIFEST['types']:
|
||||
raise HTTPException(status_code=404)
|
||||
streams = {'streams': []}
|
||||
if type == "tv":
|
||||
for channel in STREAM["channels"]:
|
||||
if channel["id"] == id:
|
||||
streams['streams'].append({
|
||||
'title': channel['name'],
|
||||
'url': channel['url']
|
||||
})
|
||||
if id in okru:
|
||||
channel_url = okru_get_url(id)
|
||||
async with httpx.AsyncClient() as client:
|
||||
if type == "tv":
|
||||
for channel in STREAM["channels"]:
|
||||
if channel["id"] == id:
|
||||
streams['streams'].append({
|
||||
'title': channel['name'] + "OKRU",
|
||||
'url': channel_url
|
||||
})
|
||||
if not streams['streams']:
|
||||
raise HTTPException(status_code=404)
|
||||
return respond_with(streams)
|
||||
else:
|
||||
logging.debug(f"Handling movie or series: {id}")
|
||||
if "kitsu" in id:
|
||||
if ANIMEWORLD == "1":
|
||||
animeworld_urls = animeworld(id)
|
||||
print(animeworld_urls)
|
||||
if animeworld_urls:
|
||||
i = 0
|
||||
for url in animeworld_urls:
|
||||
if url:
|
||||
if i == 0:
|
||||
title = "Original"
|
||||
elif i == 1:
|
||||
title = "Italian"
|
||||
streams['streams'].append({'title': f'{HF}Animeworld {title}', 'url': url})
|
||||
i+=1
|
||||
'title': channel['name'],
|
||||
'url': channel['url']
|
||||
})
|
||||
if id in okru:
|
||||
channel_url = await okru_get_url(id,client)
|
||||
streams['streams'].append({
|
||||
'title': channel['name'] + "OKRU",
|
||||
'url': channel_url
|
||||
})
|
||||
if not streams['streams']:
|
||||
raise HTTPException(status_code=404)
|
||||
return respond_with(streams)
|
||||
else:
|
||||
if MYSTERIUS == "1":
|
||||
results = cool(id)
|
||||
if results:
|
||||
for resolution, link in results.items():
|
||||
streams['streams'].append({'title': f'{HF}Mysterious {resolution}', 'url': link})
|
||||
if STREAMINGCOMMUNITY == "1":
|
||||
url_streaming_community,url_720_streaming_community,quality_sc = streaming_community(id)
|
||||
if url_streaming_community is not None:
|
||||
if quality_sc == "1080":
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 1080p Max', 'url': url_streaming_community})
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_720_streaming_community})
|
||||
else:
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_streaming_community})
|
||||
if LORDCHANNEL == "1":
|
||||
url_lordchannel,quality_lordchannel =lordchannel(id)
|
||||
if quality_lordchannel == "FULL HD" and url_lordchannel != None:
|
||||
streams['streams'].append({'title': f'{HF}LordChannel 1080p', 'url': url_lordchannel})
|
||||
elif url_lordchannel != None:
|
||||
streams['streams'].append({'title': f'{HF}LordChannel 720p', 'url': url_lordchannel})
|
||||
if FILMPERTUTTI == "1":
|
||||
url_filmpertutti = filmpertutti(id)
|
||||
if url_filmpertutti is not None:
|
||||
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
|
||||
if TUTTIFILM == "1":
|
||||
url_tuttifilm = tantifilm(id)
|
||||
if url_tuttifilm:
|
||||
if not isinstance(url_tuttifilm, str):
|
||||
for title, url in url_tuttifilm.items():
|
||||
streams['streams'].append({'title': f'{HF}Tantifilm {title}', 'url': url, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}})
|
||||
if STREAMINGWATCH == "1":
|
||||
url_streamingwatch = streamingwatch(id)
|
||||
if url_streamingwatch:
|
||||
streams['streams'].append({'title': f'{HF}StreamingWatch 720p', 'url': url_streamingwatch})
|
||||
logging.debug(f"Handling movie or series: {id}")
|
||||
if "kitsu" in id:
|
||||
if ANIMEWORLD == "1":
|
||||
animeworld_urls = await animeworld(id,client)
|
||||
print(animeworld_urls)
|
||||
if animeworld_urls:
|
||||
i = 0
|
||||
for url in animeworld_urls:
|
||||
if url:
|
||||
if i == 0:
|
||||
title = "Original"
|
||||
elif i == 1:
|
||||
title = "Italian"
|
||||
streams['streams'].append({'title': f'{HF}Animeworld {title}', 'url': url})
|
||||
i+=1
|
||||
else:
|
||||
if MYSTERIUS == "1":
|
||||
results = await cool(id,client)
|
||||
if results:
|
||||
for resolution, link in results.items():
|
||||
streams['streams'].append({'title': f'{HF}Mysterious {resolution}', 'url': link})
|
||||
if STREAMINGCOMMUNITY == "1":
|
||||
url_streaming_community,url_720_streaming_community,quality_sc = await streaming_community(id,client)
|
||||
if url_streaming_community is not None:
|
||||
if quality_sc == "1080":
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 1080p Max', 'url': url_streaming_community})
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_720_streaming_community})
|
||||
else:
|
||||
streams['streams'].append({'title': f'{HF}StreamingCommunity 720p Max', 'url': url_streaming_community})
|
||||
if LORDCHANNEL == "1":
|
||||
url_lordchannel,quality_lordchannel = await lordchannel(id,client)
|
||||
if quality_lordchannel == "FULL HD" and url_lordchannel != None:
|
||||
streams['streams'].append({'title': f'{HF}LordChannel 1080p', 'url': url_lordchannel})
|
||||
elif url_lordchannel != None:
|
||||
streams['streams'].append({'title': f'{HF}LordChannel 720p', 'url': url_lordchannel})
|
||||
if FILMPERTUTTI == "1":
|
||||
url_filmpertutti = await filmpertutti(id,client)
|
||||
if url_filmpertutti is not None:
|
||||
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
|
||||
if TUTTIFILM == "1":
|
||||
url_tuttifilm = await tantifilm(id,client)
|
||||
if url_tuttifilm:
|
||||
if not isinstance(url_tuttifilm, str):
|
||||
for title, url in url_tuttifilm.items():
|
||||
streams['streams'].append({'title': f'{HF}Tantifilm {title}', 'url': url, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}})
|
||||
if STREAMINGWATCH == "1":
|
||||
url_streamingwatch = await streamingwatch(id,client)
|
||||
if url_streamingwatch:
|
||||
streams['streams'].append({'title': f'{HF}StreamingWatch 720p', 'url': url_streamingwatch})
|
||||
if not streams['streams']:
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user