From 90abdc94e869b0f37ec149339fdcc08768479006 Mon Sep 17 00:00:00 2001 From: funkyhippo Date: Mon, 20 Dec 2021 20:16:16 -0800 Subject: [PATCH] Use user ID for group if scan group is missing. #8 --- proxy/sources/mangadex.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/proxy/sources/mangadex.py b/proxy/sources/mangadex.py index cbc3932b..1633f197 100644 --- a/proxy/sources/mangadex.py +++ b/proxy/sources/mangadex.py @@ -249,7 +249,18 @@ def md_api_common(self, meta_id): # Bandaid fix but it should resolve most resolution issues if chapter_group is None: - continue + for relationship in chapter["relationships"]: + if relationship["type"] == "user": + chapter_group = relationship["id"] + break + # If at this point it still doesn't have a group, fail the processing + if chapter_group is None: + raise ProxyException( + "A chapter is missing a scanlator or user uploader." + ) + groups_set.add(chapter_group) + groups_dict[str(len(groups_set))] = chapter_group + groups_map[chapter_group] = str(len(groups_set)) if chapter_number in chapter_dict: chapter_obj = chapter_dict[chapter_number]