mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Code cleanup
This commit is contained in:
@@ -36,12 +36,6 @@ import cbxarchive
|
||||
import pdfjpgextract
|
||||
|
||||
|
||||
def sort_nicely(l):
|
||||
convert = lambda text: int(text) if text.isdigit() else text
|
||||
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
|
||||
l.sort(key=alphanum_key)
|
||||
|
||||
|
||||
def buildHTML(path, imgfile):
|
||||
filename = getImageFileName(imgfile)
|
||||
if filename is not None:
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
__license__ = 'ISC'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2013, Ciro Mattia Gonano <ciromattia@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class PdfJpgExtract:
|
||||
def __init__(self, origFileName):
|
||||
self.origFileName = origFileName
|
||||
@@ -48,14 +49,14 @@ class PdfJpgExtract:
|
||||
istream = pdf.find("stream", i)
|
||||
if istream < 0:
|
||||
break
|
||||
istart = pdf.find(startmark, istream, istream+20)
|
||||
istart = pdf.find(startmark, istream, istream + 20)
|
||||
if istart < 0:
|
||||
i = istream+20
|
||||
i = istream + 20
|
||||
continue
|
||||
iend = pdf.find("endstream", istart)
|
||||
if iend < 0:
|
||||
raise Exception("Didn't find end of stream!")
|
||||
iend = pdf.find(endmark, iend-20)
|
||||
iend = pdf.find(endmark, iend - 20)
|
||||
if iend < 0:
|
||||
raise Exception("Didn't find end of JPG!")
|
||||
|
||||
@@ -63,10 +64,9 @@ class PdfJpgExtract:
|
||||
iend += endfix
|
||||
print "JPG %d from %d to %d" % (njpg, istart, iend)
|
||||
jpg = pdf[istart:iend]
|
||||
jpgfile = file(self.path+"/jpg%d.jpg" % njpg, "wb")
|
||||
jpgfile = file(self.path + "/jpg%d.jpg" % njpg, "wb")
|
||||
jpgfile.write(jpg)
|
||||
jpgfile.close()
|
||||
|
||||
njpg += 1
|
||||
i = iend
|
||||
|
||||
|
||||
26
setup.py
26
setup.py
@@ -16,8 +16,8 @@ ez_setup.use_setuptools()
|
||||
import sys
|
||||
from setuptools import setup
|
||||
|
||||
NAME='KindleComicConverter'
|
||||
VERSION="2.6-dev"
|
||||
NAME = 'KindleComicConverter'
|
||||
VERSION = "2.6-dev"
|
||||
mainscript = 'kcc.py'
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
@@ -29,12 +29,12 @@ if sys.platform == 'darwin':
|
||||
argv_emulation=True,
|
||||
iconfile='resources/comic2ebook.icns',
|
||||
plist=dict(
|
||||
CFBundleName = NAME,
|
||||
CFBundleShortVersionString = VERSION,
|
||||
CFBundleGetInfoString = NAME + " " + VERSION + ", written 2012-2013 by Ciro Mattia Gonano",
|
||||
CFBundleExecutable = NAME,
|
||||
CFBundleIdentifier = 'com.github.ciromattia.kcc',
|
||||
CFBundleSignature = 'dplt'
|
||||
CFBundleName=NAME,
|
||||
CFBundleShortVersionString=VERSION,
|
||||
CFBundleGetInfoString=NAME + " " + VERSION + ", written 2012-2013 by Ciro Mattia Gonano",
|
||||
CFBundleExecutable=NAME,
|
||||
CFBundleIdentifier='com.github.ciromattia.kcc',
|
||||
CFBundleSignature='dplt'
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -43,7 +43,7 @@ elif sys.platform == 'win32':
|
||||
from cx_Freeze import setup, Executable
|
||||
base = "Win32GUI"
|
||||
extra_options = dict(
|
||||
executables = [Executable("kcc.py", base=base)]
|
||||
executables=[Executable("kcc.py", base=base)]
|
||||
)
|
||||
else:
|
||||
extra_options = dict(
|
||||
@@ -57,10 +57,10 @@ setup(
|
||||
version=VERSION,
|
||||
author="Ciro Mattia Gonano",
|
||||
author_email="ciromattia@gmail.com",
|
||||
description=("A tool to convert comics (CBR/CBZ/PDFs/image folders) to Mobipocket."),
|
||||
license = "ISC License (ISCL)",
|
||||
keywords = "kindle comic mobipocket mobi cbz cbr manga",
|
||||
url = "http://github.com/ciromattia/kcc",
|
||||
description="A tool to convert comics (CBR/CBZ/PDFs/image folders) to Mobipocket.",
|
||||
license="ISC License (ISCL)",
|
||||
keywords="kindle comic mobipocket mobi cbz cbr manga",
|
||||
url="http://github.com/ciromattia/kcc",
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta'
|
||||
'License :: OSI Approved :: ISC License (ISCL)',
|
||||
|
||||
Reference in New Issue
Block a user