From 00627ab36a9349a8d39a4b07d0e72e81a9b98466 Mon Sep 17 00:00:00 2001 From: karamori77 <78544883+karamori77@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:11:33 +0800 Subject: [PATCH 1/4] Update utils.py --- nhentai/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nhentai/utils.py b/nhentai/utils.py index c28a3ee..6977297 100644 --- a/nhentai/utils.py +++ b/nhentai/utils.py @@ -166,7 +166,7 @@ def generate_main_html(output_dir='./'): logger.warning('Writing Main Viewer failed ({})'.format(str(e))) -def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_comic_info=False): +def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_comic_info=True): if doujinshi_obj is not None: doujinshi_dir = os.path.join(output_dir, doujinshi_obj.filename) if write_comic_info: From 3a83f997714beef8087c08d6c30657d9abac4812 Mon Sep 17 00:00:00 2001 From: karamori77 <78544883+karamori77@users.noreply.github.com> Date: Sun, 18 Apr 2021 21:40:47 +0800 Subject: [PATCH 2/4] Update constant.py --- nhentai/constant.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nhentai/constant.py b/nhentai/constant.py index 39c6f3e..b960d13 100644 --- a/nhentai/constant.py +++ b/nhentai/constant.py @@ -36,3 +36,9 @@ CONFIG = { 'language': '', 'template': '', } + LANGUAGEISO ={ + 'english' : 'en', + 'chinese' : 'zh', + 'japanese' : 'ja', + 'translated' : 'translated' + } From 373086b459b922333db814963773ad6699afc422 Mon Sep 17 00:00:00 2001 From: karamori77 <78544883+karamori77@users.noreply.github.com> Date: Sun, 18 Apr 2021 21:45:15 +0800 Subject: [PATCH 3/4] Update serializer.py changed Language to LanguageISO for ComicInfo.xml Language will be displayed by the LanguageISO code, it also forgoes rare language tags like rewrite and speechless --- nhentai/serializer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nhentai/serializer.py b/nhentai/serializer.py index d8839a5..30b4493 100644 --- a/nhentai/serializer.py +++ b/nhentai/serializer.py @@ -2,7 +2,7 @@ import json import os from xml.sax.saxutils import escape - +from constant import LANGUAGEISO def serialize_json(doujinshi, dir): metadata = {'title': doujinshi.name, @@ -65,7 +65,8 @@ def serialize_comicxml(doujinshi, dir): if doujinshi.info.languages: languages = [i.strip() for i in doujinshi.info.languages.split(',')] xml_write_simple_tag(f, 'Translated', 'Yes' if 'translated' in languages else 'No') - [xml_write_simple_tag(f, 'Language', i) for i in languages if i != 'translated'] + [xml_write_simple_tag(f, 'LanguageISO', LANGUAGEISO[i]) for i in languages \ + if (i != 'translated' & i in LANGUAGEISO)] f.write('') From 00aad774ae0099a7ef2ed2ed481d333cf0f6f418 Mon Sep 17 00:00:00 2001 From: karamori77 <78544883+karamori77@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:04:52 +0800 Subject: [PATCH 4/4] Fixed potential re-download Moved forward save-history check 1 indent so it works with download by id too Mapped all ids to int since there are cases where its a string in the API --- nhentai/command.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nhentai/command.py b/nhentai/command.py index 8b05406..bc987fb 100644 --- a/nhentai/command.py +++ b/nhentai/command.py @@ -65,11 +65,11 @@ def main(): if options.is_download and doujinshis: doujinshi_ids = [i['id'] for i in doujinshis] - if options.is_save_download_history: - with DB() as db: - data = map(int, db.get_all()) + if options.is_save_download_history: + with DB() as db: + data = map(int, db.get_all()) - doujinshi_ids = list(set(doujinshi_ids) - set(data)) + doujinshi_ids = list(set(map(int, doujinshi_ids)) - set(data)) if doujinshi_ids: for i, id_ in enumerate(doujinshi_ids):