diff --git a/src/calibre/devices/mtp/driver.py b/src/calibre/devices/mtp/driver.py index be2bab7638..1584a3bf93 100644 --- a/src/calibre/devices/mtp/driver.py +++ b/src/calibre/devices/mtp/driver.py @@ -108,10 +108,12 @@ class MTP_DEVICE(BASE): f = storage.find_path((self.DRIVEINFO,)) dinfo = {} if f is not None: - stream = self.get_mtp_file(f) try: + stream = self.get_mtp_file(f) dinfo = json.load(stream, object_hook=from_json) except: + prints('Failed to load existing driveinfo.calibre file, with error:') + traceback.print_exc() dinfo = None if dinfo.get('device_store_uuid', None) is None: dinfo['device_store_uuid'] = unicode(uuid.uuid4()) diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index 11f1b4a339..cff1527b6f 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -678,11 +678,12 @@ class CoversModel(QAbstractListModel): # {{{ good = [] pmap = {} dcovers = sorted(self.covers[1:], key=self.cover_keygen, reverse=True) + cmap = {x:self.covers.index(x) for x in self.covers} for i, x in enumerate(self.covers[0:1] + dcovers): if not x[-1]: good.append(x) if i > 0: - plugin = self.plugin_for_index(i) + plugin = self.plugin_for_index(cmap[x]) pmap[plugin] = len(good) - 1 self.covers = good self.plugin_map = pmap