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"
|
ROOT = "/home/kae/music"
|
||||||
TESTMODE = True
|
TESTMODE = True
|
||||||
TIMER_MS = 500
|
TIMER_MS = 500
|
||||||
|
VOLUME_VLC_MAX = 80
|
||||||
|
|
||||||
|
|
||||||
config = Config
|
config = Config
|
||||||
|
|||||||
@ -49,12 +49,12 @@ class Music:
|
|||||||
|
|
||||||
fade_time = Config.FADE_TIME / 1000
|
fade_time = Config.FADE_TIME / 1000
|
||||||
sleep_time = fade_time / Config.FADE_STEPS
|
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
|
# Take a copy of current player to allow another track to be
|
||||||
# started without interfering here
|
# started without interfering here
|
||||||
p = self.player
|
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)
|
p.audio_set_volume(i)
|
||||||
sleep(sleep_time)
|
sleep(sleep_time)
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class Music:
|
|||||||
self.track_path = path
|
self.track_path = path
|
||||||
|
|
||||||
self.player = vlc.MediaPlayer(path)
|
self.player = vlc.MediaPlayer(path)
|
||||||
self.player.audio_set_volume(100)
|
self.player.audio_set_volume(Config.VOLUME_VLC_MAX)
|
||||||
self.player.play()
|
self.player.play()
|
||||||
|
|
||||||
def playing(self):
|
def playing(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user