diff --git a/pycmx/parse_cmx.py b/pycmx/parse_cmx.py index a1960c1..c856ace 100644 --- a/pycmx/parse_cmx.py +++ b/pycmx/parse_cmx.py @@ -50,13 +50,9 @@ class CmxChannelMap: } - def __init__(self, v=False, a1=False, a2=False, a3=False, a4=False): - self._audio_channel_set = set() + def __init__(self, v=False, audio_channels=set()): + self._audio_channel_set = audio_channels self.v = v - self.a1 = a1 - self.a2 = a2 - self.a3 = a3 - self.a4 = a4 @property def a1(self): @@ -70,7 +66,7 @@ class CmxChannelMap: def a2(self): return self.get_audio_channel(2) - @a1.setter + @a2.setter def a2(self,val): self.set_audio_channel(2,val) @@ -78,7 +74,7 @@ class CmxChannelMap: def a3(self): return self.get_audio_channel(3) - @a1.setter + @a3.setter def a3(self,val): self.set_audio_channel(3,val) @@ -86,7 +82,7 @@ class CmxChannelMap: def a4(self): return self.get_audio_channel(4) - @a1.setter + @a4.setter def a4(self,val): self.set_audio_channel(4,val) @@ -157,7 +153,7 @@ def event_list(title, parser): events_result.append(event_t) raw_event = parser.current_token - channels = CmxChannelMap() + channels = CmxChannelMap({}) channels.appendEvent(raw_event.channels) this_event = {'title': title, 'number': raw_event.event, 'clip_name': None , diff --git a/pycmx/parse_cmx_statements.py b/pycmx/parse_cmx_statements.py index a62f506..0867cd6 100644 --- a/pycmx/parse_cmx_statements.py +++ b/pycmx/parse_cmx_statements.py @@ -21,7 +21,7 @@ StmtUnrecognized = namedtuple("Unrecognized",["content"]) def parse_cmx3600_statements(path): - with open(path,'rU') as file: + with open(path,'r') as file: lines = file.readlines() return [parse_cmx3600_line(line.strip()) for line in lines] diff --git a/tests/.test_parse.py.swp b/tests/.test_parse.py.swp index a9d3142..85ddf83 100644 Binary files a/tests/.test_parse.py.swp and b/tests/.test_parse.py.swp differ diff --git a/tests/test_parse.py b/tests/test_parse.py index 4d5ce56..8fdfd0d 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -18,4 +18,10 @@ class TestParse(TestCase): events = pycmx.parse_cmx3600(f"tests/edls/{fn}" ) self.assertTrue( len(events) == count , f"expected {len(events)} but found {count}") + def test_audio_channels(self): + events = pycmx.parse_cmx3600(f"tests/edls/TEST.edl" ) + self.assertTrue(events[0].channels.a2) + self.assertFalse(events[0].channels.a1) + self.assertTrue(events[2].channels.get_audio_channel(7)) +