From 930bbe78546adb464cc5a4be274b04497f1fb1fb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 23 Apr 2020 07:38:30 +0200 Subject: Remove duplicate chapter numbers when there are multiple translators --- plugins/mangadex.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/mangadex.py b/plugins/mangadex.py index be0e2ce..238a264 100755 --- a/plugins/mangadex.py +++ b/plugins/mangadex.py @@ -75,6 +75,7 @@ def list_chapters(url, chapter_list_input): tree = etree.HTML(response.text) chapters = [] + prev_chapter_number = None for element in tree.xpath("//div[@data-manga-id='%s']" % manga_id): chapter_lang = element.attrib.get("data-lang") if chapter_lang != lang: @@ -83,6 +84,9 @@ def list_chapters(url, chapter_list_input): chapter_url = "https://mangadex.org/chapter/%s" % chapter_id chapter_title = element.attrib.get("data-title") # optional chapter_number = element.attrib.get("data-chapter") + if prev_chapter_number and chapter_number == prev_chapter_number: + continue + prev_chapter_number = chapter_number chapter_name = "Ch. %s" % chapter_number if chapter_title: chapter_name += " - %s" % chapter_title -- cgit v1.2.3