Minor fixes.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Tue, 11 Aug 2015 08:39:05 +0000 (10:39 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Tue, 11 Aug 2015 08:39:05 +0000 (10:39 +0200)
librarian/book2anything.py
librarian/cover.py
librarian/picture.py

index 20cae8f..55ab599 100755 (executable)
@@ -125,7 +125,7 @@ class Book2Anything(object):
             if not (options.output_file or options.output_dir):
                 output_file = os.path.splitext(main_input)[0] + '.' + cls.ext
             else:
             if not (options.output_file or options.output_dir):
                 output_file = os.path.splitext(main_input)[0] + '.' + cls.ext
             else:
-                output_file = None
+                output_file = options.output_file
 
             # Do the transformation.
             doc = WLDocument.from_file(main_input, provider=provider, **parser_args)
 
             # Do the transformation.
             doc = WLDocument.from_file(main_input, provider=provider, **parser_args)
index 21eedc3..0266b4e 100644 (file)
@@ -142,6 +142,8 @@ class Cover(object):
         self.title = book_info.title
         if format is not None:
             self.format = format
         self.title = book_info.title
         if format is not None:
             self.format = format
+        if width and height:
+            self.height = height * self.width / width
         scale = max(float(width or 0) / self.width, float(height or 0) / self.height)
         if scale >= 1:
             self.scale = scale
         scale = max(float(width or 0) / self.width, float(height or 0) / self.height)
         if scale >= 1:
             self.scale = scale
index 5a0c47b..6fc40b1 100644 (file)
@@ -120,7 +120,7 @@ class WLPicture(object):
         data = data.replace(u'\ufeff', '')
 
         # assume images are in the same directory
         data = data.replace(u'\ufeff', '')
 
         # assume images are in the same directory
-        if image_store is None and xmlfile.name is not None:
+        if image_store is None and getattr(xmlfile, 'name', None):
             image_store = ImageStore(path.dirname(xmlfile.name))
 
         try:
             image_store = ImageStore(path.dirname(xmlfile.name))
 
         try: