From 05144847976207a9780460a92e7c1b1ff20f10f1 Mon Sep 17 00:00:00 2001 From: Goldy <153996346+g0ldyy@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:48:36 +0200 Subject: [PATCH] fix: wrong debrid stream proxy password warning being showed everytime --- comet/api/stream.py | 12 ++++++++---- comet/debrid/alldebrid.py | 2 -- comet/debrid/premiumize.py | 2 -- comet/debrid/realdebrid.py | 2 -- comet/utils/general.py | 11 ++++++----- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/comet/api/stream.py b/comet/api/stream.py index 177ddce..8064962 100644 --- a/comet/api/stream.py +++ b/comet/api/stream.py @@ -139,7 +139,8 @@ async def stream(request: Request, b64config: str, type: str, id: str): results = [] if ( - settings.PROXY_DEBRID_STREAM + config["debridStreamProxyPassword"] != "" + and settings.PROXY_DEBRID_STREAM and settings.PROXY_DEBRID_STREAM_PASSWORD != config["debridStreamProxyPassword"] ): @@ -193,9 +194,11 @@ async def stream(request: Request, b64config: str, type: str, id: str): search_response = await asyncio.gather(*tasks) else: logger.info(f"No indexer selected by user for {log_name}") - + if settings.ZILEAN_URL: - zilean_torrents = await asyncio.create_task(get_zilean(session, indexer_manager_type, name, log_name)) + zilean_torrents = await asyncio.create_task( + get_zilean(session, indexer_manager_type, name, log_name) + ) if search_indexer: for results in search_response: @@ -296,7 +299,8 @@ async def stream(request: Request, b64config: str, type: str, id: str): results = [] if ( - settings.PROXY_DEBRID_STREAM + config["debridStreamProxyPassword"] != "" + and settings.PROXY_DEBRID_STREAM and settings.PROXY_DEBRID_STREAM_PASSWORD != config["debridStreamProxyPassword"] ): diff --git a/comet/debrid/alldebrid.py b/comet/debrid/alldebrid.py index 2acd6ad..2856b21 100644 --- a/comet/debrid/alldebrid.py +++ b/comet/debrid/alldebrid.py @@ -42,7 +42,6 @@ async def get_instant(self, chunk: list): logger.warning( f"Exception while checking hashes instant availability on All-Debrid: {e}" ) - return async def get_files( self, torrent_hashes: list, type: str, season: str, episode: str @@ -152,4 +151,3 @@ async def generate_download_link(self, hash: str, index: str): logger.warning( f"Exception while getting download link from All-Debrid for {hash}|{index}: {e}" ) - return diff --git a/comet/debrid/premiumize.py b/comet/debrid/premiumize.py index c6808eb..c1bfa41 100644 --- a/comet/debrid/premiumize.py +++ b/comet/debrid/premiumize.py @@ -47,7 +47,6 @@ async def get_instant(self, chunk: list): logger.warning( f"Exception while checking hash instant availability on Premiumize: {e}" ) - return async def get_files( self, torrent_hashes: list, type: str, season: str, episode: str @@ -147,4 +146,3 @@ async def generate_download_link(self, hash: str, index: str): logger.warning( f"Exception while getting download link from Premiumize for {hash}|{index}: {e}" ) - return diff --git a/comet/debrid/realdebrid.py b/comet/debrid/realdebrid.py index ac56e58..be15b12 100644 --- a/comet/debrid/realdebrid.py +++ b/comet/debrid/realdebrid.py @@ -39,7 +39,6 @@ async def get_instant(self, chunk: list): logger.warning( f"Exception while checking hash instant availability on Real-Debrid: {e}" ) - return async def get_files( self, torrent_hashes: list, type: str, season: str, episode: str @@ -157,4 +156,3 @@ async def generate_download_link(self, hash: str, index: str): logger.warning( f"Exception while getting download link from Real-Debrid for {hash}|{index}: {e}" ) - return diff --git a/comet/utils/general.py b/comet/utils/general.py index bc01049..4d30a1d 100644 --- a/comet/utils/general.py +++ b/comet/utils/general.py @@ -228,9 +228,7 @@ async def get_indexer_manager( response = await session.get( f"{settings.INDEXER_MANAGER_URL}/api/v1/search?query={query}&indexerIds={'&indexerIds='.join(str(indexer_id) for indexer_id in indexers_id)}&type=search", - headers={ - "X-Api-Key": settings.INDEXER_MANAGER_API_KEY - }, + headers={"X-Api-Key": settings.INDEXER_MANAGER_API_KEY}, ) response = await response.json() @@ -245,7 +243,9 @@ async def get_indexer_manager( return results -async def get_zilean(session: aiohttp.ClientSession, indexer_manager_type: str, name: str, log_name: str): +async def get_zilean( + session: aiohttp.ClientSession, indexer_manager_type: str, name: str, log_name: str +): results = [] try: get_dmm = await session.post( @@ -254,7 +254,8 @@ async def get_zilean(session: aiohttp.ClientSession, indexer_manager_type: str, get_dmm = await get_dmm.json() if isinstance(get_dmm, list): - for result in get_dmm[: settings.ZILEAN_TAKE_FIRST]: + take_first = get_dmm[: settings.ZILEAN_TAKE_FIRST] + for result in take_first: if indexer_manager_type == "jackett": object = { "Title": result["filename"],