-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.py
70 lines (59 loc) · 2.61 KB
/
utilities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This file is a derivation of work on - and as such shares the same
# licence as - Linux Show Player
#
# Linux Show Player:
# Copyright 2012-2021 Francesco Ceruti <[email protected]>
#
# This file:
# Copyright 2021 s0600204
#
# Linux Show Player is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Linux Show Player is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Linux Show Player. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=missing-docstring
# pylint: disable=import-error
from lisp.plugins import get_plugin
from lisp.ui.ui_utils import translate
def build_default_dca_name(num):
return translate("DcaPlotter", "DCA {0}").format(num)
def build_default_channel_name(channel_tuple):
if channel_tuple[0] == 'input':
return translate("DcaPlotter", "Microphone {0}").format(channel_tuple[1])
if channel_tuple[0] == 'fx':
return translate("DcaPlotter", "FX {0}").format(channel_tuple[1])
return str(channel_tuple)
def get_name_for_empty_dca():
return get_plugin('DcaPlotter').Config['blanking_text']
def get_channel_assignment_name(channel_tuple):
if channel_tuple[0] in ['choir', 'role']:
return get_channel_name(channel_tuple)
return '{id} : {name}'.format_map({
'id': channel_tuple[1],
'name': get_channel_name(channel_tuple)
})
def get_channel_name(channel_tuple):
if channel_tuple[0] == 'choir':
return get_group_name(channel_tuple, 'choir')
if channel_tuple[0] == 'role':
return get_group_name(channel_tuple, 'role')
assigns = get_plugin('DcaPlotter').SessionConfig['assigns'][channel_tuple[0]]
return assigns[channel_tuple[1] - 1]['name'] if assigns else build_default_channel_name(channel_tuple)
def get_group_name(channel_tuple, group):
assign_id = channel_tuple[1]
return get_plugin('DcaPlotter').SessionConfig['assigns'][group][assign_id]['name']
def get_channel_group_name(channel_type):
return {
"input": translate("DcaPlotter", "Microphones"),
"fx": translate("DcaPlotter", "Effect Units"),
"role": translate("DcaPlotter", "Named Roles"),
"choir": translate("DcaPlotter", "Choir Groupings"),
}.get(channel_type, channel_type)