Remove repeat alarm since it does not work on HTTP streams
This commit is contained in:
parent
be158d1bed
commit
ab306e618c
17
clock.py
17
clock.py
|
@ -50,17 +50,10 @@ Position = collections.namedtuple('Position', 'x y')
|
|||
global sound_process
|
||||
sound_process = None
|
||||
|
||||
def play_sound(sound_source, backup_sound_source):
|
||||
failures = 0
|
||||
|
||||
source = sound_source
|
||||
def play_sound(source):
|
||||
while True:
|
||||
print("beep beep! " + source)
|
||||
print("beep beep!")
|
||||
playsound(source)
|
||||
if source.startswith(("http://", "https://")) and failures < 3:
|
||||
failures += 1
|
||||
if failures >= 3:
|
||||
source = backup_sound_source
|
||||
|
||||
class MyClockWidget(FloatLayout):
|
||||
set_alarm_mode = False
|
||||
|
@ -73,8 +66,8 @@ class MyClockWidget(FloatLayout):
|
|||
alarm_modified = False
|
||||
seconds_to_next_alarm = False
|
||||
led_color = [0, 0, 0]
|
||||
sound_source = "https://icecast.omroep.nl/radio1-bb-mp3"
|
||||
backup_sound_source = "Woodpecker Chirps - QuickSounds.com.mp3"
|
||||
# sound_source = "https://icecast.omroep.nl/radio1-bb-mp3"
|
||||
sound_source = "Woodpecker Chirps - QuickSounds.com.mp3"
|
||||
|
||||
def draw_face(self):
|
||||
"""
|
||||
|
@ -174,7 +167,7 @@ class MyClockWidget(FloatLayout):
|
|||
return
|
||||
|
||||
if self.seconds_to_next_alarm < 0.1 and sound_process is None:
|
||||
sound_process = Process(target=play_sound, args=(self.sound_source, self.backup_sound_source,))
|
||||
sound_process = Process(target=play_sound, args=(self.sound_source,))
|
||||
sound_process.start()
|
||||
|
||||
def calc_seconds_to_next_alarm(self):
|
||||
|
|
Loading…
Reference in New Issue