Remove obsolete todos. Fix in code to read metadata from LRF files. The old code would fail on some LRF files in which the metadata block was zero-terminated

This commit is contained in:
Kovid Goyal 2007-01-02 04:41:46 +00:00
parent 73e021ef08
commit 59ed06686a
3 changed files with 5 additions and 10 deletions

View File

@ -190,8 +190,6 @@ class PRS500Device(Device):
be sent to the device, unless end_session is set to C{False}.
An L{usb.USBError} will cause the library to release control of the
USB interface via a call to L{close}.
@todo: Fix handling of timeout errors
"""
def run_session(*args, **kwargs):
dev = args[0]
@ -262,7 +260,6 @@ class PRS500Device(Device):
See the source code for the sequenceof initialization commands.
@todo: Implement unlocking of the device
@todo: Check this on Mac OSX
"""
self.device = self.device_descriptor.get_device()
if not self.device:
@ -391,7 +388,6 @@ class PRS500Device(Device):
The data packet is returned as an object of type C{data_type}.
@return: A list of packets read from the device.
Each packet is of type data_type
@todo: Figure out how to make bulk reads work in OSX
"""
def bulk_read_packet(data_type=Answer, size=0x1000):
data = data_type(self.handle.bulkRead(PRS500Device.PRS500_BULK_IN_EP, \
@ -803,9 +799,6 @@ class PRS500Device(Device):
where data is the image data in JPEG format as a string
@param booklists: A tuple containing the result of calls to
(L{books}(oncard=False), L{books}(oncard=True)).
@todo: Implement syncing the booklists to the device.
This would mean juggling with the nextId attribute in
media.xml and renumbering ids in cache.xml?
"""
infile.seek(0, 2)
size = infile.tell()

View File

@ -483,7 +483,6 @@ class Main(QObject, Ui_MainWindow):
def device_removed(self):
""" @todo: only reset stuff if library is not shown """
self.df.setText(self.df_template.arg("").arg("").arg(""))
self.device_tree.hide_reader(True)
self.device_tree.hide_card(True)

View File

@ -27,6 +27,7 @@ to get and set meta information. For example:
import struct, array, zlib, StringIO
import xml.dom.minidom as dom
from xml.dom.ext import Print as Print
from libprs500.prstypes import field
BYTE = "<B" #: Unsigned char little endian encoded in 1 byte
@ -204,7 +205,9 @@ class LRFMetaFile(object):
if len(stream) != self.uncompressed_info_size:
raise LRFException("Decompression of document meta info\
yielded unexpected results")
return stream
# Remove null characters from string as in some LRF files
# the stream is null-terminated
return stream.strip().replace('\0', '')
except zlib.error, e:
raise LRFException("Unable to decompress document meta information")