mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Fix various bugs in rtf2lrf
This commit is contained in:
parent
2a779db7bd
commit
2166441cc2
@ -13,7 +13,7 @@
|
|||||||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
''' E-book management software'''
|
''' E-book management software'''
|
||||||
__version__ = "0.3.64"
|
__version__ = "0.3.65"
|
||||||
__docformat__ = "epytext"
|
__docformat__ = "epytext"
|
||||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||||
__appname__ = 'libprs500'
|
__appname__ = 'libprs500'
|
||||||
@ -22,6 +22,12 @@ import sys, os
|
|||||||
iswindows = 'win32' in sys.platform.lower()
|
iswindows = 'win32' in sys.platform.lower()
|
||||||
isosx = 'darwin' in sys.platform.lower()
|
isosx = 'darwin' in sys.platform.lower()
|
||||||
|
|
||||||
|
if iswindows:
|
||||||
|
try:
|
||||||
|
import WmfPlugin
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def load_library(name, cdll):
|
def load_library(name, cdll):
|
||||||
if iswindows:
|
if iswindows:
|
||||||
return cdll.LoadLibrary(name)
|
return cdll.LoadLibrary(name)
|
||||||
|
@ -770,7 +770,12 @@ class HTMLConverter(object):
|
|||||||
if self.scaled_images.has_key(path):
|
if self.scaled_images.has_key(path):
|
||||||
path = self.scaled_images[path].name
|
path = self.scaled_images[path].name
|
||||||
|
|
||||||
im = PILImage.open(path)
|
try:
|
||||||
|
im = PILImage.open(path)
|
||||||
|
except IOError, err:
|
||||||
|
print >>sys.stderr, 'Unable to process:', path, err
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if width == None or height == None:
|
if width == None or height == None:
|
||||||
width, height = im.size
|
width, height = im.size
|
||||||
|
@ -89,22 +89,25 @@ def main():
|
|||||||
sys.argv.append('-o')
|
sys.argv.append('-o')
|
||||||
sys.argv.append(os.path.splitext(os.path.basename(rtf))[0]+ext)
|
sys.argv.append(os.path.splitext(os.path.basename(rtf))[0]+ext)
|
||||||
|
|
||||||
if not options.title or options.title == 'Unknown':
|
if (not options.title or options.title == 'Unknown') and mi.title:
|
||||||
sys.argv.append('-t')
|
sys.argv.append('-t')
|
||||||
sys.argv.append('"'+mi.title+'"')
|
sys.argv.append('"'+mi.title+'"')
|
||||||
if not options.author or options.author == 'Unknown':
|
if (not options.author or options.author == 'Unknown') and mi.author:
|
||||||
sys.argv.append('-a')
|
sys.argv.append('-a')
|
||||||
sys.argv.append('"'+mi.author+'"')
|
sys.argv.append('"'+mi.author+'"')
|
||||||
if not options.category or options.category == 'Unknown' and mi.category:
|
if (not options.category or options.category == 'Unknown') and mi.category:
|
||||||
sys.argv.append('--category')
|
sys.argv.append('--category')
|
||||||
sys.argv.append('"'+mi.category+'"')
|
sys.argv.append('"'+mi.category+'"')
|
||||||
if not options.freetext or options.freetext == 'Unknown' and mi.comments:
|
if (not options.freetext or options.freetext == 'Unknown') and mi.comments:
|
||||||
sys.argv.append('--comment')
|
sys.argv.append('--comment')
|
||||||
sys.argv.append('"'+mi.comments+'"')
|
sys.argv.append('"'+mi.comments+'"')
|
||||||
options, args, parser = html_parse_options(parser=parser)
|
options, args, parser = html_parse_options(parser=parser)
|
||||||
process_file(html, options)
|
process_file(html, options)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tdir)
|
#try:
|
||||||
|
shutil.rmtree(tdir)
|
||||||
|
#except: # Windows can raise an error if some file is still being used
|
||||||
|
# pass
|
||||||
except ConversionError, err:
|
except ConversionError, err:
|
||||||
print >>sys.stderr, err
|
print >>sys.stderr, err
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -297,7 +297,7 @@ setup(
|
|||||||
'optimize' : 2,
|
'optimize' : 2,
|
||||||
'dist_dir' : PY2EXE_DIR,
|
'dist_dir' : PY2EXE_DIR,
|
||||||
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg'],
|
'includes' : ['sip', 'pkg_resources', 'PyQt4.QtSvg'],
|
||||||
'packages' : ['PIL'],
|
'packages' : ['PIL', 'WmfPlugin'],
|
||||||
'excludes' : ["Tkconstants", "Tkinter", "tcl",
|
'excludes' : ["Tkconstants", "Tkinter", "tcl",
|
||||||
"_imagingtk", "ImageTk", "FixTk",
|
"_imagingtk", "ImageTk", "FixTk",
|
||||||
'pydoc'],
|
'pydoc'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user