mirror of
https://github.com/ciromattia/kcc
synced 2025-12-22 06:01:49 +00:00
Do not call kindlegen if source epub is bigger than 300MB (closes #17)
This commit is contained in:
27
kcc/gui.py
27
kcc/gui.py
@@ -188,9 +188,10 @@ class MainWindow:
|
|||||||
self.progress_overall['value'] = 0
|
self.progress_overall['value'] = 0
|
||||||
self.progress_overall['maximum'] = left_files
|
self.progress_overall['maximum'] = left_files
|
||||||
for entry in self.filelist:
|
for entry in self.filelist:
|
||||||
filenum += 1
|
self.progress_overall['value'] = filenum
|
||||||
self.progress_file['value'] = 1
|
self.progress_file['value'] = 1
|
||||||
self.master.update()
|
self.master.update()
|
||||||
|
filenum += 1
|
||||||
subargv = list(argv)
|
subargv = list(argv)
|
||||||
try:
|
try:
|
||||||
subargv.append(entry)
|
subargv.append(entry)
|
||||||
@@ -205,6 +206,12 @@ class MainWindow:
|
|||||||
continue
|
continue
|
||||||
if self.options['Aepub_only'].get() == 0:
|
if self.options['Aepub_only'].get() == 0:
|
||||||
try:
|
try:
|
||||||
|
if os.path.getsize(epub_path) > 314572800:
|
||||||
|
# do not call kindlegen if source is bigger than 300MB
|
||||||
|
tkMessageBox.showwarning('KindleGen Warning',
|
||||||
|
"ePub file %s is bigger than 300MB, not suitable for kindlegen" %
|
||||||
|
epub_path)
|
||||||
|
continue
|
||||||
retcode = call("kindlegen \"" + epub_path + "\"", shell=True)
|
retcode = call("kindlegen \"" + epub_path + "\"", shell=True)
|
||||||
if retcode < 0:
|
if retcode < 0:
|
||||||
print >>sys.stderr, "Child was terminated by signal", -retcode
|
print >>sys.stderr, "Child was terminated by signal", -retcode
|
||||||
@@ -229,19 +236,15 @@ class MainWindow:
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self.progress_file['value'] = 4
|
self.progress_file['value'] = 4
|
||||||
self.master.update()
|
self.master.update()
|
||||||
self.progress_overall['value'] = filenum
|
|
||||||
self.master.update()
|
|
||||||
if errors:
|
if errors:
|
||||||
tkMessageBox.showinfo(
|
tkMessageBox.showwarning("Done", "Conversion completed with errors.")
|
||||||
"Done",
|
|
||||||
"Conversion failed. Errors have been reported."
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
tkMessageBox.showinfo(
|
tkMessageBox.showinfo("Done", "Conversion successful!")
|
||||||
"Done",
|
# reset progressbars
|
||||||
"Conversion successful!"
|
self.progress_overall['value'] = 0
|
||||||
)
|
self.progress_file['value'] = 0
|
||||||
|
self.master.update()
|
||||||
|
|
||||||
def remove_readonly(self, fn, path):
|
def remove_readonly(self, fn, path):
|
||||||
if fn is os.rmdir:
|
if fn is os.rmdir:
|
||||||
|
|||||||
Reference in New Issue
Block a user