Merge from trunk

This commit is contained in:
Charles Haley 2012-10-10 09:51:44 +02:00
commit 8b1ca1d3bf
2 changed files with 5 additions and 2 deletions

View File

@ -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())

View File

@ -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