Cybook: Windows detection use Product and Vendor names. Added title sorting

This commit is contained in:
John Schember 2009-01-06 17:48:17 -05:00
parent bb8f418c2c
commit 73902d2f46
2 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com'
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
'''
'''
@ -20,6 +20,13 @@ class Book(object):
self.thumbnail = None
self.tags = []
@apply
def title_sorter():
doc = '''String to sort the title. If absent, title is returned'''
def fget(self):
return re.sub('^\s*A\s+|^\s*The\s+|^\s*An\s+', '', self.title).rstrip()
return property(doc=doc, fget=fget)
@apply
def thumbnail():
return None

View File

@ -1,5 +1,5 @@
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com'
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
'''
Device driver for Bookeen's Cybook Gen 3
@ -19,7 +19,9 @@ class CYBOOKG3(Device):
VENDOR_ID = 0x0bda
PRODUCT_ID = 0x0703
BCD = 0x110
#THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
VENDOR_NAME = 'BOOKEEN'
PRODUCT_NAME = 'CYBOOK_GEN3'
MAIN_MEMORY_VOLUME_LABEL = 'Cybook Gen 3 Main Memory'
STORAGE_CARD_VOLUME_LABEL = 'Cybook Gen 3 Storage Card'
@ -223,11 +225,16 @@ class CYBOOKG3(Device):
def _windows_match_device(self, device_id):
device_id = device_id.upper()
if 'VEN_'+self.VENDOR_NAME in device_id and \
'PROD_'+self.PRODUCT_NAME in device_id:
return True
vid, pid = hex(cls.VENDOR_ID)[2:], hex(cls.PRODUCT_ID)[2:]
while len(vid) < 4: vid = '0' + vid
while len(pid) < 4: pid = '0' + pid
if 'VID_'+vid in device_id and 'PID_'+pid in device_id:
return True
return False
# This only supports Windows >= 2000