Skip to content

Commit

Permalink
fix: db caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Nov 23, 2024
1 parent 21b37a3 commit 8122689
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions comet/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import asyncio
import orjson
import time
import copy

from RTN import parse, title_match
from curl_cffi import requests
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit 8122689

Please sign in to comment.