Commit 06cf3cb5 authored by Thorfin89's avatar Thorfin89

Ajout d'un fichier de configuration : init

parent 0d97eb9f
# 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/
72
\ No newline at end of file
...@@ -2,9 +2,6 @@ ...@@ -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): ...@@ -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
......
...@@ -2,16 +2,12 @@ ...@@ -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: ...@@ -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)
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