SONY driver: Remove comments from books sent to SONY readers as the reader chokes on them

This commit is contained in:
Kovid Goyal 2011-09-09 11:10:54 -06:00
parent 5bd51689e5
commit 0bb10e3f81
3 changed files with 12 additions and 0 deletions

View File

@ -74,6 +74,12 @@ class DevicePlugin(Plugin):
#: For example: ``frozenset(['kobo'])``
VIRTUAL_BOOK_EXTENSIONS = frozenset([])
#: Whether to nuke comments in the copy of the book sent to the device. If
#: not None this should be short string that the comments will be replaced
#: by.
NUKE_COMMENTS = None
@classmethod
def get_gui_name(cls):
if hasattr(cls, 'gui_name'):

View File

@ -56,6 +56,8 @@ class PRS505(USBMS):
SUPPORTS_SUB_DIRS = True
MUST_READ_METADATA = True
NUKE_COMMENTS = _('Comments have been removed as the SONY reader'
' chokes on them')
SUPPORTS_USE_AUTHOR_SORT = True
EBOOK_DIR_MAIN = 'database/media/books'
SCAN_FROM_ROOT = False

View File

@ -391,6 +391,10 @@ class DeviceManager(Thread): # {{{
newmi.template_to_attribute(mi, cpb)
else:
newmi = mi
nuke_comments = getattr(self.connected_device,
'NUKE_COMMENTS', None)
if nuke_comments is not None:
mi.comments = nuke_comments
set_metadata(stream, newmi, stream_type=ext)
except:
if DEBUG: