From 812268971d0dcd030df36b004083ee8a922fda5d Mon Sep 17 00:00:00 2001 From: Goldy <153996346+g0ldyy@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:57:57 +0100 Subject: [PATCH] fix: db caching issue --- comet/utils/general.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/comet/utils/general.py b/comet/utils/general.py index 688b63b..074d2a0 100644 --- a/comet/utils/general.py +++ b/comet/utils/general.py @@ -7,6 +7,7 @@ import asyncio import orjson import time +import copy from RTN import parse, title_match from curl_cffi import requests @@ -704,6 +705,23 @@ async def get_aliases(session: aiohttp.ClientSession, media_type: str, media_id: async def add_torrent_to_cache( config: dict, name: str, season: int, episode: int, sorted_ranked_files: dict ): + # trace of which indexers were used when cache was created - not optimal + indexers = config["indexers"].copy() + if settings.SCRAPE_TORRENTIO: + indexers.append("torrentio") + if settings.SCRAPE_MEDIAFUSION: + indexers.append("mediafusion") + if settings.ZILEAN_URL: + indexers.append("dmm") + for indexer in indexers: + hash = f"searched-{indexer}-{name}-{season}-{episode}" + + searched = copy.deepcopy(sorted_ranked_files[list(sorted_ranked_files.keys())[0]]) + searched["infohash"] = hash + searched["data"]["tracker"] = indexer + + sorted_ranked_files[hash] = searched + values = [ { "debridService": config["debridService"],