mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix #4080 (Can't SAVE TO DISK from DEVICE)
This commit is contained in:
parent
0bcaa648bd
commit
7e45095b00
@ -34,6 +34,9 @@
|
||||
tickets: [4040]
|
||||
|
||||
bug fixes:
|
||||
- title: "Fix bug that prevented saving of books from a connected device to your computer on windows, for non SONY devices"
|
||||
tickets: [4080]
|
||||
|
||||
- title: Reorganize Dutch language news sources into Belgium and Netherlands categories
|
||||
tickets: [4098]
|
||||
|
||||
|
@ -5,6 +5,7 @@ Define the minimum interface that a device backend must satisfy to be used in
|
||||
the GUI. A device backend must subclass the L{Device} class. See prs500.py for
|
||||
a backend that implement the Device interface for the SONY PRS500 Reader.
|
||||
"""
|
||||
import os
|
||||
|
||||
from calibre.customize import Plugin
|
||||
|
||||
@ -29,6 +30,9 @@ class DevicePlugin(Plugin):
|
||||
THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
|
||||
# Whether the metadata on books can be set via the GUI.
|
||||
CAN_SET_METADATA = True
|
||||
#: Path separator for paths to books on device
|
||||
path_sep = os.sep
|
||||
|
||||
|
||||
def reset(self, key='-1', log_packets=False, report_progress=None) :
|
||||
"""
|
||||
|
@ -26,6 +26,7 @@ class PRS505(CLI, Device):
|
||||
description = _('Communicate with the Sony PRS-300/505/500 eBook reader.')
|
||||
author = _('Kovid Goyal and John Schember')
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
path_sep = '/'
|
||||
|
||||
FORMATS = ['epub', 'lrf', 'lrx', 'rtf', 'pdf', 'txt']
|
||||
|
||||
|
@ -799,7 +799,7 @@ class Manifest(object):
|
||||
try:
|
||||
data = etree.fromstring(data)
|
||||
except etree.XMLSyntaxError, err:
|
||||
self.log.exception('Initial parse failed:')
|
||||
self.oeb.log.exception('Initial parse failed:')
|
||||
repl = lambda m: ENTITYDEFS.get(m.group(1), m.group(0))
|
||||
data = ENTITY_RE.sub(repl, data)
|
||||
try:
|
||||
|
@ -248,7 +248,7 @@ class DeviceManager(Thread):
|
||||
def _save_books(self, paths, target):
|
||||
'''Copy books from device to disk'''
|
||||
for path in paths:
|
||||
name = path.rpartition('/')[2]
|
||||
name = path.rpartition(getattr(self.device, 'path_sep', '/'))[2]
|
||||
dest = os.path.join(target, name)
|
||||
if os.path.abspath(dest) != os.path.abspath(path):
|
||||
f = open(dest, 'wb')
|
||||
|
Loading…
x
Reference in New Issue
Block a user