Allow configuration of max VLC volume
This commit is contained in:
parent
00fbfa334e
commit
b4079c2b13
@ -33,6 +33,7 @@ class Config(object):
|
||||
ROOT = "/home/kae/music"
|
||||
TESTMODE = True
|
||||
TIMER_MS = 500
|
||||
VOLUME_VLC_MAX = 80
|
||||
|
||||
|
||||
config = Config
|
||||
|
||||
@ -49,12 +49,12 @@ class Music:
|
||||
|
||||
fade_time = Config.FADE_TIME / 1000
|
||||
sleep_time = fade_time / Config.FADE_STEPS
|
||||
step_percent = int((100 / Config.FADE_STEPS) * -1)
|
||||
step_percent = int((Config.VOLUME_VLC_MAX / Config.FADE_STEPS) * -1)
|
||||
|
||||
# Take a copy of current player to allow another track to be
|
||||
# started without interfering here
|
||||
p = self.player
|
||||
for i in range(100, 0, step_percent):
|
||||
for i in range(Config.VOLUME_VLC_MAX, 0, step_percent):
|
||||
p.audio_set_volume(i)
|
||||
sleep(sleep_time)
|
||||
|
||||
@ -82,7 +82,7 @@ class Music:
|
||||
self.track_path = path
|
||||
|
||||
self.player = vlc.MediaPlayer(path)
|
||||
self.player.audio_set_volume(100)
|
||||
self.player.audio_set_volume(Config.VOLUME_VLC_MAX)
|
||||
self.player.play()
|
||||
|
||||
def playing(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user