diff --git a/ptulsconv/commands.py b/ptulsconv/commands.py index cae642d..cc80979 100644 --- a/ptulsconv/commands.py +++ b/ptulsconv/commands.py @@ -126,7 +126,7 @@ def create_adr_reports(lines: List[ADRLine], tc_display_format: TimecodeFormat, # return parsed -def convert(input_file, major_mode='fmpxml', output=sys.stdout, warnings=True): +def convert(input_file, major_mode, output=sys.stdout, warnings=True): session = parse_document(input_file) session_tc_format = session.header.timecode_format diff --git a/ptulsconv/footage.py b/ptulsconv/footage.py new file mode 100644 index 0000000..0d70bd0 --- /dev/null +++ b/ptulsconv/footage.py @@ -0,0 +1,20 @@ +from fractions import Fraction +import re +import math +from collections import namedtuple +from typing import Optional + +def footage_to_seconds(footage: str) -> Optional[Fraction]: + m = re.match(r'(\d+)\+(\d+)(\.\d+)?') + if m is None: + return None + + feet, frames = m.groups() + feet, frames = int(feet), int(frames) + + fps = 24 + frames_per_foot = 16 + + total_frames = feet * 16 + frames + + return Fraction(total_frames, fps) \ No newline at end of file diff --git a/test-coverage.sh b/test-coverage.sh new file mode 100755 index 0000000..5b7dca1 --- /dev/null +++ b/test-coverage.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +coverage run -m pytest . ; coverage-lcov + diff --git a/tests/functional/test_pdf_export.py b/tests/functional/test_pdf_export.py new file mode 100644 index 0000000..9232b82 --- /dev/null +++ b/tests/functional/test_pdf_export.py @@ -0,0 +1,32 @@ +import unittest + +import tempfile + +import os.path +import os +import glob + +from ptulsconv import commands + +# class TestBroadcastTimecode(unittest.TestCase): +# def test_report_generation(self): +# """ +# Setp through every text file in export_cases and make sure it can +# be converted into PDF docs without throwing an error +# """ +# for path in glob.glob(os.path.dirname(__file__) + "/../export_cases/*.txt"): +# tempdir = tempfile.TemporaryDirectory() +# os.chdir(tempdir.name) +# try: +# commands.convert(path, major_mode='doc') +# except: +# assert False, "Error processing file %s" % path +# finally: +# tempdir.cleanup() + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_adr_entity.py b/tests/unittests/test_adr_entity.py similarity index 100% rename from tests/test_adr_entity.py rename to tests/unittests/test_adr_entity.py diff --git a/tests/test_broadcast_timecode.py b/tests/unittests/test_broadcast_timecode.py similarity index 100% rename from tests/test_broadcast_timecode.py rename to tests/unittests/test_broadcast_timecode.py diff --git a/tests/test_doc_entities.py b/tests/unittests/test_doc_entities.py similarity index 100% rename from tests/test_doc_entities.py rename to tests/unittests/test_doc_entities.py diff --git a/tests/test_tag_compiler.py b/tests/unittests/test_tag_compiler.py similarity index 100% rename from tests/test_tag_compiler.py rename to tests/unittests/test_tag_compiler.py diff --git a/tests/test_tag_interpreter.py b/tests/unittests/test_tag_interpreter.py similarity index 100% rename from tests/test_tag_interpreter.py rename to tests/unittests/test_tag_interpreter.py diff --git a/tests/test_tagging.py b/tests/unittests/test_tagging.py similarity index 97% rename from tests/test_tagging.py rename to tests/unittests/test_tagging.py index b6ffc18..34fcc29 100644 --- a/tests/test_tagging.py +++ b/tests/unittests/test_tagging.py @@ -4,7 +4,7 @@ import os.path class TaggingIntegratedTests(unittest.TestCase): - path = os.path.dirname(__file__) + '/export_cases/Tag Tests/Tag Tests.txt' + path = os.path.dirname(__file__) + '/../export_cases/Tag Tests/Tag Tests.txt' def test_event_list(self): with open(self.path, 'r') as f: diff --git a/tests/test_utils.py b/tests/unittests/test_utils.py similarity index 100% rename from tests/test_utils.py rename to tests/unittests/test_utils.py