mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 19:02:37 +02:00
IGN:Clean up USBMS driver code
This commit is contained in:
parent
8baa05b43b
commit
3edec280e8
2 changed files with 10 additions and 6 deletions
|
|
@ -9,10 +9,15 @@
|
|||
import os, time
|
||||
|
||||
from calibre.devices.interface import Device as _Device
|
||||
from calibre.devices.errors import DeviceError, FreeSpaceError
|
||||
from calibre.devices.errors import DeviceError
|
||||
from calibre import iswindows, islinux, isosx, __appname__
|
||||
|
||||
class Device(_Device):
|
||||
'''
|
||||
This class provides logic common to all drivers for devices that export themselves
|
||||
as USB Mass Storage devices. If you are writing such a driver, inherit from this
|
||||
class.
|
||||
'''
|
||||
|
||||
FDI_TEMPLATE = \
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
|
||||
'''
|
||||
Generic USB Mass storage device driver. This is not a complete stand alone
|
||||
driver. It is intended to be subclassed with the relevant parts implemented
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
from calibre.devices.usbms.device import Device
|
||||
from calibre.devices.usbms.books import BookList, Book
|
||||
from calibre.devices.errors import FreeSpaceError
|
||||
|
||||
class USBMS(Device):
|
||||
EBOOK_DIR = ''
|
||||
|
|
@ -57,11 +58,9 @@ def upload_books(self, files, names, on_card=False, end_session=True):
|
|||
size = sum(sizes)
|
||||
|
||||
if on_card and size > self.free_space()[2] - 1024*1024:
|
||||
raise FreeSpaceError("There is insufficient free space "+\
|
||||
"on the storage card")
|
||||
raise FreeSpaceError(_("There is insufficient free space on the storage card"))
|
||||
if not on_card and size > self.free_space()[0] - 2*1024*1024:
|
||||
raise FreeSpaceError("There is insufficient free space " +\
|
||||
"in main memory")
|
||||
raise FreeSpaceError(_("There is insufficient free space in main memory"))
|
||||
|
||||
paths = []
|
||||
names = iter(names)
|
||||
|
|
|
|||
Loading…
Reference in a new issue