From 2969e085139e028f477cdda628a91de5e4063066 Mon Sep 17 00:00:00 2001
From: SofianeLasri <alasri250@gmail.com>
Date: Sun, 19 Mar 2023 14:31:21 +0100
Subject: [PATCH] Ajout des patterns

---
 config.py | 12 ++++++++++--
 radio.py  |  9 +++++----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/config.py b/config.py
index a8ee9c7..c0d924e 100644
--- a/config.py
+++ b/config.py
@@ -1,6 +1,8 @@
 debug = True
 filesExtension = ".wav"
-blankPauseDuration = 0.1
+blankPauseDuration = 0
+musicMinIntroDelay = 10
+musicMaxIntroDelay = 20
 introFolder = "intro"
 
 # Regex
@@ -9,4 +11,10 @@ monoSoloPattern = "((mono)|(MONO))_((solo)|(SOLO))"
 generalPattern = "(general)|(GENERAL_([0-9]){2})"
 
 musicPatten = "^(?:(?!(" + idPattern + "|" + monoSoloPattern + "|" + generalPattern + "|(.*([A-Z])_([0-9]){2})|intro|to|time)).)+$"
-musicIntro = "REPLACEMEWITHMSUICTITLE_([0-9]){2}"
\ No newline at end of file
+musicIntro = "REPLACEMEWITHMSUICTITLE_([0-9]){2}"
+
+# Radio specific
+musicPatterns = ["ID, GENERAL, (MUSIC, INTRO)", "ID, (MUSIC, INTRO)", "GENERAL, (MUSIC, INTRO)",
+                 "ID, GENERAL, (MUSIC, INTRO)"]
+
+adsAndNewsPatterns = ["AD, AD, NEWS", "NEWS", "MONO_SOLO, AD", "AD, MONO_SOLO", "MONO_SOLO, NEWS", "NEWS, MONO_SOLO"]
diff --git a/radio.py b/radio.py
index e8d76a1..30bdef4 100644
--- a/radio.py
+++ b/radio.py
@@ -23,9 +23,9 @@ class Radio:
             self.musics = defs.getFilesByRegex(self.filesPath, config.musicPatten)
 
     def play(self):
-        for id in self.ids:
-            defs.playSound(id)
-            defs.playSound(random.choice(self.monoSolos))
+        while True:
+            defs.playSound(random.choice(self.ids))
+            defs.playSound(random.choice(self.generals))
             music = random.choice(self.musics)
 
             # Get all after last / and before last .
@@ -33,7 +33,8 @@ class Radio:
             print("Playing: " + musicName)
             defs.playSound(random.choice(defs.getMusicIntroFiles(self.filesPath, musicName)))
             defs.playSound(music)
-            defs.playSound(random.choice(self.generals))
+            defs.playSound(random.choice(self.monoSolos))
+
 
 radiosStations = ["non-stop-pop"]
 chosenRadio = random.choice(radiosStations)
-- 
GitLab