Commit 8e9a2c37 authored by Thorfin89's avatar Thorfin89

Ajout des commandes Pause et Stop

parent 0bbbd265
...@@ -9,26 +9,25 @@ ...@@ -9,26 +9,25 @@
# import ---------------------------------- # import ----------------------------------
from rw_pupitre import Pupitre from rw_pupitre import Pupitre
import vlc # sudo pip3 install python-vlc import vlc # sudo pip3 install python-vlc
import time
# classes --------------------------------- # classes ---------------------------------
class Radio(Pupitre): class Radio(Pupitre):
def __init__(self): def __init__(self):
super().__init__() # constructeur de la classe parente super().__init__() # constructeur de la classe parente
self.instance = vlc.Instance() self.instance = vlc.Instance()
self.player = self.instance.media_player_new()
media = self.instance.media_new("http://live.leanstream.co/CJOTFM-MP3")
self.player.set_media(media)
def radio_play(self): def radio_play(self):
player = self.instance.media_player_new() self.player.play()
media = self.instance.media_new("http://live.leanstream.co/CJOTFM-MP3")
player.set_media(media)
player.play()
time.sleep(10)
player.stop()
def radio_pause(self):
self.player.pause()
def radio_stop(self): def radio_stop(self):
pass self.player.stop()
app = Radio() # instancie l'application app = Radio() # instancie l'application
......
...@@ -42,7 +42,7 @@ class Pupitre: ...@@ -42,7 +42,7 @@ class Pupitre:
# boutons de commande # boutons de commande
btn_play = ttk.Button(menu, text="Play", command=self.radio_play) btn_play = ttk.Button(menu, text="Play", command=self.radio_play)
btn_play.pack() btn_play.pack()
btn_pause = ttk.Button(menu, text="Pause", command=None) btn_pause = ttk.Button(menu, text="Pause", command=self.radio_pause)
btn_pause.pack() btn_pause.pack()
btn_stop = ttk.Button(menu, text="Stop", command=self.radio_stop) btn_stop = ttk.Button(menu, text="Stop", command=self.radio_stop)
btn_stop.pack() btn_stop.pack()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment