Skip to content

Commit

Permalink
Merge pull request #169 from ciromattia/dev
Browse files Browse the repository at this point in the history
5.0.1
  • Loading branch information
AcidWeb committed Nov 6, 2015
2 parents 241801f + 5481c0c commit 4b1c7b3
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FROM acidweb/kcc-base
MAINTAINER Paweł Jastrzębski <pawelj@iosphe.re>

ENV KCCVER 5.0
ENV KCCVER 5.0.1
ADD . /app

RUN pip3 install pillow python-slugify psutil scandir pyinstaller
Expand All @@ -12,7 +12,7 @@ RUN useradd -ms /bin/bash kcc && chown -R kcc:kcc /app

USER kcc
WORKDIR /app
RUN pyinstaller -F -s kcc.py
RUN pyinstaller -F -s --noupx kcc.py
RUN mkdir -p dist/usr/bin dist/usr/share/applications dist/usr/share/doc/kindlecomicconverter dist/usr/share/kindlecomicconverter dist/usr/share/lintian/overrides
RUN mv dist/kcc dist/usr/bin
RUN cp icons/comic2ebook.png dist/usr/share/kindlecomicconverter
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ The app relies and includes the following scripts:
* [Kobo Aura H2O](http://kcc.iosphe.re/Samples/Ubunchu-KoAH2O.kepub.epub)

## CHANGELOG
####5.0.1:
* Fixed Panel View placement issues
* Decreased application startup time
* Fixed multiple smaller issues

####5.0:
* Major overhaul of internal mechanisms and GUI
* Added cover upload feature
Expand Down
2 changes: 1 addition & 1 deletion kcc.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "Kindle Comic Converter"
#define MyAppVersion "5.0"
#define MyAppVersion "5.0.1"
#define MyAppPublisher "Ciro Mattia Gonano, Paweł Jastrzębski"
#define MyAppURL "http://kcc.iosphe.re/"
#define MyAppExeName "KCC.exe"
Expand Down
2 changes: 1 addition & 1 deletion kcc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '5.0'
__version__ = '5.0.1'
__license__ = 'ISC'
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
__docformat__ = 'restructuredtext en'
27 changes: 14 additions & 13 deletions kcc/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def buildHTML(path, imgfile, imgfilepath):
os.makedirs(htmlpath)
htmlfile = os.path.join(htmlpath, filename[0] + '.xhtml')
f = open(htmlfile, "w", encoding='UTF-8')
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
"<!DOCTYPE html>\n",
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n",
"<head>\n",
Expand Down Expand Up @@ -182,15 +182,16 @@ def buildHTML(path, imgfile, imgfilepath):
boxes = []
for i in range(0, len(boxes)):
f.writelines(["<div id=\"" + boxes[i] + "\">\n",
"<a class=\"app-amzn-magnify\" data-app-amzn-magnify='{\"targetId\":\"" + boxes[i] +
"<a style=\"display:inline-block;width:100%;height:100%;\" class=\"app-amzn-magnify\" "
"data-app-amzn-magnify='{\"targetId\":\"" + boxes[i] +
"-P\", \"ordinal\":" + str(order[i]) + "}'></a>\n",
"</div>\n"])
f.write("</div>\n")
for box in boxes:
f.writelines(["<div class=\"PV-P\" id=\"" + box + "-P\" style=\"" + additionalStyle + "\">\n",
"<img style=\"" + boxStyles[box] + "\" src=\"", "../" * backref, "Images/", postfix,
imgfilepv, "\" width=\"" + str(size[0]) + "\" height=\"" + str(size[1]) + "\"/>\n",
"</div>\n"])
f.write("</div>\n")
f.writelines(["</body>\n",
"</html>\n"])
f.close()
Expand All @@ -210,8 +211,7 @@ def buildNCX(dstdir, title, chapters, chapterNames):
"<meta name=\"generated\" content=\"true\"/>\n",
"</head>\n",
"<docTitle><text>", escape(title), "</text></docTitle>\n",
"<navMap>"
])
"<navMap>\n"])
for chapter in chapters:
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
filename = getImageFileName(os.path.join(folder, chapter[1]))
Expand Down Expand Up @@ -252,8 +252,7 @@ def buildNAV(dstdir, title, chapters, chapterNames):
f.writelines(["</ol>\n",
"</nav>\n",
"<nav epub:type=\"page-list\">\n",
"<ol>\n"
])
"<ol>\n"])
for chapter in chapters:
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
filename = getImageFileName(os.path.join(folder, chapter[1]))
Expand Down Expand Up @@ -393,6 +392,8 @@ def buildEPUB(path, chapterNames, tomeNumber):
"position: absolute;\n",
"width: 100%;\n",
"height: 100%;\n",
"top: 0;\n",
"left: 0;\n",
"}\n",
"#PV-T {\n",
"top: 0;\n",
Expand All @@ -406,41 +407,41 @@ def buildEPUB(path, chapterNames, tomeNumber):
"}\n",
"#PV-L {\n",
"left: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 100%;\n",
"float: left;\n",
"}\n",
"#PV-R {\n",
"right: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 100%;\n",
"float: right;\n",
"}\n",
"#PV-TL {\n",
"top: 0;\n",
"left: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 50%;\n",
"float: left;\n",
"}\n",
"#PV-TR {\n",
"top: 0;\n",
"right: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 50%;\n",
"float: right;\n",
"}\n",
"#PV-BL {\n",
"bottom: 0;\n",
"left: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 50%;\n",
"float: left;\n",
"}\n",
"#PV-BR {\n",
"bottom: 0;\n",
"right: 0;\n",
"width: 50%;\n",
"width: 49.5%;\n",
"height: 50%;\n",
"float: right;\n",
"}\n",
Expand Down
6 changes: 4 additions & 2 deletions kcc/kindle.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def __init__(self):
self.coverSupport = False

def findDevice(self):
for drive in psutil.disk_partitions(False):
if 'removable' in drive[3] or 'vfat' in drive[2] or 'msdos' in drive[2]:
for drive in reversed(psutil.disk_partitions(False)):
if (drive[2] == 'FAT32' and drive[3] == 'rw,removable') or \
(drive[2] == 'vfat' and 'rw' in drive[3]) or \
(drive[2] == 'msdos' and 'rw' in drive[3]):
if os.path.isdir(os.path.join(drive[1], 'system')) and \
os.path.isdir(os.path.join(drive[1], 'documents')):
return drive[1]
Expand Down
14 changes: 7 additions & 7 deletions kcc/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,27 @@ def check7ZFile(filePath):


def saferReplace(old, new):
for x in range(50):
for x in range(10):
try:
os.replace(old, new)
except PermissionError:
sleep(0.1)
sleep(1)
else:
break
else:
raise PermissionError
raise PermissionError("Failed to move the file.")


def saferRemove(target):
for x in range(50):
for x in range(10):
try:
os.remove(target)
except PermissionError:
sleep(0.1)
sleep(1)
else:
break
else:
raise PermissionError
raise PermissionError("Failed to remove the file.")


def removeFromZIP(zipfname, *filenames):
Expand Down Expand Up @@ -146,7 +146,7 @@ def sanitizeTrace(traceback):
return ''.join(format_tb(traceback))\
.replace('C:\\Users\\pawel\\Documents\\Projekty\\KCC\\', '')\
.replace('C:\\Python34\\', '')\
.replace('C:\\Python34_64\\', '')
.replace('c:\\python34\\', '')


def dependencyCheck(level):
Expand Down
6 changes: 3 additions & 3 deletions other/osx/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>MacOS/Kindle Comic Converter</string>
<key>CFBundleGetInfoString</key>
<string>KindleComicConverter 5.0, written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski</string>
<string>KindleComicConverter 5.0.1, written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski</string>
<key>CFBundleIconFile</key>
<string>comic2ebook.icns</string>
<key>CFBundleIdentifier</key>
Expand All @@ -21,11 +21,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.0</string>
<string>5.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.0.0</string>
<string>5.0.1</string>
<key>LSEnvironment</key>
<dict>
<key>PATH</key>
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def finalize_options(self):

def run(self):
if sys.platform == 'darwin':
os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s kcc.py')
os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s --noupx kcc.py')
shutil.copy('other/osx/7za', 'dist/Kindle Comic Converter.app/Contents/Resources')
shutil.copy('other/osx/unrar', 'dist/Kindle Comic Converter.app/Contents/Resources')
shutil.copy('other/osx/Info.plist', 'dist/Kindle Comic Converter.app/Contents')
Expand All @@ -51,7 +51,7 @@ def run(self):
os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg')
exit(0)
elif sys.platform == 'win32':
os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w kcc.py')
os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w --noupx kcc.py')
if os.path.isfile('setup.bat'):
os.system('setup.bat ' + VERSION)
exit(0)
Expand Down

0 comments on commit 4b1c7b3

Please sign in to comment.