This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
with zipfile.ZipFile('test.cbz', 'r',) as z: | |
print(z.read('ComicInfo.xml')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Series>sleepless night</Series> | |
<Year>2008</Year> | |
<Month>4</Month> | |
<Day>27</Day> | |
<Writer>八王子海パン突撃騎兵隊</Writer> | |
<Penciller>巻田佳春</Penciller> | |
<Genre>しゅごキャラ!</Genre> | |
<PageCount>18</PageCount> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in self.pronlist.values(): | |
totalweight += i | |
r = random.randint(1, totalweight) | |
for k,v in sorted(self.pronlist.items(), key=lambda x:x[1], reverse=True): | |
if r <= v: | |
pron = k | |
break | |
else: | |
r -= v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
import os | |
class ComicInfoGetter(wx.App): | |
def OnInit(self): | |
frm = GuiWindow("ComicInfo Getter from D&M Lexicon") | |
frm.Show() | |
return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Series>いけない蒼星石</Series> | |
<Year>2007</Year> | |
<Month>11</Month> | |
<Day>25</Day> | |
<Writer>真・聖堂☆本舗, 東*南*東</Writer> | |
<Penciller>聖☆司, 米</Penciller> | |
<Genre>ローゼンメイデン</Genre> | |
<PageCount>34</PageCount> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Title>ACT.1 HARUKA</Title> | |
<Series>SISTERS 隠された記憶</Series> | |
<Number>1</Number> | |
<Year>2011</Year> | |
<Month>8</Month> | |
<Writer>マキノ事務所</Writer> | |
<Genre>SISTERS</Genre> | |
<PageCount>20</PageCount> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
import xml.etree.ElementTree as etree | |
class ComicInfoXmlHandler(): | |
def __init__(self): | |
self.series = '' | |
self.number = '' | |
self.title = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_xml(self, toxml): | |
g = io.StringIO() | |
for i in toxml: | |
if (toxml[i] != '') & (self.root.find(i) is not None): | |
self.root.find(i).text = toxml[i] | |
elif (toxml[i] != '') & (self.root.find(i) is None): | |
newelem = etree.Element(i) | |
newelem.text = toxml[i] | |
self.root.find('ComicInfo').append(newelem) ←このへんはまだ試行錯誤中。動かない。 | |
elif toxml[i] == '': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_info(self, xml2write, filepath): ←xml2writeが渡されるStringIOオブジェクト | |
with zipfile.ZipFile(filepath, mode='w',) as z: | |
z.writestr('ComicInfo.xml', xml2write.getvalue()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Series>sleepless night</Series> | |
<Year>2008</Year> | |
<Day>27</Day> | |
<Manga>YesAndRightToLeft</Manga> | |
<Writer>八王子海パン突撃騎兵隊</Writer> | |
<Month>4</Month> | |
<Penciller>巻田佳春</Penciller> | |
<PageCount>18</PageCount> |
OlderNewer