Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hairygael authored Dec 9, 2024
1 parent a2faff6 commit e76b0a0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gestures/startRadio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def startRadio(station):
if runtime.isStarted("i01.audioPlayer"):
audioPlayer = runtime.getService("i01.audioPlayer")
audiocfg = audioPlayer.getConfig()
print("Radio started")
if audiocfg.stream == 0:
audiocfg.stream = 1
audioPlayer.save()
audioPlayer.apply(audiocfg)
audioPlayer.broadcastState()
print(station)
audioPlayer.playFile(station)

def stopRadio():
if runtime.isStarted('i01.audioPlayer'):
audioPlayer = runtime.getService('i01.audioPlayer')
audioPlayer.stop()
print("Radio stopped")
audiocfg = audioPlayer.getConfig()
if audiocfg.stream == 1:
audiocfg.stream = 1
audioPlayer.save()
audioPlayer.apply(audiocfg)
audioPlayer.broadcastState()

0 comments on commit e76b0a0

Please sign in to comment.