diff --git a/scrapers/routes.py b/scrapers/routes.py index f73fe64..b18bf56 100644 --- a/scrapers/routes.py +++ b/scrapers/routes.py @@ -248,7 +248,7 @@ async def add_torrent( # Check if torrent already exists if torrent_stream := await get_stream_by_info_hash(info_hash): - if torrent_stream.meta_id != meta_id: + if meta_id and meta_id != torrent_stream.meta_id: await torrent_stream.delete() elif meta_type == "movie" and torrent_stream.filename is None: await torrent_stream.delete() @@ -724,6 +724,7 @@ async def analyze_torrent( status_code=400, detail="Failed to fetch torrent metadata." ) torrent_data = data[0] + torrent_data.pop("torrent_file", None) else: raise HTTPException( status_code=400, diff --git a/utils/torrent.py b/utils/torrent.py index 3c9ce05..7eb1577 100644 --- a/utils/torrent.py +++ b/utils/torrent.py @@ -56,7 +56,7 @@ def extract_torrent_metadata( return {} metadata = { - "info_hash": info_hash, + "info_hash": info_hash.lower(), "announce_list": announce_list, "total_size": total_size, "torrent_name": torrent_name,