From 51e20a8764bb3c53b8f9bdf6363b0c340e31dc85 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Dec 2009 19:44:26 -0700 Subject: [PATCH] re-organize SONY drivers --- src/calibre/customize/builtins.py | 3 +-- src/calibre/devices/prs505/driver.py | 21 ++++++++++++++++- src/calibre/devices/prs700/__init__.py | 6 ----- src/calibre/devices/prs700/driver.py | 32 -------------------------- src/calibre/devices/scanner.py | 4 +++- 5 files changed, 24 insertions(+), 42 deletions(-) delete mode 100644 src/calibre/devices/prs700/__init__.py delete mode 100644 src/calibre/devices/prs700/driver.py diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 25a5fd0910..ef2ebf586d 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -411,8 +411,7 @@ from calibre.devices.jetbook.driver import JETBOOK from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX from calibre.devices.nook.driver import NOOK from calibre.devices.prs500.driver import PRS500 -from calibre.devices.prs505.driver import PRS505 -from calibre.devices.prs700.driver import PRS700 +from calibre.devices.prs505.driver import PRS505, PRS700 from calibre.devices.android.driver import ANDROID from calibre.devices.eslick.driver import ESLICK from calibre.devices.nuut2.driver import NUUT2 diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index 80bf1fc671..ab61f76b61 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -24,7 +24,7 @@ class PRS505(CLI, Device): name = 'PRS-300/505 Device Interface' gui_name = 'SONY Pocket Edition' description = _('Communicate with the Sony PRS-300/505/500 eBook reader.') - author = _('Kovid Goyal and John Schember') + author = 'Kovid Goyal and John Schember' supported_platforms = ['windows', 'osx', 'linux'] path_sep = '/' @@ -202,3 +202,22 @@ class PRS505(CLI, Device): self.report_progress(1.0, _('Sending metadata to device...')) +class PRS700(PRS505): + + name = 'PRS-600/700 Device Interface' + description = _('Communicate with the Sony PRS-600/700 eBook reader.') + author = 'Kovid Goyal and John Schember' + gui_name = 'SONY Touch edition' + supported_platforms = ['windows', 'osx', 'linux'] + + BCD = [0x31a] + + WINDOWS_MAIN_MEM = re.compile('PRS-((700/)|(600&))') + WINDOWS_CARD_A_MEM = re.compile(r'PRS-((700/\S+:)|(600_))MS') + WINDOWS_CARD_B_MEM = re.compile(r'PRS-((700/\S+:)|(600_))SD') + + OSX_MAIN_MEM = re.compile(r'Sony PRS-((700/[^:]+)|(600)) Media') + OSX_CARD_A_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|(600 ))MS Media') + OSX_CARD_B_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|(600 ))SD Media') + + diff --git a/src/calibre/devices/prs700/__init__.py b/src/calibre/devices/prs700/__init__.py deleted file mode 100644 index 8ff060b0ee..0000000000 --- a/src/calibre/devices/prs700/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' -''' -Device driver for the SONY PRS-700 -''' - diff --git a/src/calibre/devices/prs700/driver.py b/src/calibre/devices/prs700/driver.py deleted file mode 100644 index 807e04dc26..0000000000 --- a/src/calibre/devices/prs700/driver.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' -__docformat__ = 'restructuredtext en' - -''' -Device driver for the SONY PRS-700 -''' - -from calibre.devices.prs505.driver import PRS505 -import re - -class PRS700(PRS505): - - name = 'PRS-600/700 Device Interface' - description = _('Communicate with the Sony PRS-600/700 eBook reader.') - author = _('Kovid Goyal and John Schember') - gui_name = 'SONY Touch edition' - supported_platforms = ['windows', 'osx', 'linux'] - - BCD = [0x31a] - - WINDOWS_MAIN_MEM = re.compile('PRS-((700/)|(600&))') - WINDOWS_CARD_A_MEM = re.compile(r'PRS-((700/\S+:)|(600_))MS') - WINDOWS_CARD_B_MEM = re.compile(r'PRS-((700/\S+:)|(600_))SD') - - OSX_MAIN_MEM = re.compile(r'Sony PRS-((700/[^:]+)|(600)) Media') - OSX_CARD_A_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|(600 ))MS Media') - OSX_CARD_B_MEM = re.compile(r'Sony PRS-((700/[^:]+:)|(600 ))SD Media') - - diff --git a/src/calibre/devices/scanner.py b/src/calibre/devices/scanner.py index 936b93a8cf..f69ccb9107 100644 --- a/src/calibre/devices/scanner.py +++ b/src/calibre/devices/scanner.py @@ -65,8 +65,10 @@ class LinuxScanner(object): ans.add(tuple(dev)) return ans +linux_scanner = None -linux_scanner = LinuxScanner() +if islinux: + linux_scanner = LinuxScanner() class DeviceScanner(object):