Fix card prefix bug in books()

This commit is contained in:
Kovid Goyal 2006-11-21 23:09:44 +00:00
parent 78d4478d5e
commit 50df03806f

View File

@ -181,6 +181,8 @@ class PRS500Device(object):
PRS500_INTERFACE_ID = 0 #: The interface we use to talk to the device PRS500_INTERFACE_ID = 0 #: The interface we use to talk to the device
PRS500_BULK_IN_EP = 0x81 #: Endpoint for Bulk reads PRS500_BULK_IN_EP = 0x81 #: Endpoint for Bulk reads
PRS500_BULK_OUT_EP = 0x02 #: Endpoint for Bulk writes PRS500_BULK_OUT_EP = 0x02 #: Endpoint for Bulk writes
MEDIA_XML = "/Data/database/cache/media.xml" #: Location of media.xml file on device
CACHE_XML = "/Sony Reader/database/cache.xml" #: Location of cache.xml on storage card in device
def safe(func): def safe(func):
""" """
@ -614,12 +616,13 @@ class PRS500Device(object):
The third and fourth elements are the temporary files that hold main.xml and cache.xml The third and fourth elements are the temporary files that hold main.xml and cache.xml
""" """
main_xml, cache_xml = TemporaryFile(), TemporaryFile() main_xml, cache_xml = TemporaryFile(), TemporaryFile()
self.get_file("/Data/database/cache/media.xml", main_xml, end_session=False) self.get_file(self.MEDIA_XML, main_xml, end_session=False)
root = "a:/"
try: try:
self.get_file("a:/Sony Reader/database/cache.xml", cache_xml, end_session=False) self.get_file("a:"+self.CACHE_XML, cache_xml, end_session=False)
except PathError: except PathError:
try: try:
self.get_file("b:/Sony Reader/database/cache.xml", cache_xml, end_session=False) self.get_file("b:"+self.CACHE_XML, cache_xml, end_session=False)
root = "b:/" root = "b:/"
except PathError: except PathError:
pass pass
@ -630,7 +633,7 @@ class PRS500Device(object):
main_xml.seek(0) main_xml.seek(0)
parser.parse(main_xml) parser.parse(main_xml)
books = finder.books books = finder.books
root = "a:/"
cbooks = [] cbooks = []
if cache_xml.tell() > 0: if cache_xml.tell() > 0:
finder = FindBooks(type="cache", root=root) finder = FindBooks(type="cache", root=root)