Skip to content

Commit

Permalink
fix: add trackers to results
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Nov 14, 2024
1 parent 0cff451 commit 9295fd2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
13 changes: 9 additions & 4 deletions comet/api/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
get_client_ip,
)
from comet.utils.logger import logger
from comet.utils.models import database, rtn, settings
from comet.utils.models import database, rtn, settings, trackers

streams = APIRouter()

Expand Down Expand Up @@ -180,7 +180,9 @@ async def stream(request: Request, b64config: str, type: str, id: str):
all_sorted_ranked_files.update(sorted_ranked_files)

if len(all_sorted_ranked_files) != 0:
debrid_extension = get_debrid_extension(debrid_service, config["debridApiKey"])
debrid_extension = get_debrid_extension(
debrid_service, config["debridApiKey"]
)
balanced_hashes = get_balanced_hashes(all_sorted_ranked_files, config)

seen_hashes = set()
Expand All @@ -196,7 +198,9 @@ async def stream(request: Request, b64config: str, type: str, id: str):
"name": f"[{debrid_extension}{debrid_emoji}] Comet {data['resolution']}",
"description": format_title(data, config),
"torrentTitle": (
data["torrent_title"] if "torrent_title" in data else None
data["torrent_title"]
if "torrent_title" in data
else None
),
"torrentSize": (
data["torrent_size"] if "torrent_size" in data else None
Expand All @@ -214,6 +218,7 @@ async def stream(request: Request, b64config: str, type: str, id: str):
else:
the_stream["infoHash"] = hash
the_stream["fileIdx"] = int(data["index"])
the_stream["sources"] = trackers

results.append(the_stream)

Expand All @@ -226,7 +231,7 @@ async def stream(request: Request, b64config: str, type: str, id: str):
logger.info(f"{results_count} cached results found for {log_name}")

return {"streams": results}

logger.info(f"No cache found for {log_name} with user configuration")

debrid = getDebrid(session, config, get_client_ip(request))
Expand Down
43 changes: 43 additions & 0 deletions comet/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,46 @@ def check_debrid_service(cls, v):
database = Database(
f"{'sqlite' if settings.DATABASE_TYPE == 'sqlite' else 'postgresql+asyncpg'}://{'/' if settings.DATABASE_TYPE == 'sqlite' else ''}{database_url}"
)

trackers = [
"tracker:https://tracker.gbitt.info:443/announce",
"tracker:udp://discord.heihachi.pw:6969/announce",
"tracker:http://tracker.corpscorp.online:80/announce",
"tracker:udp://tracker.leechers-paradise.org:6969/announce",
"tracker:https://tracker.renfei.net:443/announce",
"tracker:udp://exodus.desync.com:6969/announce",
"tracker:http://tracker.xiaoduola.xyz:6969/announce",
"tracker:udp://ipv4.tracker.harry.lu:80/announce",
"tracker:udp://tracker.torrent.eu.org:451/announce",
"tracker:udp://tracker.coppersurfer.tk:6969/announce",
"tracker:http://tracker.dmcomic.org:2710/announce",
"tracker:http://www.genesis-sp.org:2710/announce",
"tracker:http://t.jaekr.sh:6969/announce",
"tracker:http://tracker.bt-hash.com:80/announce",
"tracker:https://tracker.tamersunion.org:443/announce",
"tracker:udp://open.stealth.si:80/announce",
"tracker:udp://tracker.opentrackr.org:1337/announce",
"tracker:udp://leet-tracker.moe:1337/announce",
"tracker:udp://oh.fuuuuuck.com:6969/announce",
"tracker:udp://tracker.bittor.pw:1337/announce",
"tracker:udp://explodie.org:6969/announce",
"tracker:http://finbytes.org:80/announce.php",
"tracker:udp://tracker.dump.cl:6969/announce",
"tracker:udp://open.free-tracker.ga:6969/announce",
"tracker:http://tracker.gbitt.info:80/announce",
"tracker:udp://isk.richardsw.club:6969/announce",
"tracker:http://bt1.xxxxbt.cc:6969/announce",
"tracker:udp://tracker.qu.ax:6969/announce",
"tracker:udp://opentracker.io:6969/announce",
"tracker:udp://tracker.internetwarriors.net:1337/announce",
"tracker:udp://tracker.0x7c0.com:6969/announce",
"tracker:udp://9.rarbg.me:2710/announce",
"tracker:udp://tracker.pomf.se:80/announce",
"tracker:udp://tracker.openbittorrent.com:80/announce",
"tracker:udp://open.tracker.cl:1337/announce",
"tracker:http://www.torrentsnipe.info:2701/announce",
"tracker:udp://retracker01-msk-virt.corbina.net:80/announce",
"tracker:udp://open.demonii.com:1337/announce",
"tracker:udp://tracker-udp.gbitt.info:80/announce",
"tracker:udp://tracker.tiny-vps.com:6969/announce",
]

0 comments on commit 9295fd2

Please sign in to comment.