This commit is contained in:
Kovid Goyal 2012-09-03 15:01:35 +05:30
parent 0b02c1f593
commit 7a1d05199e
2 changed files with 12 additions and 2 deletions

View File

@ -45,8 +45,9 @@ class MTPDeviceBase(DevicePlugin):
def set_progress_reporter(self, report_progress):
self.report_progress = report_progress
def get_gui_name(self):
return self.current_friendly_name or self.name
@classmethod
def get_gui_name(cls):
return getattr(cls, 'current_friendly_name', cls.gui_name)
def is_usb_connected(self, devices_on_system, debug=False,
only_presence=False):

View File

@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en'
import json, traceback, posixpath, importlib, os
from io import BytesIO
from itertools import izip
from calibre import prints
from calibre.constants import iswindows, numeric_version
@ -244,10 +245,18 @@ class MTP_DEVICE(BASE):
)
return tuple(x.lower() for x in filepath.split('/'))
def prefix_for_location(self, on_card):
# TODO: Implement this
return 'calibre'
def upload_books(self, files, names, on_card=None, end_session=True,
metadata=None):
from calibre.devices.utils import sanity_check
sanity_check(on_card, files, self.card_prefix(), self.free_space())
prefix = self.prefix_for_location(on_card)
for infile, fname, mi in izip(files, names, metadata):
path = self.create_upload_path(prefix, mi, fname)
print (1111111, path)
raise NotImplementedError()
# }}}