mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
speed goes brrrrr
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ DEBRID_PROXY_URL=http://127.0.0.1:1080 # https://github.com/cmj2002/warp-docker
|
||||
INDEXER_MANAGER_TYPE=jackett # or prowlarr
|
||||
INDEXER_MANAGER_URL=http://127.0.0.1:9117
|
||||
INDEXER_MANAGER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
INDEXER_MANAGER_TIMEOUT=30 # maximum time to obtain search results from indexer manager in seconds
|
||||
INDEXER_MANAGER_TIMEOUT=60 # maximum time to obtain search results from indexer manager in seconds
|
||||
INDEXER_MANAGER_INDEXERS='["EXAMPLE1_CHANGETHIS", "EXAMPLE2_CHANGETHIS"]'
|
||||
GET_TORRENT_TIMEOUT=5 # maximum time to obtain the torrent info hash in seconds
|
||||
CUSTOM_HEADER_HTML=None # only set it if you know what it is
|
||||
+42
-7
@@ -135,13 +135,27 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
if len(torrentHashes) == 0:
|
||||
return {"streams": []}
|
||||
|
||||
getAvailability = await session.get(f"https://api.real-debrid.com/rest/1.0/torrents/instantAvailability/{'/'.join(torrentHashes)}", headers={
|
||||
"Authorization": f"Bearer {config['debridApiKey']}"
|
||||
})
|
||||
# hashChunks = [torrentHashes[i:i + 5] for i in range(0, len(torrentHashes), 5)]
|
||||
|
||||
# tasks = []
|
||||
# for chunk in hashChunks:
|
||||
# tasks.append(session.get(f"https://api.real-debrid.com/rest/1.0/torrents/instantAvailability/{'/'.join(chunk)}", headers={
|
||||
# "Authorization": f"Bearer {config['debridApiKey']}"
|
||||
# }))
|
||||
|
||||
tasks = []
|
||||
for hash in torrentHashes:
|
||||
tasks.append(session.get(f"https://api.real-debrid.com/rest/1.0/torrents/instantAvailability/{hash}", headers={
|
||||
"Authorization": f"Bearer {config['debridApiKey']}"
|
||||
}))
|
||||
|
||||
responses = await asyncio.gather(*tasks)
|
||||
|
||||
availability = {}
|
||||
for response in responses:
|
||||
availability.update(await response.json())
|
||||
|
||||
files = {}
|
||||
|
||||
availability = await getAvailability.json()
|
||||
for hash, details in availability.items():
|
||||
if not "rd" in details:
|
||||
continue
|
||||
@@ -217,8 +231,18 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
"streams": results
|
||||
}
|
||||
|
||||
@streams.route("/{b64config}/playback/{hash}/{index}", methods=["HEAD", "GET"])
|
||||
async def stream(b64config: str, hash: str, index: str):
|
||||
# @streams.route("/{b64config}/playback/{hash}/{index}", methods=["HEAD", "GET"])
|
||||
# async def playback(b64config: str, hash: str, index: str):
|
||||
# config = configChecking(b64config)
|
||||
# if not config:
|
||||
# return
|
||||
|
||||
# downloadLink = await generateDownloadLink(config["debridApiKey"], hash, index)
|
||||
|
||||
# return RedirectResponse(downloadLink, status_code=302)
|
||||
|
||||
@streams.head("/{b64config}/playback/{hash}/{index}")
|
||||
async def playback(b64config: str, hash: str, index: str):
|
||||
config = configChecking(b64config)
|
||||
if not config:
|
||||
return
|
||||
@@ -226,3 +250,14 @@ async def stream(b64config: str, hash: str, index: str):
|
||||
downloadLink = await generateDownloadLink(config["debridApiKey"], hash, index)
|
||||
|
||||
return RedirectResponse(downloadLink, status_code=302)
|
||||
|
||||
|
||||
@streams.get("/{b64config}/playback/{hash}/{index}")
|
||||
async def playback(b64config: str, hash: str, index: str):
|
||||
config = configChecking(b64config)
|
||||
if not config:
|
||||
return
|
||||
|
||||
downloadLink = await generateDownloadLink(config["debridApiKey"], hash, index)
|
||||
|
||||
return RedirectResponse(downloadLink, status_code=302)
|
||||
@@ -1,15 +1,14 @@
|
||||
import os
|
||||
from typing import List, Optional
|
||||
|
||||
from typing import List, Optional
|
||||
from databases import Database
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
from RTN import RTN, BaseRankingModel, SettingsModel
|
||||
|
||||
|
||||
class AppSettings(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_file_encoding="utf-8",
|
||||
env_file_encoding="utf-8"
|
||||
)
|
||||
|
||||
FASTAPI_HOST: str = "0.0.0.0"
|
||||
|
||||
Reference in New Issue
Block a user