diff --git a/eac_logchecker.py b/eac_logchecker.py index 61841f3..4a2c281 100755 --- a/eac_logchecker.py +++ b/eac_logchecker.py @@ -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: diff --git a/logs/25.log b/logs/25.log new file mode 100644 index 0000000..fcbc9f8 Binary files /dev/null and b/logs/25.log differ diff --git a/logs/26.log b/logs/26.log new file mode 100644 index 0000000..3875954 Binary files /dev/null and b/logs/26.log differ diff --git a/test.py b/test.py index 36eb584..d2ffee6 100755 --- a/test.py +++ b/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):