Consolidate all sony drivers into one class

This commit is contained in:
Kovid Goyal 2010-05-20 00:09:20 -06:00
parent 37bfe8109d
commit 676bf2b00a
2 changed files with 20 additions and 34 deletions

View File

@ -442,7 +442,7 @@ from calibre.devices.irexdr.driver import IREXDR1000, IREXDR800
from calibre.devices.jetbook.driver import JETBOOK from calibre.devices.jetbook.driver import JETBOOK
from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX
from calibre.devices.nook.driver import NOOK from calibre.devices.nook.driver import NOOK
from calibre.devices.prs505.driver import PRS505, PRS700 from calibre.devices.prs505.driver import PRS505
from calibre.devices.android.driver import ANDROID, S60 from calibre.devices.android.driver import ANDROID, S60
from calibre.devices.nokia.driver import N770, N810 from calibre.devices.nokia.driver import N770, N810
from calibre.devices.eslick.driver import ESLICK from calibre.devices.eslick.driver import ESLICK
@ -510,7 +510,6 @@ plugins += [
KINDLE_DX, KINDLE_DX,
NOOK, NOOK,
PRS505, PRS505,
PRS700,
ANDROID, ANDROID,
S60, S60,
N770, N770,

View File

@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net> ' \ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'2009, John Schember <john at nachtimwald.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
''' '''
Device driver for the SONY PRS-505 Device driver for the SONY devices
''' '''
import os import os
@ -20,27 +17,33 @@ from calibre import __appname__
class PRS505(USBMS): class PRS505(USBMS):
name = 'PRS-300/505 Device Interface' name = 'SONY Device Interface'
gui_name = 'SONY Reader' gui_name = 'SONY Reader'
description = _('Communicate with the Sony PRS-300/505/500 eBook reader.') description = _('Communicate with all the Sony eBook readers.')
author = 'Kovid Goyal and John Schember' author = 'Kovid Goyal'
supported_platforms = ['windows', 'osx', 'linux'] supported_platforms = ['windows', 'osx', 'linux']
path_sep = '/' path_sep = '/'
FORMATS = ['epub', 'lrf', 'lrx', 'rtf', 'pdf', 'txt'] FORMATS = ['epub', 'lrf', 'lrx', 'rtf', 'pdf', 'txt']
VENDOR_ID = [0x054c] #: SONY Vendor Id VENDOR_ID = [0x054c] #: SONY Vendor Id
PRODUCT_ID = [0x031e] #: Product Id for the PRS 300/505/new 500 PRODUCT_ID = [0x031e]
BCD = [0x229, 0x1000, 0x22a] BCD = [0x229, 0x1000, 0x22a, 0x31a]
VENDOR_NAME = 'SONY' VENDOR_NAME = 'SONY'
WINDOWS_MAIN_MEM = re.compile('PRS-(505|300|500)') WINDOWS_MAIN_MEM = re.compile(
WINDOWS_CARD_A_MEM = re.compile(r'PRS-(505|500)[#/]\S+:MS') r'(PRS-(505|300|500))|'
WINDOWS_CARD_B_MEM = re.compile(r'PRS-(505|500)[#/]\S+:SD') r'(PRS-((700[#/])|((6|9)00&)))'
)
WINDOWS_CARD_A_MEM = re.compile(
r'(PRS-(505|500)[#/]\S+:MS)|'
r'(PRS-((700[/#]\S+:)|((6|9)00[#_]))MS)'
)
WINDOWS_CARD_B_MEM = re.compile(
r'(PRS-(505|500)[#/]\S+:SD)|'
r'(PRS-((700[/#]\S+:)|((6|9)00[#_]))SD)'
)
OSX_MAIN_MEM = re.compile(r'Sony PRS-(((505|300|500)/[^:]+)|(300)) Media')
OSX_CARD_A_MEM = re.compile(r'Sony PRS-(505|500)/[^:]+:MS Media')
OSX_CARD_B_MEM = re.compile(r'Sony PRS-(505|500)/[^:]+:SD Media')
MAIN_MEMORY_VOLUME_LABEL = 'Sony Reader Main Memory' MAIN_MEMORY_VOLUME_LABEL = 'Sony Reader Main Memory'
STORAGE_CARD_VOLUME_LABEL = 'Sony Reader Storage Card' STORAGE_CARD_VOLUME_LABEL = 'Sony Reader Storage Card'
@ -109,20 +112,4 @@ class PRS505(USBMS):
USBMS.sync_booklists(self, booklists, end_session=end_session) USBMS.sync_booklists(self, booklists, end_session=end_session)
class PRS700(PRS505):
name = 'PRS-600/700/900 Device Interface'
description = _('Communicate with the Sony PRS-600/700/900 eBook reader.')
author = 'Kovid Goyal and John Schember'
gui_name = 'SONY Reader'
supported_platforms = ['windows', 'osx', 'linux']
BCD = [0x31a]
WINDOWS_MAIN_MEM = re.compile('PRS-((700[#/])|((6|9)00&))')
WINDOWS_CARD_A_MEM = re.compile(r'PRS-((700[/#]\S+:)|((6|9)00[#_]))MS')
WINDOWS_CARD_B_MEM = re.compile(r'PRS-((700[/#]\S+:)|((6|9)00[#_]))SD')
OSX_MAIN_MEM = re.compile(r'Sony PRS-((700/[^:]+)|((6|9)00)) Media')
OSX_CARD_A_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|((6|9)00 ))MS Media')
OSX_CARD_B_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|((6|9)00 ))SD Media')