Skip to content

Conversation

@Dav-11
Copy link

@Dav-11 Dav-11 commented Apr 13, 2025

Hello,

I would like to add the ComicInfo.xml file inside the CBZ archive to provide metadata for comic readers.

See here: https://github.com/anansi-project/comicinfo for specification.

@uzi98f
Copy link

uzi98f commented Jun 19, 2025

hi do you know if its possible to download all the episodes of a manga? with this project?

@Dav-11
Copy link
Author

Dav-11 commented Jun 20, 2025

@uzi98f It depends on the manga, it is just a way to download images from shueisha's mangaplus service, so it only downloads chapter you are able to see from the android/ios app. But if you pay the subscription and configure the system to use your account (see here: hurlenko#36) you should be pretty much able to download all of them.

Copy link
Owner

@l0westbob l0westbob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your recommendations, but please clean up your changes.

from io import BytesIO
from pathlib import Path
from typing import Union

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Comment on lines 8 to 10
import logging
log = logging.getLogger(__name__)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what?

Comment on lines 70 to 72

log.info(f"close")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the reason?

Comment on lines +75 to +81

# Generate and write ComicInfo.xml to the archive
comicinfo_xml = self._generate_comicinfo_xml()
xml_path = Path(self.chapter_name, "ComicInfo.xml")
self.archive.writestr(xml_path.as_posix(), comicinfo_xml)

# Finalize archive
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with the ZIP file in a case of an error while creating the xml file?

Comment on lines +87 to +92
"""
Generate a basic ComicInfo.xml metadata file.
See: https://github.com/anansi-project/comicinfo
Returns:
str: The ComicInfo.xml content as a string.
"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, how about:
"""
Generate a basic ComicInfo.xml metadata file.
See: https://github.com/anansi-project/comicinfo

Returns:
str: The ComicInfo.xml content as a string.

Notes:
- Values are XML-escaped to ensure the output is well-formed even if
metadata contains special characters (e.g., '&', '<', '>').
- The language code is derived from the base class via _iso_language().
"""

Comment on lines +94 to +105
return f"""<?xml version="1.0" encoding="utf-8"?>
<ComicInfo>
<Series>{self.title_name}</Series>
<Number>{self.chapter_number}</Number>
<Title>{self.chapter_title}</Title>
<Writer>{self.author}</Writer>
<LanguageISO>{self._iso_language()}</LanguageISO>
<Manga>YesAndRightToLeft</Manga>
<Publisher>Shueisha</Publisher>
<Genre>Manga</Genre>
</ComicInfo>
"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thisd should be in a constant, not raw in the return

Comment on lines +10 to +12
import logging
log = logging.getLogger(__name__)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Comment on lines +60 to +63

# log.info(f"chapter: {chapter}")
# log.info(f"title: {title}")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Comment on lines +80 to +83
self.language = title.language
self.author = title.author
self.chapter_title = chapter.sub_title
self.chapter_number = chapter.name
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, but please add a new line and a comment like this above:

Add meta data

Comment on lines +178 to +201
def _iso_language(self) -> str:

l = Language(self.language)
if l == Language.ENGLISH:
return 'en'
elif l == Language.SPANISH:
return 'es'
elif l == Language.FRENCH:
return 'fr'
elif l == Language.INDONESIAN:
return 'id'
elif l == Language.PORTUGUESE:
return 'pt'
elif l == Language.RUSSIAN:
return 'ru'
elif l == Language.THAI:
return 'th'
elif l == Language.GERMAN:
return 'de'
elif l == Language.VIETNAMESE:
return 'vi'
else:
return 'en'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function itself is okay but these are no go's:

  • No docstring
  • single character variable names -> be expressive
  • why the if, elif wall of doom instead of a map?

@l0westbob l0westbob self-assigned this Sep 10, 2025
@l0westbob
Copy link
Owner

@Dav-11 please check this PR if it does match your needs:

#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants