make sure there is actually enough data to parse
This commit is contained in:
parent
765f075576
commit
88bbb76752
@ -150,17 +150,19 @@ class MicEParser(object):
|
|||||||
return comment[4:], decodeBase91(comment[:3]) - 10000
|
return comment[4:], decodeBase91(comment[:3]) - 10000
|
||||||
|
|
||||||
def extractDevice(self, comment):
|
def extractDevice(self, comment):
|
||||||
|
if len(comment) > 0:
|
||||||
if comment[0] == ">":
|
if comment[0] == ">":
|
||||||
|
if len(comment) > 1:
|
||||||
if comment[-1] == "=":
|
if comment[-1] == "=":
|
||||||
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D72"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D72"}
|
||||||
if comment[-1] == "^":
|
if comment[-1] == "^":
|
||||||
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D74"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TH-D74"}
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D7A"}
|
return comment[1:], {"manufacturer": "Kenwood", "device": "TH-D7A"}
|
||||||
if comment[0] == "]":
|
if comment[0] == "]":
|
||||||
if comment[-1] == "=":
|
if len(comment) > 1 and comment[-1] == "=":
|
||||||
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TM-D710"}
|
return comment[1:-1], {"manufacturer": "Kenwood", "device": "TM-D710"}
|
||||||
return comment[1:], {"manufacturer": "Kenwood", "device": "TM-D700"}
|
return comment[1:], {"manufacturer": "Kenwood", "device": "TM-D700"}
|
||||||
if comment[0] == "`" or comment[0] == "'":
|
if len(comment) > 2 and (comment[0] == "`" or comment[0] == "'"):
|
||||||
if comment[-2] == "_":
|
if comment[-2] == "_":
|
||||||
devices = {
|
devices = {
|
||||||
"b": "VX-8",
|
"b": "VX-8",
|
||||||
|
Loading…
Reference in New Issue
Block a user