Skip to content

Commit 7e1666c

Browse files
committed
fix: torrent name parsing fail in multi_version_filter
1 parent 9b0063b commit 7e1666c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

backend/src/module/utils/multi_version_filter.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from collections import defaultdict
22

3+
from loguru import logger
4+
35
from module.models.torrent import Torrent, TorrentInfo
46
from module.parser.analyser import torrent_name_parser
57

@@ -11,7 +13,14 @@ def filter_multi_version_torrents(torrents: list[Torrent]):
1113

1214
for torrent in torrents:
1315
info = torrent_name_parser(torrent.name)
14-
key = f"{info.title}+{info.episode}"
16+
if info is None:
17+
logger.warning(
18+
f"Failed to parse torrent name for torrent '{torrent}'. "
19+
f"Fallback to using torrent.name: '{torrent.name}'."
20+
)
21+
key = torrent.name
22+
else:
23+
key = f"{info.title}+{info.episode}"
1524
grouped_torrents[key].append((torrent, info))
1625

1726
for torrents_group in grouped_torrents.values():

0 commit comments

Comments
 (0)