From f7b5ff982d6e6c0268a5c26d3a4f7c77871d145d Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Tue, 26 Feb 2013 16:52:37 +0100 Subject: [PATCH] Added primary-writing-mode metatag (fixes #19) --- kcc/comic2ebook.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 7fe5094..68797e3 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -83,11 +83,15 @@ def buildNCX(dstdir, title, chapters): f.close() return -def buildOPF(profile, dstdir, title, filelist, cover=None): +def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False): opffile = os.path.join(dstdir,'OEBPS','content.opf') # read the first file resolution profilelabel, deviceres, palette = image.ProfileData.Profiles[profile] imgres = str(deviceres[0]) + "x" + str(deviceres[1]) + if righttoleft: + writingmode = "horizontal-rl" + else: + writingmode = "horizontal-lr" f = open(opffile, "w") f.writelines(["\n", "\n", @@ -102,6 +106,7 @@ def buildOPF(profile, dstdir, title, filelist, cover=None): "\n", "\n", "\n", + "\n", "\n\n\n" ]) # set cover @@ -222,7 +227,7 @@ def genEpubStruct(path): buildNCX(path,options.title,chapterlist) # ensure we're sorting files alphabetically filelist = sorted(filelist, key=lambda name: (name[0].lower(), name[1].lower())) - buildOPF(options.profile,path,options.title,filelist,cover) + buildOPF(options.profile,path,options.title,filelist,cover,options.righttoleft) def getWorkFolder(file): workdir = tempfile.mkdtemp()