Commit 23b41b46 authored by Thorfin89's avatar Thorfin89

Ajout de radios

parent 8a186195
...@@ -7,34 +7,23 @@ Fip Nationale,FR,Musique,http://icecast.radiofrance.fr/fip-hifi.aac,Fip.png ...@@ -7,34 +7,23 @@ Fip Nationale,FR,Musique,http://icecast.radiofrance.fr/fip-hifi.aac,Fip.png
France Bleue Auxerre,FR,Régionale,http://direct.francebleu.fr/live/fbauxerre-midfi.mp3,fb-auxerre.png France Bleue Auxerre,FR,Régionale,http://direct.francebleu.fr/live/fbauxerre-midfi.mp3,fb-auxerre.png
France Bleue Isère,FR,Régionale,http://direct.francebleu.fr/live/fbisere-midfi.mp3,fb-isere.png France Bleue Isère,FR,Régionale,http://direct.francebleu.fr/live/fbisere-midfi.mp3,fb-isere.png
France Bleu Armorique,FR,Régionale,http://direct.francebleu.fr/live/fbarmorique-midfi.mp3,fb-armorique.png France Bleu Armorique,FR,Régionale,http://direct.francebleu.fr/live/fbarmorique-midfi.mp3,fb-armorique.png
RTL,FR,Généraliste,http://icecast.rtl.fr/rtl-1-44-128?listen=webCwsBCggNCQgLDQUGBAcGBg,rtl.png
Europe 1,FR,Généraliste,http://stream.europe1.fr/europe1.mp3,europe-1.png
Nostalgie,FR,Divers,http://scdn.nrjaudio.fm/adwz2/fr/30601/mp3_128.mp3?origine=fluxradios,nostalgie.png
Dépèche Mode,UK,Rock,http://streaming.radionomy.com/wwwdepechemodebe-radio,dempechemode.png Dépèche Mode,UK,Rock,http://streaming.radionomy.com/wwwdepechemodebe-radio,dempechemode.png
TSF Jazz,FR,Jazz,http://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3,tsf-jazz.png TSF Jazz,FR,Jazz,http://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3,tsf-jazz.png
Jazz Radio,FR,Jazz,http://jazzradio.ice.infomaniak.ch/jazzradio-high.mp3,jazz-radio.png Jazz Radio,FR,Jazz,http://jazzradio.ice.infomaniak.ch/jazzradio-high.mp3,jazz-radio.png
Live Ireland,DE,Celtic,http://192.111.140.11:8058/stream?type=http&nocache=51282,live-ireland.png Live Ireland,DE,Celtic,http://192.111.140.11:8058/stream,live-ireland.png
Bretagne Blog,DE,Celtic,http://laut.fm/bretagneblog,bretagneblog.png Bretagne Blog,DE,Celtic,http://laut.fm/bretagneblog,bretagneblog.png
Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderradio/stream,Highlander.png Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderradio/stream,Highlander.png
Virgin Rock 70,DE,Rock,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png Virgin Rock 70,DE,Rock,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Boom FM Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Celtic Folk Punk,DE,Celtic-Folk-Punk,https://streamingp.shoutcast.com/JamendoLounge,celtik-folk-punk.png Celtic Folk Punk,DE,Celtic-Folk-Punk,https://streamingp.shoutcast.com/JamendoLounge,celtik-folk-punk.png
Live Ireland,DE,Celtic,http://192.111.140.11:8058/stream?type=http&nocache=51282,live-ireland.png Siamsa,IR,Folk,https://cast02.siamsa.ie/radio/8000/radio.mp3,Siamsa.png
Bretagne Blog,DE,Celtic,http://laut.fm/bretagneblog,bretagneblog.png Classic 21,BE,Rock,https://radio.rtbf.be/c21/mp3-160/rf,classic21.png
Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderradio/stream,Highlander.png Radio Campus Lyon,FR,,https://listen.radioking.com/radio/489875/stream/546695,brume.png
France Bleue Isère,FR,Régionale,http://direct.francebleu.fr/live/fbisere-midfi.mp3,fb-isere.png Blues Radio,GR,Blues,https://i4.streams.ovh/sc/bluesrad/stream,blues_athens.png
France Bleu Armorique,FR,Régionale,http://direct.francebleu.fr/live/fbarmorique-midfi.mp3,fb-armorique.png Rock'n Blues,DE,Rock-Blues,https://rocknblues.stream.laut.fm/rocknblues,Rockn_Blues.png
RTL,FR,Généraliste,http://icecast.rtl.fr/rtl-1-44-128?listen=webCwsBCggNCQgLDQUGBAcGBg,rtl.png OUI FM Rock Indé,FR,Rock,https://ouifm5.ice.infomaniak.ch/ouifm5.mp3,OuiFM.png
Skafari,DE,Ska,https://skafari.stream.laut.fm/skafari,Skafari.png
Kultrock,DE,Folk,https://kultrock.stream.laut.fm/kultrock,Kultrock.png
RTL,FR,Généraliste,http://icecast.rtl.fr/rtl-1-44-128,rtl.png
Europe 1,FR,Généraliste,http://stream.europe1.fr/europe1.mp3,europe-1.png Europe 1,FR,Généraliste,http://stream.europe1.fr/europe1.mp3,europe-1.png
Nostalgie,FR,Divers,http://scdn.nrjaudio.fm/adwz2/fr/30601/mp3_128.mp3?origine=fluxradios,nostalgie.png Nostalgie,FR,Divers,http://scdn.nrjaudio.fm/adwz2/fr/30601/mp3_128.mp3,nostalgie.png
Dépèche Mode,UK,Rock,http://streaming.radionomy.com/wwwdepechemodebe-radio,dempechemode.png \ No newline at end of file
TSF Jazz,FR,Jazz,http://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3,tsf-jazz.png
Live Ireland,DE,Celtic,http://192.111.140.11:8058/stream?type=http&nocache=51282,live-ireland.png
Bretagne Blog,DE,Celtic,http://laut.fm/bretagneblog,bretagneblog.png
Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderradio/stream,Highlander.png
Bretagne Blog,DE,Celtic,http://laut.fm/bretagneblog,bretagneblog.png
Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderradio/stream,Highlander.png
Virgin Rock 70,DE,Rock,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Celtic Folk Punk,DE,Celtic-Folk-Punk,https://streamingp.shoutcast.com/JamendoLounge,celtik-folk-punk.png
Live Ireland,DE,Celtic,http://192.111.140.11:8058/stream?type=http&nocache=51282,live-ireland.png
\ No newline at end of file
...@@ -5,19 +5,20 @@ ...@@ -5,19 +5,20 @@
# import ---------------------------------- # import ----------------------------------
import tkinter as tk import tkinter as tk
from tkinter import ttk, Scale, HORIZONTAL, CENTER from tkinter import ttk, Scale, HORIZONTAL, CENTER
import csv
from PIL import Image, ImageTk from PIL import Image, ImageTk
import csv
mute = False # le son n'est pas coupé au démarrage mute = False # le son n'est pas coupé au démarrage
bg_color = "gray" bg_color = "gray"
# Chargement du fichier CSV contenant les informations : Nom, Pays, Type, Url, Logo # Chargement du fichier CSV contenant les informations : Nom, Pays, Type, Url, Logo
with open("./data/radios.csv", 'r', encoding='utf-8-sig') as radios_file: with open("./data/radios.csv", 'r', encoding='utf-8-sig') as radios_file:
''' utf-8-sig au lieu de utf-8 pour éviter l'erreur sur le nom du 1er champ '\ufeffNom' # utf-8-sig au lieu de utf-8 pour éviter l'erreur sur le nom du 1er champ "\ufeffNom"
pour extraire une donnée : radios_list[numéro de la radio][nom du champ]'''
radios_list = csv.DictReader(radios_file) radios_list = csv.DictReader(radios_file)
radios_list = [dict(ligne) for ligne in radios_list] # transforme en liste de dictionnaires radios_list = [dict(ligne) for ligne in radios_list] # transforme en liste de dictionnaires
# pour extraire une donnée : radios_list[numéro de la radio][nom du champ]
# classes --------------------------------- # classes ---------------------------------
...@@ -151,29 +152,29 @@ class Pupitre: ...@@ -151,29 +152,29 @@ class Pupitre:
else: else:
pass pass
def radio_stop(self): def radio_stop(self): # arrête le flux radio et réinitialise la zone de droite
self.flux_stop() self.flux_stop()
self.lbl_radio_selected.config(image="") self.lbl_radio_selected.config(image="")
self.lbl_info_radio.config(text="") self.lbl_info_radio.config(text="")
def radio_selected(self, num_radio): def radio_selected(self, num_radio): # active la radio choisie et affiche le log et le nom
self.radio_flux(radios_list[num_radio]['Url']) self.radio_flux(radios_list[num_radio]['Url'])
logo_size = 223 # taille du logo affiché à droite logo_size = 223 # taille du logo affiché à droite
# affichage le logo de la radio sélectionnée # affichage du logo de la radio sélectionnée dans la zone de droite
if radios_list[num_radio]['Logo'] != "": # si un logo est associé à la radio if radios_list[num_radio]['Logo']: # si un logo est associé à la radio
img = Image.open("./images/" + radios_list[num_radio]['Logo']) img = Image.open("./images/" + radios_list[num_radio]['Logo'])
else: # s'il n'y a pas de logo pour la radio else: # s'il n'y a pas de logo associé à la radio
img = Image.open("./images/radio.png") img = Image.open("./images/radio.png")
img = img.resize((logo_size, logo_size), Image.ANTIALIAS) img = img.resize((logo_size, logo_size), Image.ANTIALIAS) # redimensionne le logo
self.logo_selected = ImageTk.PhotoImage(img) self.logo_selected = ImageTk.PhotoImage(img)
self.lbl_radio_selected.config(image=self.logo_selected) self.lbl_radio_selected.config(image=self.logo_selected) # affiche le logo à droite
# affiche le nom de la radio sélectionnée # affiche le nom de la radio sélectionnée
self.lbl_info_radio.config(text=radios_list[num_radio]['Nom'], self.lbl_info_radio.config(text=radios_list[num_radio]['Nom'],
font=('Helvatical bold', 18), bg=bg_color, fg="white") font=('Helvetica', 18), bg=bg_color, fg="white")
self.num_radio_selected = num_radio self.num_radio_selected = num_radio
def switch_sound(self): # bascule on/off du son def switch_sound(self): # bascule on/off du son
...@@ -187,7 +188,8 @@ class Pupitre: ...@@ -187,7 +188,8 @@ class Pupitre:
self.btn_mute.config(image=self.icon_sound) # affichage "logo sound on" self.btn_mute.config(image=self.icon_sound) # affichage "logo sound on"
mute = False mute = False
def info(self): def info(self): # affiche les labels contenant les informations
# affichage de l'info sur la radio en cours d'audition # affichage de l'info sur la radio en cours d'audition
self.lbl_info_radio = tk.Label(self.menu) self.lbl_info_radio = tk.Label(self.menu)
self.lbl_info_radio.place(width=280, height=30, x=10, y=270) self.lbl_info_radio.place(width=280, height=30, x=10, y=270)
...@@ -198,27 +200,29 @@ class Pupitre: ...@@ -198,27 +200,29 @@ class Pupitre:
self.lbl_info.config(bg=bg_color, fg="white", font=('Helvatical bold', 8)) self.lbl_info.config(bg=bg_color, fg="white", font=('Helvatical bold', 8))
self.lbl_info.place(width=180, height=16, x=60, y=460) self.lbl_info.place(width=180, height=16, x=60, y=460)
def pages(self): def pages(self): # affiche les boutons de défilement des pages
# bouton page arrière # bouton page arrière
btn_pageb = ttk.Button(self.bandeau, image=self.icon_pageb, command=self.page_back, style="BW.TLabel") btn_pageb = ttk.Button(self.bandeau, image=self.icon_pageb, command=self.page_back, style="BW.TLabel")
btn_pageb.place(width=40, height=32, x=5, y=10) btn_pageb.place(width=40, height=32, x=5, y=10)
# bouton page avant # bouton page avant
btn_pagef = ttk.Button(self.bandeau, image=self.icon_pagef, command=self.page_forward, style="BW.TLabel") btn_pagef = ttk.Button(self.bandeau, image=self.icon_pagef, command=self.page_forward, style="BW.TLabel")
btn_pagef.place(width=40, height=32, x=455, y=10) btn_pagef.place(width=40, height=32, x=455, y=10)
def page_back(self): def page_back(self): # commande de page en arrière
self.current_page -= 1 self.current_page -= 1
if self.current_page < 0: if self.current_page < 0: # Quand tente de remonter avant la première page (page 0)
self.current_page = self.nb_pages self.current_page = self.nb_pages # on boucle sur la dernière
self.mosaique() self.mosaique()
def page_forward(self): def page_forward(self): # commande page en avant
self.current_page += 1 self.current_page += 1
if self.current_page > self.nb_pages: if self.current_page > self.nb_pages: # quand on avance au-delà de la dernière page
self.current_page = 0 self.current_page = 0 # on revient à la première
self.mosaique() self.mosaique()
def boucle(self): def boucle(self): # boucle principale de tkinter
self.root.mainloop() self.root.mainloop()
70 73
\ No newline at end of file \ No newline at end of file
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