Skip to content

Commit

Permalink
fix: fix the exception when favorited time is none
Browse files Browse the repository at this point in the history
  • Loading branch information
skymkmk committed Jun 7, 2023
1 parent 9f09fac commit ec2ff6a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cbz.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ def _get_dir(root: str) -> List[str]:

def config_info_xml(gid: int, path: str) -> None:
gtoken, title, artist, publisher, tag, language, favorited_time = sql.select_gallery_metadata(gid)
favorited_time = datetime.datetime.strptime(favorited_time, "%Y-%m-%d %H:%M")
root = ET.Element("ComicInfo")
year_node = ET.SubElement(root, "Year")
year_node.text = str(favorited_time.year)
month_node = ET.SubElement(root, 'Month')
month_node.text = str(favorited_time.month)
day_node = ET.SubElement(root, "Day")
day_node.text = str(favorited_time.day)
if favorited_time is not None:
favorited_time = datetime.datetime.strptime(favorited_time, "%Y-%m-%d %H:%M")
year_node = ET.SubElement(root, "Year")
year_node.text = str(favorited_time.year)
month_node = ET.SubElement(root, 'Month')
month_node.text = str(favorited_time.month)
day_node = ET.SubElement(root, "Day")
day_node.text = str(favorited_time.day)
title_node = ET.SubElement(root, "Title")
title_node.text = title
artist_node = ET.SubElement(root, "Writer")
Expand Down

0 comments on commit ec2ff6a

Please sign in to comment.