46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
import json
|
|
import xml.etree.ElementTree as ET
|
|
|
|
with open('hentainexus_1_001.png.json') as json_file:
|
|
data = json.load(json_file)
|
|
artist = data['artist']
|
|
book = data['book'] # has a book
|
|
category = data['category'] # website name
|
|
count = data['count'] # Page count
|
|
description = data['description'] # Summary
|
|
event = data['event'] # ?
|
|
extension = data['extension']
|
|
filename = data['filename']
|
|
gallery_id = data['gallery_id'] # hn gallery id
|
|
lang = data['lang'] # LanguageISO
|
|
language = data['language'] # Language word
|
|
magazine = data['magazine'] # Magazine
|
|
num = data['num'] # Page number
|
|
parody = data['parody'] # Original work or parody name
|
|
publisher = data['publisher'] # FA##U usually
|
|
subcategory = data['gallery'] # gallery
|
|
tags = data['tags'] # Array of tags
|
|
thumbnail = None # thumb url
|
|
title = data['title'] # title without artist
|
|
title_conventional = data['title_conventional'] # title with artist
|
|
bookType = data['type'] # manga...
|
|
|
|
comicinfo = ET.Element('ComicInfo')
|
|
if (title_conventional) {
|
|
title = ET.SubElement(comicinfo, 'Title')
|
|
|
|
} else if (title) {
|
|
title = ET.SubElement(comicinfo, 'Title')
|
|
}
|
|
|
|
writer = ET.SubElement(comicinfo, 'Writer')
|
|
number = ET.SubElement(comicinfo, 'Number')
|
|
summary = ET.SubElement(comicinfo, 'Summary')
|
|
series = ET.SubElement(comicinfo, 'Series')
|
|
publisher = ET.SubElement(comicinfo, 'Publisher')
|
|
manga = ET.SubElement(comicinfo, 'Manga')
|
|
genre = ET.SubElement(comicinfo, 'Genre')
|
|
languageIso = ET.SubElement(comicinfo, 'LanguageISO')
|
|
seriesGroup = ET.SubElement(comicinfo, 'SeriesGroup')
|
|
|
|
|