Valider 06cf3cb5 rédigé par Thorfin89's avatar Thorfin89
Parcourir les fichiers

Ajout d'un fichier de configuration : init

parent 0d97eb9f
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+11 −0
Numéro de ligne d'origine Ligne d'origine Numéro de ligne de diff Ligne de diff
# WebRadioPi
# WebRadioPi


Lecteur de radios internet

Pour toute information : thorfin89@free.fr

### SOURCES :
#### Doc python-vlc :
- https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc.MediaPlayer-class.html
- https://stackoverflow.com/questions/46758360/how-to-play-streaming-audio-from-internet-radio-on-python-3-5-3
#### Doc tkinter :
- http://tkinter.fdex.eu/index.html
- http://pascal.ortiz.free.fr/contents/tkinter/tkinter/

init

0 → 100644
+1 −0
Numéro de ligne d'origine Ligne d'origine Numéro de ligne de diff Ligne de diff
72
 No newline at end of file
+5 −5
Numéro de ligne d'origine Ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -2,9 +2,6 @@
# Fichier : main.py
# Fichier : main.py
# Auteur  : Daniel SAZERAT (thorfin89@free.fr)
# Auteur  : Daniel SAZERAT (thorfin89@free.fr)


# Doc python-vlc
# https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc.MediaPlayer-class.html
# https://stackoverflow.com/questions/46758360/how-to-play-streaming-audio-from-internet-radio-on-python-3-5-3


# import ----------------------------------
# import ----------------------------------
from rw_pupitre import Pupitre
from rw_pupitre import Pupitre
@@ -29,10 +26,13 @@ class Radio(Pupitre):
    def radio_stop(self):
    def radio_stop(self):
        self.player.stop()
        self.player.stop()


    def volume(self, vol):
    def volume(self, vol_potar):
        # on récupère la valeur du potentiomètre de volume
        # on récupère la valeur du potentiomètre de volume
        vol_audio = int(vol)
        vol_audio = int(vol_potar)
        self.player.audio_set_volume(vol_audio)
        self.player.audio_set_volume(vol_audio)
        sauvegarde = open("init", "w")
        sauvegarde.write(vol_potar)
        sauvegarde.close()




app = Radio()  # instancie l'application
app = Radio()  # instancie l'application
+9 −11
Numéro de ligne d'origine Ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -2,16 +2,12 @@
# Fichier : rw_pupitre.py
# Fichier : rw_pupitre.py
# Auteur  : Daniel SAZERAT (thorfin89@free.fr)
# Auteur  : Daniel SAZERAT (thorfin89@free.fr)


# Doc tkinter
# http://tkinter.fdex.eu/index.html
# http://pascal.ortiz.free.fr/contents/tkinter/tkinter/


# import ----------------------------------
# import ----------------------------------
import os
import tkinter as tk
import tkinter as tk
from tkinter import ttk
from tkinter import ttk
from tkinter import Tk, RIGHT, LEFT, SOLID, VERTICAL
from tkinter import VERTICAL
from tkinter import Frame, Label, Button, messagebox, Scale
from tkinter import Scale, StringVar, DoubleVar




# classes ---------------------------------
# classes ---------------------------------
@@ -50,7 +46,9 @@ class Pupitre:
        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()


        # potar volume
        # potentiomètre de volume
        potar = Scale(menu, from_=100, to=0, orient=VERTICAL, length=200, command=self.volume)
        lecture = open("init", "r")  # on charge configuration sauvegardée
        potar.pack(padx=10, pady=5)
        volume_init = lecture.read()
        vol_potar = Scale(menu, from_=100, to=0, orient=VERTICAL, length=200, command=self.volume)
        vol_potar.set(volume_init)
        vol_potar.pack(padx=10, pady=5)