mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Fix various regression caused by recent device driver refactoring
This commit is contained in:
parent
d182cbbb79
commit
cbb1407bd0
@ -51,6 +51,7 @@ class PRS505(CLI, Device):
|
||||
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
MUST_READ_METADATA = True
|
||||
EBOOK_DIR_MAIN = 'database/media/books'
|
||||
|
||||
def open(self):
|
||||
Device.open(self)
|
||||
@ -113,7 +114,7 @@ class PRS505(CLI, Device):
|
||||
|
||||
path = self._sanity_check(on_card, files)
|
||||
|
||||
paths, ctimes = [], []
|
||||
paths, ctimes, sizes = [], [], []
|
||||
names = iter(names)
|
||||
metadata = iter(metadata)
|
||||
for i, infile in enumerate(files):
|
||||
@ -121,10 +122,9 @@ class PRS505(CLI, Device):
|
||||
filepath = self.create_upload_path(path, mdata, fname)
|
||||
|
||||
paths.append(filepath)
|
||||
|
||||
self.put_file(infile, paths[-1], replace_file=True)
|
||||
|
||||
ctimes.append(os.path.getctime(paths[-1]))
|
||||
sizes.append(os.stat(paths[-1]).st_size)
|
||||
|
||||
self.report_progress((i+1) / float(len(files)), _('Transferring books to device...'))
|
||||
|
||||
|
@ -22,7 +22,7 @@ from itertools import repeat
|
||||
from math import ceil
|
||||
|
||||
from calibre.devices.interface import DevicePlugin
|
||||
from calibre.devices.errors import DeviceError
|
||||
from calibre.devices.errors import DeviceError, FreeSpaceError
|
||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||
from calibre import iswindows, islinux, isosx, __appname__
|
||||
from calibre.utils.filenames import ascii_filename as sanitize
|
||||
@ -57,6 +57,11 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
SUPPORTS_SUB_DIRS = False
|
||||
MUST_READ_METADATA = False
|
||||
|
||||
EBOOK_DIR_MAIN = ''
|
||||
EBOOK_DIR_CARD_A = ''
|
||||
EBOOK_DIR_CARD_B = ''
|
||||
DELETE_EXTS = []
|
||||
|
||||
FDI_TEMPLATE = \
|
||||
'''
|
||||
<device>
|
||||
@ -634,11 +639,14 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
raise DeviceError(_('Selected slot: %s is not supported.') % on_card)
|
||||
|
||||
if on_card == 'carda':
|
||||
path = os.path.join(self._card_a_prefix, self.EBOOK_DIR_CARD_A)
|
||||
path = os.path.join(self._card_a_prefix,
|
||||
*(self.EBOOK_DIR_CARD_A.split('/')))
|
||||
elif on_card == 'cardb':
|
||||
path = os.path.join(self._card_b_prefix, self.EBOOK_DIR_CARD_B)
|
||||
path = os.path.join(self._card_b_prefix,
|
||||
*(self.EBOOK_DIR_CARD_B.split('/')))
|
||||
else:
|
||||
path = os.path.join(self._main_prefix, self.EBOOK_DIR_MAIN)
|
||||
path = os.path.join(self._main_prefix,
|
||||
*(self.EBOOK_DIR_MAIN.split('/')))
|
||||
|
||||
def get_size(obj):
|
||||
if hasattr(obj, 'seek'):
|
||||
|
@ -31,10 +31,6 @@ class USBMS(CLI, Device):
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
FORMATS = []
|
||||
EBOOK_DIR_MAIN = ''
|
||||
EBOOK_DIR_CARD_A = ''
|
||||
EBOOK_DIR_CARD_B = ''
|
||||
DELETE_EXTS = []
|
||||
CAN_SET_METADATA = False
|
||||
|
||||
def reset(self, key='-1', log_packets=False, report_progress=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user