From 2d31d63c912d74291d2b1f51e4cf8b94b176b977 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Mon, 24 Feb 2025 22:27:23 +0900 Subject: [PATCH] Fixed zimuku wrong archives subtitle language identified (#2856) --- .../subliminal_patch/providers/zimuku.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/zimuku.py b/custom_libs/subliminal_patch/providers/zimuku.py index 9fc97eba0..b57d9af32 100644 --- a/custom_libs/subliminal_patch/providers/zimuku.py +++ b/custom_libs/subliminal_patch/providers/zimuku.py @@ -177,28 +177,41 @@ class ZimukuProvider(Provider): ] # remove ext because it can be an archive type language = Language("eng") + language_list = [] + for img in sub.find("td", class_="tac lang").find_all("img"): if ( "china" in img.attrs["src"] and "hongkong" in img.attrs["src"] ): - language = Language("zho").add(Language('zho', 'TW', None)) logger.debug("language:" + str(language)) + + language = Language("zho").add(Language('zho', 'TW', None)) + language_list.append(language) elif ( "china" in img.attrs["src"] or "jollyroger" in img.attrs["src"] ): + logger.debug("language chinese simplified found: " + str(language)) + language = Language("zho") + language_list.append(language) elif "hongkong" in img.attrs["src"]: + logger.debug("language chinese traditional found: " + str(language)) + language = Language('zho', 'TW', None) - break + language_list.append(language) sub_page_link = urljoin(self.server_url, a.attrs["href"]) backup_session = copy.deepcopy(self.session) backup_session.headers["Referer"] = link - subs.append( - self.subtitle_class(language, sub_page_link, name, backup_session, year) - ) + # Mark each language of the subtitle as its own subtitle, and add it to the list, when handling archives or subtitles + # with multiple languages to ensure each language is identified as its own subtitle since they are the same archive file + # but will have its own file when downloaded and extracted. + for language in language_list: + subs.append( + self.subtitle_class(language, sub_page_link, name, backup_session, year) + ) return subs