mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
MTP driver: Fix sorting on the title column of the device view. Fixes #1067562 (V 0.9.2 Sort on Title or Author doesn't work)
This commit is contained in:
parent
c612c17db5
commit
62c80eb670
@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from calibre.devices.interface import BookList as BL
|
from calibre.devices.interface import BookList as BL
|
||||||
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
from calibre.ebooks.metadata.book.json_codec import JsonCodec
|
from calibre.ebooks.metadata.book.json_codec import JsonCodec
|
||||||
from calibre.utils.date import utcnow
|
from calibre.utils.date import utcnow
|
||||||
@ -62,6 +63,12 @@ class Book(Metadata):
|
|||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.storage_id, self.mtp_relpath))
|
return hash((self.storage_id, self.mtp_relpath))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def title_sorter(self):
|
||||||
|
ans = getattr(self, 'title_sort', None)
|
||||||
|
if not ans or self.is_null('title_sort') or ans == _('Unknown'):
|
||||||
|
ans = ''
|
||||||
|
return ans or title_sort(self.title or '')
|
||||||
|
|
||||||
class JSONCodec(JsonCodec):
|
class JSONCodec(JsonCodec):
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user