Fix bug detecting EAC version if it's not on the first line

This commit is contained in:
itismadness
2018-11-23 03:32:05 +14:00
parent d5555c367e
commit 05b97cd447
4 changed files with 8 additions and 6 deletions

View File

@@ -49,12 +49,12 @@ def extract_info(text):
if len(text) == 0:
return text, None, None
version = text.splitlines()[0]
if not version.startswith('Exact Audio Copy'):
version = None
else:
version = tuple(version.split()[3:6])
version = None
for line in text.splitlines():
if line.startswith('Exact Audio Copy'):
version = tuple(line.split()[3:6])
elif re.match(r'[a-zA-Z]', line):
break
match = re.search('\n\n==== (.*) ([A-Z0-9]+) ====', text)
if match:

BIN
logs/25.log Normal file

Binary file not shown.

BIN
logs/26.log Normal file

Binary file not shown.

View File

@@ -30,6 +30,8 @@ TESTS = [
(Path('logs/22.log'), [{'message': 'Log entry has no checksum!', 'status': 'NO'}]),
(Path('logs/23.log'), [{'message': 'Log entry has no checksum!', 'status': 'NO'}]),
(Path('logs/24.log'), [{'message': 'Log entry has no checksum!', 'status': 'NO'}]),
(Path('logs/25.log'), [{'message': 'Log entry is fine!', 'status': 'OK'}, {'message': 'Log entry has no checksum!', 'status': 'NO'}]),
(Path('logs/26.log'), [{'message': 'Log entry was modified, checksum incorrect!', 'status': 'BAD'}])
]
class TestLogchecker(unittest.TestCase):