diff --git a/lib/clients/stremio/addon_client.py b/lib/clients/stremio/addon_client.py index 61b7dee..3a7260e 100644 --- a/lib/clients/stremio/addon_client.py +++ b/lib/clients/stremio/addon_client.py @@ -220,14 +220,14 @@ def parse_torrent_description(self, desc: str) -> Dict[str, Any]: "languages": [], } # Extract size - size_pattern = r"💾 ([\d.]+ (?:GB|MB))" - size_match = re.search(size_pattern, desc) + size_pattern = r"💾 ([\d.,]+ (?:GB|MB|Go|Mo))" + size_match = re.search(size_pattern, desc, re.IGNORECASE) size = size_match.group(1) if size_match else None if size: size = convert_size_to_bytes(size) # Extract seeders - seeders_pattern = r"👤 (\d+)" + seeders_pattern = r"[👥👤] (\d+)" seeders_match = re.search(seeders_pattern, desc) seeders = int(seeders_match.group(1)) if seeders_match else None diff --git a/lib/utils/kodi/utils.py b/lib/utils/kodi/utils.py index cede7be..9b5b8cf 100644 --- a/lib/utils/kodi/utils.py +++ b/lib/utils/kodi/utils.py @@ -519,17 +519,18 @@ def bytes_to_human_readable(size: int, unit: str = "B") -> str: def convert_size_to_bytes(size_str: str) -> int: """Convert size string to bytes.""" - match = re.match(r"(\d+(?:\.\d+)?)\s*(GB|MB|KB|B)", size_str, re.IGNORECASE) + size_str = size_str.replace(",", ".") + match = re.match(r"(\d+(?:\.\d+)?)\s*(GB|MB|KB|B|Go|Mo|Ko)", size_str, re.IGNORECASE) if match: size, unit = match.groups() size = float(size) unit = unit.upper() - if unit == "GB": + if unit in ("GB", "GO"): return int(size * 1024**3) - if unit == "MB": + if unit in ("MB", "MO"): return int(size * 1024**2) - if unit == "KB": + if unit in ("KB", "KO"): return int(size * 1024) return int(size) return 0