Skip to content

Commit

Permalink
feat: new debrid manager and cleaning (ruff)
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Jul 3, 2024
1 parent 35eb16f commit c48e466
Show file tree
Hide file tree
Showing 10 changed files with 539 additions and 220 deletions.
50 changes: 34 additions & 16 deletions comet/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,52 @@
templates = Jinja2Templates("comet/templates")
main = APIRouter()


@main.get("/", status_code=200)
async def root():
return RedirectResponse("/configure")


@main.get("/health", status_code=200)
async def health():
return {"status": "ok"}


indexers = settings.INDEXER_MANAGER_INDEXERS
web_config = {
"indexers": [indexer.replace(" ", "_").lower() for indexer in indexers],
"languages": [language.replace(" ", "_") for language in RTN.patterns.language_code_mapping.keys()],
"resolutions": ["360p", "480p", "576p", "720p", "1080p", "1440p", "2160p", "4K", "Unknown"]
"languages": [
language.replace(" ", "_")
for language in RTN.patterns.language_code_mapping.keys()
],
"resolutions": [
"360p",
"480p",
"576p",
"720p",
"1080p",
"1440p",
"2160p",
"4K",
"Unknown",
],
}


@main.get("/configure")
@main.get("/{b64config}/configure")
async def configure(request: Request):
return templates.TemplateResponse("index.html", {"request": request, "CUSTOM_HEADER_HTML": settings.CUSTOM_HEADER_HTML if settings.CUSTOM_HEADER_HTML and settings.CUSTOM_HEADER_HTML != "None" else "", "webConfig": web_config})
return templates.TemplateResponse(
"index.html",
{
"request": request,
"CUSTOM_HEADER_HTML": settings.CUSTOM_HEADER_HTML
if settings.CUSTOM_HEADER_HTML and settings.CUSTOM_HEADER_HTML != "None"
else "",
"webConfig": web_config,
},
)


@main.get("/manifest.json")
@main.get("/{b64config}/manifest.json")
Expand All @@ -39,18 +66,9 @@ async def manifest():
"description": "Stremio's fastest torrent/debrid search add-on.",
"logo": "https://i.imgur.com/jmVoVMu.jpeg",
"background": "https://i.imgur.com/WwnXB3k.jpeg",
"resources": [
"stream"
],
"types": [
"movie",
"series"
],
"idPrefixes": [
"tt"
],
"resources": ["stream"],
"types": ["movie", "series"],
"idPrefixes": ["tt"],
"catalogs": [],
"behaviorHints": {
"configurable": True
}
"behaviorHints": {"configurable": True},
}
Loading

0 comments on commit c48e466

Please sign in to comment.