mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:24:49 +02:00
SONY drivers: Fix regression that broke collection ordering by series when sending to device
This commit is contained in:
parent
e94a44b1a3
commit
67b0c32f64
5 changed files with 21 additions and 5 deletions
|
|
@ -5,7 +5,7 @@
|
|||
# Also, each release can have new and improved recipes.
|
||||
|
||||
- version: 0.6.52
|
||||
date: 2010-07-30
|
||||
date: 2010-05-07
|
||||
|
||||
new features:
|
||||
- title: "Support for the Kobo Reader and the HTC Desire"
|
||||
|
|
|
|||
|
|
@ -390,9 +390,9 @@ def reorder_playlists(self):
|
|||
continue
|
||||
db_ids = [i.getAttribute('id') for i in pl.childNodes if hasattr(i, 'getAttribute')]
|
||||
pl_book_ids = [getattr(self.book_by_id(i), 'db_id', None) for i in db_ids]
|
||||
map = {}
|
||||
imap = {}
|
||||
for i, j in zip(pl_book_ids, db_ids):
|
||||
map[i] = j
|
||||
imap[i] = j
|
||||
pl_book_ids = [i for i in pl_book_ids if i is not None]
|
||||
ordered_ids = [i for i in self.tag_order[title] if i in pl_book_ids]
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ def reorder_playlists(self):
|
|||
child.unlink()
|
||||
for id in ordered_ids:
|
||||
item = self.document.createElement(self.prefix+'item')
|
||||
item.setAttribute('id', str(map[id]))
|
||||
item.setAttribute('id', str(imap[id]))
|
||||
pl.appendChild(item)
|
||||
|
||||
def fix_ids(main, carda, cardb):
|
||||
|
|
|
|||
|
|
@ -121,6 +121,14 @@ def books(self, oncard=None, end_session=True):
|
|||
self.report_progress(1.0, _('Getting list of books on device...'))
|
||||
return bl
|
||||
|
||||
def filename_callback(self, fname, mi):
|
||||
if getattr(mi, 'application_id', None) is not None:
|
||||
base = fname.rpartition('.')[0]
|
||||
suffix = '_%s'%mi.application_id
|
||||
if not base.endswith(suffix):
|
||||
fname = base + suffix + '.' + fname.rpartition('.')[-1]
|
||||
return fname
|
||||
|
||||
def upload_books(self, files, names, on_card=None, end_session=True,
|
||||
metadata=None):
|
||||
|
||||
|
|
|
|||
|
|
@ -825,7 +825,10 @@ def create_upload_path(self, path, mdata, fname, create_dirs=True):
|
|||
from calibre.library.save_to_disk import get_components
|
||||
if not isinstance(template, unicode):
|
||||
template = template.decode('utf-8')
|
||||
extra_components = get_components(template, mdata, fname)
|
||||
app_id = str(getattr(mdata, 'application_id', ''))
|
||||
# The SONY readers need to have the db id in the created filename
|
||||
extra_components = get_components(template, mdata, fname,
|
||||
length=250-len(app_id)-1)
|
||||
if not extra_components:
|
||||
extra_components.append(sanitize(self.filename_callback(fname,
|
||||
mdata)))
|
||||
|
|
|
|||
|
|
@ -26,3 +26,8 @@ def server_config(defaults=None):
|
|||
help=_('The maximum number of matches to return per OPDS query. '
|
||||
'This affects Stanza, WordPlayer, etc. integration.'))
|
||||
return c
|
||||
|
||||
def db():
|
||||
from calibre.library.database2 import LibraryDatabase2
|
||||
from calibre.utils.config import prefs
|
||||
return LibraryDatabase2(prefs['library_path'])
|
||||
|
|
|
|||
Loading…
Reference in a new issue