Add from __future__ import unicode_literals, issue #37

This commit is contained in:
Roberto Rosario
2015-01-19 04:06:40 -04:00
parent efbac7300c
commit d59ea3ede2
334 changed files with 2452 additions and 2268 deletions

View File

@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import subprocess
@@ -9,7 +9,7 @@ from ..literals import (DEFAULT_FILE_FORMAT, DEFAULT_PAGE_NUMBER,
TRANSFORMATION_ROTATE, TRANSFORMATION_ZOOM)
from ..settings import IM_CONVERT_PATH, IM_IDENTIFY_PATH
CONVERTER_ERROR_STRING_NO_DECODER = u'no decode delegate for this image format'
CONVERTER_ERROR_STRING_NO_DECODER = 'no decode delegate for this image format'
class ImageMagick(ConverterBase):
@@ -36,28 +36,28 @@ class ImageMagick(ConverterBase):
dimensions.append(unicode(transformation['arguments']['width']))
if 'height' in transformation['arguments']:
dimensions.append(unicode(transformation['arguments']['height']))
arguments.append(u'-resize')
arguments.append(u'%s' % DIMENSION_SEPARATOR.join(dimensions))
arguments.append('-resize')
arguments.append('%s' % DIMENSION_SEPARATOR.join(dimensions))
elif transformation['transformation'] == TRANSFORMATION_ZOOM:
arguments.append(u'-resize')
arguments.append(u'%d%%' % transformation['arguments']['percent'])
arguments.append('-resize')
arguments.append('%d%%' % transformation['arguments']['percent'])
elif transformation['transformation'] == TRANSFORMATION_ROTATE:
arguments.append(u'-rotate')
arguments.append(u'%s' % transformation['arguments']['degrees'])
arguments.append('-rotate')
arguments.append('%s' % transformation['arguments']['degrees'])
except:
pass
if file_format.lower() == u'jpeg' or file_format.lower() == u'jpg':
arguments.append(u'-quality')
arguments.append(u'85')
if file_format.lower() == 'jpeg' or file_format.lower() == 'jpg':
arguments.append('-quality')
arguments.append('85')
# Imagemagick page number is 0 base
input_arg = u'%s[%d]' % (input_filepath, page - 1)
input_arg = '%s[%d]' % (input_filepath, page - 1)
# Specify the file format next to the output filename
output_filepath = u'%s:%s' % (file_format, output_filepath)
output_filepath = '%s:%s' % (file_format, output_filepath)
command = []
command.append(unicode(IM_CONVERT_PATH))