fix bug setting Boolean values, fix bug setting cleaned flag

This commit is contained in:
4am 2019-02-15 20:05:26 -05:00
parent f62ffc421a
commit 376a14e395

View File

@ -88,7 +88,7 @@ def is_booleanish(v):
try: try:
return is_booleanish(int(v)) return is_booleanish(int(v))
except: except:
return v.lower() in ("true","false","yes","no") return v.lower() in ("true","false","yes","no","1","0")
elif type(v) is bytes: elif type(v) is bytes:
try: try:
return is_booleanish(int.from_bytes(v, byteorder="little")) return is_booleanish(int.from_bytes(v, byteorder="little"))
@ -99,7 +99,7 @@ def is_booleanish(v):
def from_booleanish(v, errorClass, errorString): def from_booleanish(v, errorClass, errorString):
raise_if(not is_booleanish(v), errorClass, errorString % v) raise_if(not is_booleanish(v), errorClass, errorString % v)
if type(v) is str: if type(v) is str:
return v.lower() in ("true","yes") return v.lower() in ("true","yes","1")
elif type(v) is bytes: elif type(v) is bytes:
return v == b"\x01" return v == b"\x01"
return v == 1 return v == 1
@ -874,7 +874,7 @@ requires_machine, notes, side, side_name, contributor, image_date. Other keys ar
elif k == "synchronized": elif k == "synchronized":
self.output.info[k] = self.output.validate_info_synchronized(v) self.output.info[k] = self.output.validate_info_synchronized(v)
elif k == "cleaned": elif k == "cleaned":
self.output.info[k] == self.output.validate_info_cleaned(v) self.output.info[k] = self.output.validate_info_cleaned(v)
if self.output.info["version"] == 1: continue if self.output.info["version"] == 1: continue
# remaining fields are only recognized in WOZ2 files (v2+ INFO chunk) # remaining fields are only recognized in WOZ2 files (v2+ INFO chunk)