mirror of
https://github.com/OPSnet/eac_logchecker.py.git
synced 2026-01-16 23:05:35 -05:00
Fix bug detecting EAC version if it's not on the first line
This commit is contained in:
@@ -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
BIN
logs/25.log
Normal file
Binary file not shown.
BIN
logs/26.log
Normal file
BIN
logs/26.log
Normal file
Binary file not shown.
2
test.py
2
test.py
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user