diff --git a/.gitignore b/.gitignore index 723ef36f4e4f32c4560383aa5987c575a30c6535..32747a97c783b5f60a37eaf4cc4d30d4a5152d38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +config.py \ No newline at end of file diff --git a/defs.py b/defs.py index 6d6f2e4c3cf64d05f09ab4f7a493bb5071bd0183..71c2adb5c285fe7c27fcb398710fcd2cc7da1979 100644 --- a/defs.py +++ b/defs.py @@ -28,6 +28,7 @@ def playSound(soundFile): # We will play the sound file player = vlc.MediaPlayer(soundFile) + player.audio_set_volume(config.volume) player.play() # We will wait for the sound to finish @@ -69,6 +70,7 @@ def playSoundWithDelayedSecondSound(firstSound, secondSound): players[1].set_media(instances[1].media_new(secondSound)) # We will play the first sound + players[0].audio_set_volume(config.volume) players[0].play() # We wait @@ -91,7 +93,7 @@ def playSoundWithDelayedSecondSound(firstSound, secondSound): print("Done playing Intro: " + secondSound) # We will now raise the volume of the first sound - players[0].audio_set_volume(100) + players[0].audio_set_volume(config.volume) # We will wait for the first sound to finish current_state = players[0].get_state() diff --git a/config.py b/example.config.py similarity index 96% rename from config.py rename to example.config.py index 4540550779724692c78c1ea33a5edec12841088f..29b410bc906dbbf93c9a13f6d38b3eb7a010b1bc 100644 --- a/config.py +++ b/example.config.py @@ -1,4 +1,4 @@ -debug = True +debug = False filesExtension = ".wav" blankPauseDuration = 0 musicMinIntroDelay = 5 @@ -6,6 +6,7 @@ musicMaxIntroDelay = 15 introFolder = "intro" adsProbability = 0.25 newsProbability = 0.25 +volume = 75 # Regex idPattern = "((id)|(ID))_([0-9]){2}" diff --git a/radio.py b/radio.py index 8c65e989e493d7388987714051de63830e260552..7e895cab161475d218ccd99762bca1bd381dc7d6 100644 --- a/radio.py +++ b/radio.py @@ -30,7 +30,6 @@ class Radio: self.ads = defs.getFilesByRegex(self.adsPath, ".*") self.news = defs.getFilesByRegex(self.newsPath, ".*") - def startRadio(self): while True: # Check if we will play an ad or news @@ -94,4 +93,4 @@ try: radio.startRadio() except KeyboardInterrupt: print("Exiting...") - exit(0) \ No newline at end of file + exit(0)