Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
better comment (#3)
Browse files Browse the repository at this point in the history
* Update 1_info.py

* Update 3_zipNote.py
  • Loading branch information
xiazeyu committed Jan 10, 2021
1 parent 5453493 commit 08e96fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 7 additions & 6 deletions 1_info.py
Expand Up @@ -31,13 +31,13 @@

info = {}

info
info['Title'] = infoJson['gallery_info']['title_original'] or infoJson['gallery_info']['title']
info['Genre'] = infoJson['gallery_info']['category']
info['Language'] = infoJson['gallery_info']['language']
info['Year'] = infoJson['gallery_info']['upload_date'][0]
info['Month'] = infoJson['gallery_info']['upload_date'][1]
info['Day'] = infoJson['gallery_info']['upload_date'][2]
info['UploadDate'] = infoJson['gallery_info']['upload_date']
info['Year'] = info['UploadDate'][0]
info['Month'] = info['UploadDate'][1]
info['Day'] = info['UploadDate'][2]
info['PageCount'] = infoJson['gallery_info_full']['image_count']
info['Rating'] = infoJson['gallery_info_full']['rating']['average']
info['Publisher'] = urllib.parse.unquote(infoJson['gallery_info_full']['uploader'])
Expand Down Expand Up @@ -92,6 +92,7 @@

info['LanguageISO'] = pycountry.languages.get(name=info['Language']).alpha_2

info['Comments'] = f'''<div><p>Web: <a href="{info['Web']}">{info['Web']}</a></p><p>Rating: {info['Rating']}, {infoJson['gallery_info_full']['rating']['count']}</p><p>PageCount: {info['PageCount']}</p><p>Genre: {info['Genre']}</p><p>Imprint: {info['Imprint']}</p><p>AgeRating: {info['AgeRating']}</p><p>UploadDate: {info['UploadDate']}</p></div>'''

if verbose:
pp.pprint(info)
Expand All @@ -113,7 +114,7 @@
<AgeRating><![CDATA[{info['AgeRating']}]]></AgeRating>
<Manga><![CDATA[{info['Manga']}]]></Manga>
<Characters><![CDATA[{info['Characters']}]]></Characters>
<ScanInformation><![CDATA[{infoJson}]]></ScanInformation>
<ScanInformation><![CDATA[{info['Comments']}]]></ScanInformation>
</ComicInfo>
'''

Expand All @@ -129,7 +130,7 @@
jsonData['ComicBookInfo/1.0']['publisher'] = info['Publisher']
jsonData['ComicBookInfo/1.0']['publicationMonth'] = info['Month']
jsonData['ComicBookInfo/1.0']['publicationYear'] = info['Year']
jsonData['ComicBookInfo/1.0']['comments'] = json.dumps(infoJson, ensure_ascii=False)
jsonData['ComicBookInfo/1.0']['comments'] = info['Comments']
jsonData['ComicBookInfo/1.0']['genre'] = info['Genre']
jsonData['ComicBookInfo/1.0']['language'] = info['LanguageISO']
jsonData['ComicBookInfo/1.0']['rating'] = math.floor(info['Rating']*2) or 1
Expand Down
1 change: 0 additions & 1 deletion 3_zipNote.py
Expand Up @@ -35,7 +35,6 @@
newName = file.parent / f'{file.stem}.cbz'
file.rename(newName)

del extJson['ComicBookInfo/1.0']['comments']
if verbose:
pp.pprint(extJson)

Expand Down

0 comments on commit 08e96fa

Please sign in to comment.