diff --git a/app/config.py b/app/config.py index c8f672e..87bffe3 100644 --- a/app/config.py +++ b/app/config.py @@ -34,7 +34,7 @@ class Config(object): ROOT = "/home/kae/music" TESTMODE = True TIMER_MS = 500 - VOLUME_VLC_MAX = 80 + VOLUME_VLC_DEFAULT = 81 config = Config diff --git a/app/music.py b/app/music.py index dd9733e..c21a9e7 100644 --- a/app/music.py +++ b/app/music.py @@ -14,13 +14,13 @@ class Music: Manage the playing of music tracks """ - def __init__(self, max_volume=100): + def __init__(self): self.current_track_start_time = None self.fading = False self.VLC = vlc.Instance() self.player = None self.track_path = None - self.max_volume = max_volume + self.max_volume = Config.VOLUME_VLC_DEFAULT def fade(self): """ @@ -127,6 +127,9 @@ class Music: def set_volume(self, volume): "Set maximum volume used for player" + if not self.player: + return + self.max_volume = volume self.player.audio_set_volume(volume) diff --git a/app/musicmuster.py b/app/musicmuster.py index 2f93ddf..5ca3b08 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -49,6 +49,7 @@ class Window(QMainWindow, Ui_MainWindow): self.next_track = None self.previous_track = None self.previous_track_position = None + self.spnVolume.setValue(Config.VOLUME_VLC_DEFAULT) self.menuTest.menuAction().setVisible(Config.TESTMODE) self.set_main_window_size()