Update serializer.py

changed Language to LanguageISO for ComicInfo.xml
Language will be displayed by the LanguageISO code, it also forgoes rare language tags like rewrite and speechless
This commit is contained in:
karamori77 2021-04-18 21:45:15 +08:00 committed by GitHub
parent 3a83f99771
commit 373086b459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
import json
import os
from xml.sax.saxutils import escape
from constant import LANGUAGEISO
def serialize_json(doujinshi, dir):
metadata = {'title': doujinshi.name,
@ -65,7 +65,8 @@ def serialize_comicxml(doujinshi, dir):
if doujinshi.info.languages:
languages = [i.strip() for i in doujinshi.info.languages.split(',')]
xml_write_simple_tag(f, 'Translated', 'Yes' if 'translated' in languages else 'No')
[xml_write_simple_tag(f, 'Language', i) for i in languages if i != 'translated']
[xml_write_simple_tag(f, 'LanguageISO', LANGUAGEISO[i]) for i in languages \
if (i != 'translated' & i in LANGUAGEISO)]
f.write('</ComicInfo>')