Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs in repositories/manganato.py #67

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions enma/infra/adapters/repositories/manganato.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ def __create_title(self,
main_title: str,
alternative: str) -> Title:
logger.debug(f'Building manga title main: {main_title} and alternative: {alternative}')

has_many_alternatives = alternative.find(';') != -1 or alternative.find(',') != -1

if not has_many_alternatives:
jp = alternative
return Title(english=main_title.strip(),
japanese=jp.strip(),
other=main_title.strip())

jp, cn, *_ = alternative.split(';') if alternative.find(';') != -1 else alternative.split(',')
return Title(english=main_title.strip(),
japanese=jp.strip(),
Expand Down Expand Up @@ -149,8 +158,8 @@ def get(self,
authors=[Author(name=author)] if author is not None else None,
genres=[Genre(name=genre_name) for genre_name in genres],
id=identifier,
created_at=datetime.strptime(updated_at, "%b %d,%Y - %I:%M %p") if updated_at else None,
updated_at=datetime.strptime(updated_at, "%b %d,%Y - %I:%M %p") if updated_at else None,
created_at=datetime.strptime(updated_at, "%b %d,%Y - %H:%M %p") if updated_at else None,
updated_at=datetime.strptime(updated_at, "%b %d,%Y - %H:%M %p") if updated_at else None,
thumbnail=Image(uri=cover), # type: ignore
cover=Image(uri=cover), # type: ignore
chapters=chapters) # type: ignore
Expand Down
Loading