Skip to content

Commit

Permalink
Revert "Fix defaults (#30)" (#36)
Browse files Browse the repository at this point in the history
This reverts commit 45efa1f.
  • Loading branch information
Diaoul authored Jun 23, 2024
1 parent 45efa1f commit cba4067
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions enzyme/mkv.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def fromelement(cls, element):
type = element.get('TrackType') # @ReservedAssignment
number = element.get('TrackNumber', 0)
name = element.get('Name')
language = element.get('Language', 'eng')
language = element.get('Language')
enabled = bool(element.get('FlagEnabled', 1))
default = bool(element.get('FlagDefault', 1))
forced = bool(element.get('FlagForced', 0))
Expand Down Expand Up @@ -201,7 +201,7 @@ def fromelement(cls, element):
videotrack.width = element['Video'].get('PixelWidth', 0)
videotrack.height = element['Video'].get('PixelHeight', 0)
videotrack.interlaced = bool(element['Video'].get('FlagInterlaced', False))
videotrack.stereo_mode = element['Video'].get('StereoMode', 0)
videotrack.stereo_mode = element['Video'].get('StereoMode')
videotrack.crop = {}
if 'PixelCropTop' in element['Video']:
videotrack.crop['top'] = element['Video']['PixelCropTop']
Expand All @@ -211,10 +211,10 @@ def fromelement(cls, element):
videotrack.crop['left'] = element['Video']['PixelCropLeft']
if 'PixelCropRight' in element['Video']:
videotrack.crop['right'] = element['Video']['PixelCropRight']
videotrack.display_unit = element['Video'].get('DisplayUnit')
videotrack.display_width = element['Video'].get('DisplayWidth')
videotrack.display_height = element['Video'].get('DisplayHeight')
videotrack.aspect_ratio_type = element['Video'].get('AspectRatioType', 0)
videotrack.display_unit = element['Video'].get('DisplayUnit')
videotrack.aspect_ratio_type = element['Video'].get('AspectRatioType')
return videotrack

def __repr__(self):
Expand Down Expand Up @@ -245,7 +245,7 @@ def fromelement(cls, element):
audiotrack = super(AudioTrack, cls).fromelement(element)
audiotrack.sampling_frequency = element['Audio'].get('SamplingFrequency', 8000.0)
audiotrack.channels = element['Audio'].get('Channels', 1)
audiotrack.output_sampling_frequency = element['Audio'].get('OutputSamplingFrequency', audiotrack.sampling_frequency)
audiotrack.output_sampling_frequency = element['Audio'].get('OutputSamplingFrequency')
audiotrack.bit_depth = element['Audio'].get('BitDepth')
return audiotrack

Expand Down
48 changes: 24 additions & 24 deletions enzyme/tests/test_mkv.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def test_test1(self):
self.assertTrue(mkv.video_tracks[0].width == 854)
self.assertTrue(mkv.video_tracks[0].height == 480)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width is None)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -64,7 +64,7 @@ def test_test1(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down Expand Up @@ -113,12 +113,12 @@ def test_test2(self):
self.assertTrue(mkv.video_tracks[0].width == 1024)
self.assertTrue(mkv.video_tracks[0].height == 576)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width == 1354)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -133,7 +133,7 @@ def test_test2(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down Expand Up @@ -182,18 +182,18 @@ def test_test3(self):
self.assertTrue(mkv.video_tracks[0].width == 1024)
self.assertTrue(mkv.video_tracks[0].height == 576)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width is None)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
self.assertTrue(mkv.audio_tracks[0].number == 2)
self.assertTrue(mkv.audio_tracks[0].name is None)
self.assertTrue(mkv.audio_tracks[0].language == 'eng')
self.assertTrue(mkv.audio_tracks[0].language is None)
self.assertTrue(mkv.audio_tracks[0].enabled == True)
self.assertTrue(mkv.audio_tracks[0].default == True)
self.assertTrue(mkv.audio_tracks[0].forced == False)
Expand All @@ -202,7 +202,7 @@ def test_test3(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down Expand Up @@ -251,12 +251,12 @@ def test_test5(self):
self.assertTrue(mkv.video_tracks[0].width == 1024)
self.assertTrue(mkv.video_tracks[0].height == 576)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width == 1024)
self.assertTrue(mkv.video_tracks[0].display_height == 576)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio tracks
self.assertTrue(len(mkv.audio_tracks) == 2)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -271,12 +271,12 @@ def test_test5(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
self.assertTrue(mkv.audio_tracks[1].type == AUDIO_TRACK)
self.assertTrue(mkv.audio_tracks[1].number == 10)
self.assertTrue(mkv.audio_tracks[1].name == 'Commentary')
self.assertTrue(mkv.audio_tracks[1].language == 'eng')
self.assertTrue(mkv.audio_tracks[1].language is None)
self.assertTrue(mkv.audio_tracks[1].enabled == True)
self.assertTrue(mkv.audio_tracks[1].default == False)
self.assertTrue(mkv.audio_tracks[1].forced == False)
Expand All @@ -292,7 +292,7 @@ def test_test5(self):
self.assertTrue(mkv.subtitle_tracks[0].type == SUBTITLE_TRACK)
self.assertTrue(mkv.subtitle_tracks[0].number == 3)
self.assertTrue(mkv.subtitle_tracks[0].name is None)
self.assertTrue(mkv.subtitle_tracks[0].language == 'eng')
self.assertTrue(mkv.subtitle_tracks[0].language is None)
self.assertTrue(mkv.subtitle_tracks[0].enabled == True)
self.assertTrue(mkv.subtitle_tracks[0].default == True)
self.assertTrue(mkv.subtitle_tracks[0].forced == False)
Expand Down Expand Up @@ -414,12 +414,12 @@ def test_test6(self):
self.assertTrue(mkv.video_tracks[0].width == 854)
self.assertTrue(mkv.video_tracks[0].height == 480)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width is None)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -434,7 +434,7 @@ def test_test6(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down Expand Up @@ -483,12 +483,12 @@ def test_test7(self):
self.assertTrue(mkv.video_tracks[0].width == 1024)
self.assertTrue(mkv.video_tracks[0].height == 576)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width is None)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -503,7 +503,7 @@ def test_test7(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down Expand Up @@ -552,12 +552,12 @@ def test_test8(self):
self.assertTrue(mkv.video_tracks[0].width == 1024)
self.assertTrue(mkv.video_tracks[0].height == 576)
self.assertTrue(mkv.video_tracks[0].interlaced == False)
self.assertTrue(mkv.video_tracks[0].stereo_mode == 0)
self.assertTrue(mkv.video_tracks[0].stereo_mode is None)
self.assertTrue(mkv.video_tracks[0].crop == {})
self.assertTrue(mkv.video_tracks[0].display_width is None)
self.assertTrue(mkv.video_tracks[0].display_height is None)
self.assertTrue(mkv.video_tracks[0].display_unit is None)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type == 0)
self.assertTrue(mkv.video_tracks[0].aspect_ratio_type is None)
# audio track
self.assertTrue(len(mkv.audio_tracks) == 1)
self.assertTrue(mkv.audio_tracks[0].type == AUDIO_TRACK)
Expand All @@ -572,7 +572,7 @@ def test_test8(self):
self.assertTrue(mkv.audio_tracks[0].codec_name is None)
self.assertTrue(mkv.audio_tracks[0].sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].channels == 2)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency == 48000.0)
self.assertTrue(mkv.audio_tracks[0].output_sampling_frequency is None)
self.assertTrue(mkv.audio_tracks[0].bit_depth is None)
# subtitle track
self.assertTrue(len(mkv.subtitle_tracks) == 0)
Expand Down

0 comments on commit cba4067

Please sign in to comment.