diff --git a/comet/api/stream.py b/comet/api/stream.py index 062904f..a53f1c6 100644 --- a/comet/api/stream.py +++ b/comet/api/stream.py @@ -137,16 +137,23 @@ async def stream(request: Request, b64config: str, type: str, id: str): balanced_hashes = await get_balanced_hashes(sorted_ranked_files, config) results = [] - if (settings.PROXY_DEBRID_STREAM and settings.PROXY_DEBRID_STREAM_PASSWORD != config["debridStreamProxyPassword"]): + if ( + settings.PROXY_DEBRID_STREAM + and settings.PROXY_DEBRID_STREAM_PASSWORD + != config["debridStreamProxyPassword"] + ): results.append( { "name": "[⚠️] Comet", - "title": f"Debrid Stream Proxy Password incorrect.\nStreams will not be proxied.", + "title": "Debrid Stream Proxy Password incorrect.\nStreams will not be proxied.", "url": "https://comet.fast", } ) - for hash, hash_data in sorted_ranked_files.items(): # Like that to keep ranking order + for ( + hash, + hash_data, + ) in sorted_ranked_files.items(): # Like that to keep ranking order for resolution, hash_list in balanced_hashes.items(): if hash in hash_list: results.append( @@ -309,11 +316,15 @@ async def stream(request: Request, b64config: str, type: str, id: str): balanced_hashes = await get_balanced_hashes(sorted_ranked_files, config) results = [] - if (settings.PROXY_DEBRID_STREAM and settings.PROXY_DEBRID_STREAM_PASSWORD != config["debridStreamProxyPassword"]): + if ( + settings.PROXY_DEBRID_STREAM + and settings.PROXY_DEBRID_STREAM_PASSWORD + != config["debridStreamProxyPassword"] + ): results.append( { "name": "[⚠️] Comet", - "title": f"Debrid Stream Proxy Password incorrect.\nStreams will not be proxied.", + "title": "Debrid Stream Proxy Password incorrect.\nStreams will not be proxied.", "url": "https://comet.fast", } ) diff --git a/comet/debrid/alldebrid.py b/comet/debrid/alldebrid.py index e428b76..2acd6ad 100644 --- a/comet/debrid/alldebrid.py +++ b/comet/debrid/alldebrid.py @@ -78,7 +78,7 @@ async def get_files( for file in magnet["files"]: filename = file["n"] pack = False - if "e" in file: # PACK + if "e" in file: # PACK filename = file["e"][0]["n"] pack = True diff --git a/comet/utils/general.py b/comet/utils/general.py index e33d686..9a992e8 100644 --- a/comet/utils/general.py +++ b/comet/utils/general.py @@ -172,12 +172,12 @@ def bytes_to_size(bytes: int): sizes = ["Bytes", "KB", "MB", "GB", "TB"] if bytes == 0: return "0 Byte" - + i = 0 while bytes >= 1024 and i < len(sizes) - 1: bytes /= 1024 i += 1 - + return f"{round(bytes, 2)} {sizes[i]}" @@ -247,10 +247,15 @@ async def get_indexer_manager( async def filter(torrents: list, name_lower: str, indexer_manager_type: str): valid_torrents = [ - torrent for torrent in torrents + torrent + for torrent in torrents if title_match( name_lower, - parse(torrent["Title"] if indexer_manager_type == "jackett" else torrent["title"]).parsed_title.lower() + parse( + torrent["Title"] + if indexer_manager_type == "jackett" + else torrent["title"] + ).parsed_title.lower(), ) ] diff --git a/comet/utils/models.py b/comet/utils/models.py index 0293dbd..d6a092c 100644 --- a/comet/utils/models.py +++ b/comet/utils/models.py @@ -46,7 +46,10 @@ class ConfigModel(BaseModel): @field_validator("indexers") def check_indexers(cls, v, values): - settings.INDEXER_MANAGER_INDEXERS = [indexer.replace(" ", "_").lower() for indexer in settings.INDEXER_MANAGER_INDEXERS] # to equal webui + settings.INDEXER_MANAGER_INDEXERS = [ + indexer.replace(" ", "_").lower() + for indexer in settings.INDEXER_MANAGER_INDEXERS + ] # to equal webui valid_indexers = [ indexer for indexer in v if indexer in settings.INDEXER_MANAGER_INDEXERS ]