From 7a1d05199e7813d17ce4f59f38f5ed0fa96f6870 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 3 Sep 2012 15:01:35 +0530 Subject: [PATCH] ... --- src/calibre/devices/mtp/base.py | 5 +++-- src/calibre/devices/mtp/driver.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/mtp/base.py b/src/calibre/devices/mtp/base.py index 26523362ed..bad027baa1 100644 --- a/src/calibre/devices/mtp/base.py +++ b/src/calibre/devices/mtp/base.py @@ -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): diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index 8bc2481205..f36b068a30 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -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() # }}}