Fix path problem (typo in name). Make cover size device selectable.

This commit is contained in:
Charles Haley 2012-09-18 14:54:13 +02:00
parent dde1512191
commit db967f62ba

View File

@ -200,6 +200,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
PATH_FUDGE_FACTOR = 40 PATH_FUDGE_FACTOR = 40
THUMBNAIL_HEIGHT = 160 THUMBNAIL_HEIGHT = 160
DEFAULT_THUMBNAIL_HEIGHT = 160
PREFIX = '' PREFIX = ''
BACKLOADING_ERROR_MESSAGE = None BACKLOADING_ERROR_MESSAGE = None
@ -370,9 +372,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
fname = sanitize(fname) fname = sanitize(fname)
ext = os.path.splitext(fname)[1] ext = os.path.splitext(fname)[1]
maxlen = (self.WINDOWS_MAX_PATH_LEN - maxlen = (self.MAX_PATH_LEN - (self.PATH_FUDGE_FACTOR +
(self.WINDOWS_PATH_FUDGE_FACTOR + self.exts_path_lengths.get(ext, self.PATH_FUDGE_FACTOR)))
self.exts_path_lengths.get(ext, self.WINDOWS_PATH_FUDGE_FACTOR)))
special_tag = None special_tag = None
if mdata.tags: if mdata.tags:
@ -646,7 +647,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
v = self.known_metadata.get(book.lpath, None) v = self.known_metadata.get(book.lpath, None)
if v is not None: if v is not None:
return (v.get('uuid', None) == book.get('uuid', None) and return (v.get('uuid', None) == book.get('uuid', None) and
v.get('last_modified', None) == book.get('last_modified', None)) v.get('last_modified', None) == book.get('last_modified', None) and
v.get('thumbnail', None) == book.get('thumbnail', None))
return False return False
def _set_known_metadata(self, book, remove=False): def _set_known_metadata(self, book, remove=False):
@ -841,6 +843,14 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
self.exts_path_lengths = result.get('extensionPathLengths', {}) self.exts_path_lengths = result.get('extensionPathLengths', {})
self._debug('extension path lengths', self.exts_path_lengths) self._debug('extension path lengths', self.exts_path_lengths)
self.THUMBNAIL_HEIGHT = result.get('coverHeight', self.DEFAULT_THUMBNAIL_HEIGHT)
if 'coverWidth' in result:
# Setting this field forces the aspect ratio
self.THUMBNAIL_WIDTH = result.get('coverWidth',
(self.DEFAULT_THUMBNAIL_HEIGHT/3) * 4)
elif hasattr(self, 'THUMBNAIL_WIDTH'):
delattr(self, 'THUMBNAIL_WIDTH')
if password: if password:
returned_hash = result.get('passwordHash', None) returned_hash = result.get('passwordHash', None)
if result.get('passwordHash', None) is None: if result.get('passwordHash', None) is None:
@ -1137,7 +1147,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
client_will_stream_binary = 'willStreamBinary' in result client_will_stream_binary = 'willStreamBinary' in result
if (client_will_stream_binary): if (client_will_stream_binary):
length = result.get('fileLength'); length = result.get('fileLength')
remaining = length remaining = length
while remaining > 0: while remaining > 0: