Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
WebRadioPi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thorfin89
WebRadioPi
Commits
0bbbd265
Commit
0bbbd265
authored
Jan 08, 2023
by
Thorfin89
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajout de la commande Play
parent
e2723ef3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
main.py
main.py
+19
-2
rw_pupitre.py
rw_pupitre.py
+22
-10
No files found.
main.py
View file @
0bbbd265
...
@@ -2,17 +2,34 @@
...
@@ -2,17 +2,34 @@
# 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
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
()
def
radio_play
(
self
):
player
=
self
.
instance
.
media_player_new
()
media
=
self
.
instance
.
media_new
(
"http://live.leanstream.co/CJOTFM-MP3"
)
player
.
set_media
(
media
)
player
.
play
()
time
.
sleep
(
10
)
player
.
stop
()
def
radio_stop
(
self
):
pass
pass
app
=
Radio
()
# instancie l'application
app
=
Radio
()
# instancie l'application
app
.
boucle
()
app
.
boucle
()
rw_pupitre.py
View file @
0bbbd265
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
# import ----------------------------------
# import ----------------------------------
import
tkinter
as
tk
import
tkinter
as
tk
from
tkinter
import
ttk
# classes ---------------------------------
# classes ---------------------------------
...
@@ -19,18 +20,29 @@ class Pupitre:
...
@@ -19,18 +20,29 @@ class Pupitre:
self
.
root
.
title
(
"Web Radio Pi"
)
self
.
root
.
title
(
"Web Radio Pi"
)
self
.
root
.
geometry
(
"800x480"
)
self
.
root
.
geometry
(
"800x480"
)
self
.
root
.
resizable
(
width
=
False
,
height
=
False
)
self
.
root
.
resizable
(
width
=
False
,
height
=
False
)
# Fenêtre Haute : Titre / Menu
self
.
root
.
attributes
(
'-fullscreen'
,
False
)
# < A basculer sur False pour les test sur PC
self
.
bandeau
=
tk
.
Frame
(
self
.
root
,
width
=
"800"
,
height
=
"80"
,
bg
=
"#8D8D8D"
)
self
.
zones
()
self
.
bandeau
.
grid
(
row
=
0
,
column
=
0
,
columnspan
=
2
)
# Fenêtre contenant les boutons (vignettes) des radios
self
.
cadreVignettes
=
tk
.
Frame
(
self
.
root
,
width
=
"500"
,
height
=
"400"
,
bg
=
"#000000"
)
self
.
cadreVignettes
.
grid
(
row
=
1
,
column
=
0
)
# Fenêtre d'affichage de la radio en cours de lecture, et des boutons de commande
self
.
cadreMenu
=
tk
.
Frame
(
self
.
root
,
width
=
"300"
,
height
=
"400"
,
bg
=
"#BFBFBF"
)
self
.
cadreMenu
.
grid
(
row
=
1
,
column
=
1
)
def
boucle
(
self
):
def
boucle
(
self
):
self
.
root
.
mainloop
()
self
.
root
.
mainloop
()
def
zones
(
self
):
def
zones
(
self
):
pass
# fenêtre Haute : Titre / Menu
bandeau
=
tk
.
Frame
(
self
.
root
,
width
=
"800"
,
height
=
"80"
,
bg
=
"#8D8D8D"
)
bandeau
.
grid
(
row
=
0
,
column
=
0
,
columnspan
=
2
)
# fenêtre contenant les boutons (vignettes) des radios
vignettes
=
tk
.
Frame
(
self
.
root
,
width
=
"500"
,
height
=
"400"
,
bg
=
"#000000"
)
vignettes
.
grid
(
row
=
1
,
column
=
0
)
# fenêtre d'affichage de la radio en cours de lecture, et des boutons de commande
menu
=
tk
.
Frame
(
self
.
root
,
width
=
"300"
,
height
=
"400"
,
bg
=
"#BFBFBF"
)
menu
.
grid
(
row
=
1
,
column
=
1
)
# affichage de la radio en cours de lecture
lbl_radio
=
tk
.
Label
(
bandeau
,
text
=
"RADIO"
)
lbl_radio
.
pack
(
padx
=
20
,
pady
=
10
)
# boutons de commande
btn_play
=
ttk
.
Button
(
menu
,
text
=
"Play"
,
command
=
self
.
radio_play
)
btn_play
.
pack
()
btn_pause
=
ttk
.
Button
(
menu
,
text
=
"Pause"
,
command
=
None
)
btn_pause
.
pack
()
btn_stop
=
ttk
.
Button
(
menu
,
text
=
"Stop"
,
command
=
self
.
radio_stop
)
btn_stop
.
pack
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment