Fixing fax background service BMP output.
This commit is contained in:
parent
bcab0df233
commit
8d566f92cb
11
owrx/fax.py
11
owrx/fax.py
|
|
@ -182,8 +182,13 @@ class FaxParser(ThreadModule):
|
|||
self.ioc = self.data[6] * 4
|
||||
self.lpm = self.data[7]
|
||||
self.line = 0
|
||||
# Find total header size
|
||||
headerSize = 54 + (4*256 if self.depth==8 else 0)
|
||||
# 256x4 palette follows the header
|
||||
self.colors = self.data[54:54+4*256] if self.depth==8 else None
|
||||
if headerSize>54:
|
||||
self.colors = self.data[54:headerSize]
|
||||
else
|
||||
self.colors = None
|
||||
# Find mode name and time
|
||||
modeName = "IOC-%d %dLPM" % (self.ioc, self.lpm)
|
||||
timeStamp = datetime.utcnow().strftime("%H:%M:%S")
|
||||
|
|
@ -196,7 +201,7 @@ class FaxParser(ThreadModule):
|
|||
if self.service:
|
||||
# Create a new image file and write BMP header
|
||||
self.newFile(fileName)
|
||||
self.writeFile(self.data[0:54])
|
||||
self.writeFile(self.data[0:headerSize])
|
||||
else:
|
||||
# Compose result
|
||||
out = {
|
||||
|
|
@ -210,7 +215,7 @@ class FaxParser(ThreadModule):
|
|||
"frequency": self.frequency
|
||||
}
|
||||
# Remove parsed data
|
||||
del self.data[0:54+(4*256 if self.depth==8 else 0)]
|
||||
del self.data[0:headerSize]
|
||||
|
||||
except Exception as exptn:
|
||||
logger.debug("Exception parsing: %s" % str(exptn))
|
||||
|
|
|
|||
Loading…
Reference in New Issue