Spaces:
Paused
Paused
File size: 7,865 Bytes
869331d 61dbeac 869331d 005b196 869331d ed4078c 869331d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
from fastapi import FastAPI, HTTPException
from fastapi.responses import JSONResponse
from filmpertutti import filmpertutti
from streamingcommunity import streaming_community
from tantifilm import tantifilm
from lordchannel import lordchannel
from streamingwatch import streamingwatch
import json
import config
import logging
from okru import okru_get_url
from animeworld import animeworld
from dictionaries import okru,STREAM
import httpx
# Configure logging
FILMPERTUTTI = config.FILMPERTUTTI
STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
MYSTERIUS = config.MYSTERIUS
TUTTIFILM = config.TUTTIFILM
TF_DOMAIN = config.TF_DOMAIN
LORDCHANNEL = config.LORDCHANNEL
STREAMINGWATCH= config.STREAMINGWATCH
ANIMEWORLD = config.ANIMEWORLD
HOST = config.HOST
PORT = int(config.PORT)
HF = config.HF
if HF == "1":
HF = "🤗️"
#Cool code to set the hugging face if the service is hosted there.
else:
HF = ""
if MYSTERIUS == "1":
from cool import cool
app = FastAPI()
MANIFEST = {
"id": "org.stremio.mammamia",
"version": "1.0.5",
"catalogs": [
{"type": "tv", "id": "tv_channels", "name": "TV Channels"}
],
"resources": ["stream", "catalog","meta"],
"types": ["movie", "series", "tv"],
"name": "Mamma Mia",
"description": "Addon providing HTTPS Streams for Italian Movies,Series and Live TV! Note that you need to have Kitsu Addon installed in order to watch Anime",
"logo": "https://creazilla-store.fra1.digitaloceanspaces.com/emojis/49647/pizza-emoji-clipart-md.png"
}
def respond_with(data):
resp = JSONResponse(data)
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Access-Control-Allow-Headers'] = '*'
print(data)
return resp
@app.get('/manifest.json')
def addon_manifest():
return respond_with(MANIFEST)
@app.get('/')
def root():
return "Hello, this is a Stremio Addon providing HTTPS Stream for Italian Movies/Series, to install it add /manifest.json to the url and then add it into the Stremio search bar"
@app.get('/catalog/{type}/{id}.json')
def addon_catalog(type, id):
if type != "tv":
raise HTTPException(status_code=404)
catalogs = {"metas": []}
for channel in STREAM["channels"]:
catalogs["metas"].append({
"id": channel["id"],
"type": "tv",
"name": channel["title"],
"poster": channel["poster"], # Add poster URL if available
"description": f"Watch {channel['title']}"
})
return respond_with(catalogs)
@app.get('/meta/tv/{id}.json')
def addon_meta(id: str):
# Find the channel by ID
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")
meta = {
'meta': {
'id': channel['id'],
'type': 'tv',
'name': channel['name'],
'poster': channel['poster'],
'posterShape': 'landscape',
'description': channel['title'],
# Additional fields can be added here
'background': channel['poster'], # Example of using the same poster as background
'logo': channel['poster'], # Example of using the same poster as logo
'url': channel['url'], # Using the stream URL as a website link
}
}
return respond_with(meta)
@app.get('/stream/{type}/{id}.json')
async def addon_stream(type, id):
if type not in MANIFEST['types']:
raise HTTPException(status_code=404)
streams = {'streams': []}
async with httpx.AsyncClient() as client:
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 = 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:
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)
return respond_with(streams)
if __name__ == '__main__':
import uvicorn
uvicorn.run("run:app", host=HOST, port=PORT, log_level="info") |