Commit 1419c387 authored by Thorfin89's avatar Thorfin89

Version 1.3

parent 146fda0f
...@@ -18,5 +18,14 @@ ...@@ -18,5 +18,14 @@
#### Problème de path #### Problème de path
https://openclassrooms.com/forum/sujet/probleme-python-path-et-fichier - https://openclassrooms.com/forum/sujet/probleme-python-path-et-fichier
#### Info sur les radios :
class Meta de vlc
- https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc.Meta-class.html
Class Media
- https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc.Media-class.html
Code source :
- https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc-pysrc.html
\ No newline at end of file
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
# import ---------------------------------- # import ----------------------------------
from vlc import Instance from vlc import Instance
from vlc import Media, MediaPlayer, Meta
''' installer le paquet python-vlc : ''' installer le paquet python-vlc :
$ sudo pip3 install python-vlc $ sudo pip3 install python-vlc
installer aussi l'application VLC ''' installer aussi l'application VLC '''
......
...@@ -119,7 +119,7 @@ class Pupitre: ...@@ -119,7 +119,7 @@ class Pupitre:
# affiche les infos sur le titre en cours d'écoute # affiche les infos sur le titre en cours d'écoute
self.lbl_radio_info = tk.Label(self.menu, background=bg_color_light) self.lbl_radio_info = tk.Label(self.menu, background=bg_color_light)
self.lbl_radio_info.place(width=250, height=90, x=20, y=300) self.lbl_radio_info.place(width=250, height=80, x=20, y=305)
self.lbl_radio_info.config(font=('Helvetica', 10), anchor="n", bg=bg_color, fg="white", wraplength=240) self.lbl_radio_info.config(font=('Helvetica', 10), anchor="n", bg=bg_color, fg="white", wraplength=240)
# potentiomètre de volume # potentiomètre de volume
...@@ -235,10 +235,19 @@ class Pupitre: ...@@ -235,10 +235,19 @@ class Pupitre:
if self.radio_on: # si on a une radio en cours d'écoute if self.radio_on: # si on a une radio en cours d'écoute
flux_info = self.media.get_meta(Meta.NowPlaying) # on récupère l'info sur le titre actuel flux_info = self.media.get_meta(Meta.NowPlaying) # on récupère l'info sur le titre actuel
if flux_info: # si on a bien une information sur le titre if flux_info: # si on a bien une information sur le titre
longueur = len(flux_info)
if flux_info[0:4] == ". - ": # nettoyage boom 99.7
flux_info = flux_info[4:longueur-3]
flux_info = flux_info.replace("~", " ") # nettoyage des tildes
flux_info = flux_info.replace(" - ", "\n") # remplacer par des retours à la ligne
self.lbl_radio_info.config(text=flux_info) # afficher les infos sous le titre de la radio self.lbl_radio_info.config(text=flux_info) # afficher les infos sous le titre de la radio
self.root.after(2000, self.radio_info) # relance la fonction 'now_playing_info' toutes les 2s self.root.after(1000, self.radio_info) # relance la fonction 'now_playing_info' toutes les 1s
def boucle(self): # boucle principale de tkinter def boucle(self): # boucle principale de tkinter
self.root.mainloop() self.root.mainloop()
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