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
|
def run(action, music=None, value=100, fade=0, delta=False, **kwargs):
if music is not None:
music.set_volume(value, delta=delta, fade=fade)
else:
action.mapping.set_master_volume(value, delta=delta, fade=fade)
def description(action, music=None,
value=100, delta=False, fade=0, **kwargs):
message = ""
if delta:
if music is not None:
message += "{:+d}% to volume of « {} »" \
.format(value, music.name)
else:
message += "{:+d}% to volume" \
.format(value)
else:
if music is not None:
message += "setting volume of « {} » to {}%" \
.format(music.name, value)
else:
message += "setting volume to {}%" \
.format(value)
if fade > 0:
message += " with {}s fade".format(fade)
return message
|