UI edit audio layout

This commit is contained in:
Maveno
2024-10-17 11:16:20 +02:00
parent 747ff41ad3
commit 260c605201
5 changed files with 42 additions and 21 deletions

View File

@@ -4,29 +4,39 @@ from .track_type import TrackType
class AudioLayout(Enum):
LAYOUT_STEREO = {"layout": "stereo", "index": 1}
LAYOUT_5_1 = {"layout": "5.1(side)", "index": 2}
LAYOUT_6_1 = {"layout": "6.1", "index": 3}
LAYOUT_7_1 = {"layout": "7.1", "index": 4} #TODO: Does this exist?
LAYOUT_STEREO = {"label": "stereo", "index": 1}
LAYOUT_5_1 = {"label": "5.1(side)", "index": 2}
LAYOUT_6_1 = {"label": "6.1", "index": 3}
LAYOUT_7_1 = {"label": "7.1", "index": 4} #TODO: Does this exist?
LAYOUT_6CH = {"layout": "6ch", "index": 5}
LAYOUT_6CH = {"label": "6ch", "index": 5}
LAYOUT_UNDEFINED = {"layout": "undefined", "index": 0}
LAYOUT_UNDEFINED = {"label": "undefined", "index": 0}
def label(self):
"""Returns the layout as string"""
return self.value['layout']
"""Returns the audio layout as string"""
return str(self.value['label'])
def index(self):
"""Returns the layout as string"""
return self.value['index']
"""Returns the audio layout as integer"""
return int(self.value['index'])
@staticmethod
def fromLabel(label : str):
try:
return [a for a in AudioLayout if a.value['label'] == str(label)][0]
except:
raise click.ClickException('fromLabel failed')
return AudioLayout.LAYOUT_UNDEFINED
@staticmethod
def fromIndex(index : int):
try:
return [a for a in AudioLayout if a.index() == int(index)][0]
return [a for a in AudioLayout if a.value['index'] == int(index)][0]
except:
raise click.ClickException('fromIndex failed')
return AudioLayout.LAYOUT_UNDEFINED
@staticmethod