fix: handle missing infoHash and improve annotation request check

This commit is contained in:
mhdzumair
2025-02-28 11:19:54 +05:30
parent b1c3deff75
commit 860c1e3d9e
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ class MediafusionScraper(StremioScraper):
source = stream["name"].split()[0].title()
info_hash = stream.get("infoHash")
if not info_hash:
url = stream["url"]
url = stream.get("url")
if "/stream/" not in url:
return {}, False
info_hash = url.split("/")[6]
+4 -3
View File
@@ -268,9 +268,10 @@ async def update_torrent_streams_metadata(
Returns True if update was successful, False if annotation was requested.
"""
# Check if annotation was recently requested
if torrent_stream.annotation_requested_at and datetime.now(
tz=timezone.utc
) - torrent_stream.annotation_requested_at < timedelta(days=7):
if (
torrent_stream.annotation_requested_at
and datetime.now() - torrent_stream.annotation_requested_at < timedelta(days=7)
):
logger.info(
f"Skipping metadata update for {torrent_stream.id} - "
"recent annotation request"