mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
refactor: update filter_manager calls to include scraper names for better logging
This commit is contained in:
@@ -40,4 +40,4 @@ async def get_aiostreams(manager, url: str, uuid_password: str | None = None):
|
||||
except Exception as e:
|
||||
log_scraper_error("AIOStreams", url, manager.media_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("AIOStreams", torrents)
|
||||
|
||||
@@ -98,4 +98,4 @@ async def get_bitmagnet(manager, session: aiohttp.ClientSession, url: str):
|
||||
|
||||
offset += batch_size * limit
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("BitMagnet", torrents)
|
||||
|
||||
@@ -37,4 +37,4 @@ async def get_comet(manager, url: str):
|
||||
log_scraper_error("Comet", url, manager.media_id, e)
|
||||
pass
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Comet", torrents)
|
||||
|
||||
@@ -43,4 +43,4 @@ async def get_debridio(manager, session: aiohttp.ClientSession):
|
||||
"Debridio", settings.DEBRIDIO_API_KEY, manager.media_only_id, e
|
||||
)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Debridio", torrents)
|
||||
|
||||
@@ -125,4 +125,4 @@ async def get_jackett(manager, session: aiohttp.ClientSession, title: str, seen:
|
||||
f"Exception while getting torrents for {title} with Jackett: {e}"
|
||||
)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Jackett", torrents)
|
||||
|
||||
@@ -44,4 +44,4 @@ async def get_jackettio(manager, url: str):
|
||||
except Exception as e:
|
||||
log_scraper_error("Jackettio", url, manager.media_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Jackettio", torrents)
|
||||
|
||||
@@ -260,8 +260,9 @@ class TorrentManager:
|
||||
torrent["parsed"] = parsed
|
||||
self.ready_to_cache.append(torrent)
|
||||
|
||||
async def filter_manager(self, torrents: list):
|
||||
async def filter_manager(self, scraper_name: str, torrents: list):
|
||||
if len(torrents) == 0:
|
||||
logger.log("SCRAPER", f"Scraper {scraper_name} found 0 torrents.")
|
||||
return
|
||||
|
||||
new_torrents = [
|
||||
@@ -269,12 +270,11 @@ class TorrentManager:
|
||||
for torrent in torrents
|
||||
if (torrent["infoHash"], torrent["title"]) not in self.seen_hashes
|
||||
]
|
||||
|
||||
|
||||
self.seen_hashes.update(
|
||||
(torrent["infoHash"], torrent["title"]) for torrent in new_torrents
|
||||
)
|
||||
|
||||
scraper_name = torrents[0]["tracker"].split("|")[0]
|
||||
logger.log(
|
||||
"SCRAPER",
|
||||
f"Scraper {scraper_name} found {len(torrents)} torrents, {len(new_torrents)} new.",
|
||||
|
||||
@@ -44,4 +44,4 @@ async def get_mediafusion(manager, url: str, api_password: str | None):
|
||||
log_scraper_error("MediaFusion", url, manager.media_id, e)
|
||||
pass
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("MediaFusion", torrents)
|
||||
|
||||
@@ -123,4 +123,4 @@ async def get_nyaa(manager):
|
||||
except Exception as e:
|
||||
log_scraper_error("Nyaa", "https://nyaa.si", manager.media_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Nyaa", torrents)
|
||||
|
||||
@@ -121,4 +121,4 @@ async def get_prowlarr(manager, session: aiohttp.ClientSession, title: str, seen
|
||||
f"Exception while getting torrents for {title} with Prowlarr: {e}"
|
||||
)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Prowlarr", torrents)
|
||||
|
||||
@@ -57,4 +57,4 @@ async def get_stremthru(manager, session: aiohttp.ClientSession, url: str):
|
||||
except Exception as e:
|
||||
log_scraper_error("StremThru", url, manager.media_only_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("StremThru", torrents)
|
||||
|
||||
@@ -30,4 +30,4 @@ async def get_torbox(manager, session: aiohttp.ClientSession):
|
||||
except Exception as e:
|
||||
log_scraper_error("TorBox", settings.TORBOX_API_KEY, manager.media_only_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("TorBox", torrents)
|
||||
|
||||
@@ -48,4 +48,4 @@ async def get_torrentio(manager, url: str):
|
||||
except Exception as e:
|
||||
log_scraper_error("Torrentio", url, manager.media_id, e)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Torrentio", torrents)
|
||||
|
||||
@@ -31,4 +31,4 @@ async def get_zilean(manager, session: aiohttp.ClientSession, url: str):
|
||||
f"Exception while getting torrents for {manager.title} with Zilean ({url}): {e}"
|
||||
)
|
||||
|
||||
await manager.filter_manager(torrents)
|
||||
await manager.filter_manager("Zilean", torrents)
|
||||
|
||||
Reference in New Issue
Block a user