Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
J
Jarvis
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Opération
Environnements
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Loïc DUBARD
Jarvis
Validations
7b5f736b
Valider
7b5f736b
rédigé
Il y a 5 ans
par
Loïc Wikle DUBARD
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
lecteur de musique intégré
parent
66a2a525
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
Jarvis.py
+58
-22
58 ajouts, 22 suppressions
Jarvis.py
__pycache__/myimports.cpython-37.pyc
+0
-0
0 ajout, 0 suppression
__pycache__/myimports.cpython-37.pyc
myimports.py
+3
-0
3 ajouts, 0 suppression
myimports.py
avec
61 ajouts
et
22 suppressions
Jarvis.py
+
58
−
22
Voir le fichier @
7b5f736b
...
@@ -76,14 +76,15 @@ def parle(texte, save=True, lang='fr-CA'):
...
@@ -76,14 +76,15 @@ def parle(texte, save=True, lang='fr-CA'):
print
(
line_no
)
print
(
line_no
)
# mp3 = mutagen.mp3.MP3('saved_voice/{}.mp3'.format(line_no))
# mp3 = mutagen.mp3.MP3('saved_voice/{}.mp3'.format(line_no))
# frequency = mp3.info.sample_rate
# frequency = mp3.info.sample_rate
if
pygame
.
mixer
.
music
.
get_busy
():
if
pygame
.
mixer
.
Channel
(
0
)
.
get_busy
():
pygame
.
mixer
.
music
.
stop
()
pygame
.
mixer
.
Channel
(
0
)
.
stop
()
# pygame.mixer.quit()
# pygame.mixer.quit()
# pygame.mixer.init(frequency=frequency)
# pygame.mixer.init(frequency=frequency)
try
:
try
:
pygame
.
mixer
.
music
.
load
(
'
saved_voice/{}.mp3
'
.
format
(
line_no
))
sound
=
pygame
.
mixer
.
Sound
(
'
saved_voice/{}.mp3
'
.
format
(
line_no
))
pygame
.
mixer
.
music
.
play
()
# pygame.mixer.music.load('saved_voice/{}.mp3'.format(line_no))
pygame
.
mixer
.
music
.
set_endevent
()
pygame
.
mixer
.
Channel
(
0
).
play
(
sound
)
pygame
.
mixer
.
Channel
(
0
).
set_endevent
()
except
:
except
:
print
(
"
ERROR: can
'
t play audio
"
)
print
(
"
ERROR: can
'
t play audio
"
)
...
@@ -372,30 +373,65 @@ def tests(entre):
...
@@ -372,30 +373,65 @@ def tests(entre):
sys
.
exit
()
sys
.
exit
()
# gestion de la musique
# gestion de la musique
if
"
play
"
in
entre
or
"
jouede la musique
"
in
entre
:
'''
os
.
system
(
"
rhythmbox-client --play --shuffle
"
)
TODO: pygame music player
process
=
Popen
([
"
rhythmbox-client
"
,
"
--print-playing
"
],
stdout
=
PIPE
,
stderr
=
PIPE
)
mixer_1 = pygame.mixer.Channel(1)
stdout
,
stderr
=
process
.
communicate
()
sound = pygame.mixer.Sound(filename)
parle
(
"
j
'
ai lancé
"
+
stdout
.
decode
(),
False
)
methodes sur mixer_1 :
play(sound)
pause()
unpause()
stop()
fadeout(time)
set_volume(value)
get_volume()
get_busy()
get_sound()
queue(sound)
get_queue()
set_endevent()
get_endevent()
'''
if
"
play
"
in
entre
or
"
joue de la musique
"
in
entre
or
"
met de la musique
"
in
entre
:
# os.system("rhythmbox-client --play --shuffle")
# process = Popen(["rhythmbox-client", "--print-playing"], stdout=PIPE, stderr=PIPE)
# stdout, stderr = process.communicate()
indice_sound
=
random
.
randint
(
0
,
len
(
playlist_sound
)
-
1
)
sound
=
playlist_sound
[
indice_sound
]
pygame
.
mixer
.
Channel
(
1
).
play
(
sound
)
parle
(
"
j
'
ai lancé
"
+
playlist_text
[
indice_sound
],
False
)
if
"
pause
"
in
entre
:
if
"
pause
"
in
entre
:
os
.
system
(
"
rhythmbox-client --pause
"
)
# os.system("rhythmbox-client --pause")
pygame
.
mixer
.
Channel
(
1
).
pause
()
parle
(
"
pause
"
)
parle
(
"
pause
"
)
if
"
musique suivante
"
in
entre
:
if
"
musique suivante
"
in
entre
:
os
.
system
(
"
rhythmbox-client --next
"
)
# os.system("rhythmbox-client --next")
indice_sound
=
(
indice_sound
+
1
)
%
len
(
playlist_sound
)
sound
=
playlist_sound
[
indice_sound
]
pygame
.
mixer
.
Channel
(
1
).
play
(
sound
)
parle
(
"
j
'
ai lancé
"
+
playlist_text
[
indice_sound
],
False
)
if
"
musique precedente
"
in
entre
:
if
"
musique precedente
"
in
entre
:
os
.
system
(
"
rhythmbox-client --previous
"
)
# os.system("rhythmbox-client --previous")
indice_sound
=
(
indice_sound
-
1
)
%
len
(
playlist_sound
)
sound
=
playlist_sound
[
indice_sound
]
pygame
.
mixer
.
Channel
(
1
).
play
(
sound
)
parle
(
"
j
'
ai lancé
"
+
playlist_text
[
indice_sound
],
False
)
if
"
nom de la musique
"
in
entre
:
if
"
nom de la musique
"
in
entre
:
process
=
Popen
([
"
rhythmbox-client
"
,
"
--print-playing
"
],
stdout
=
PIPE
,
stderr
=
PIPE
)
#
process = Popen(["rhythmbox-client", "--print-playing"], stdout=PIPE, stderr=PIPE)
stdout
,
stderr
=
process
.
communicate
()
#
stdout, stderr = process.communicate()
parle
(
stdout
.
decode
()
,
False
)
parle
(
"
j
'
ai lancé
"
+
playlist_text
[
indice_sound
]
,
False
)
# gestion du volume
# gestion du volume
if
"
monte
"
in
entre
and
any
(
e
in
entre
for
e
in
[
"
son
"
,
"
volume
"
]):
if
"
monte
"
in
entre
and
any
(
e
in
entre
for
e
in
[
"
son
"
,
"
volume
"
]):
# os.system("pactl -- set-sink-volume 0 +10%")
# os.system("pactl -- set-sink-volume 0 +10%")
os
.
system
(
"
rhythmbox-client --volume-up
"
)
# os.system("rhythmbox-client --volume-up")
pygame
.
mixer
.
Channel
(
1
).
set_volume
(
pygame
.
mixer
.
Channel
(
1
).
get_volume
()
+
10
)
print
(
"
[!] music volume :
"
,
pygame
.
mixer
.
Channel
(
1
).
get_volume
())
if
"
baisse
"
in
entre
and
any
(
e
in
entre
for
e
in
[
"
son
"
,
"
volume
"
]):
if
"
baisse
"
in
entre
and
any
(
e
in
entre
for
e
in
[
"
son
"
,
"
volume
"
]):
# os.system("pactl -- set-sink-volume 0 -10%")
# os.system("pactl -- set-sink-volume 0 -10%")
os
.
system
(
"
rhythmbox-client --volume-down
"
)
# os.system("rhythmbox-client --volume-down")
pygame
.
mixer
.
Channel
(
1
).
set_volume
(
pygame
.
mixer
.
Channel
(
1
).
get_volume
()
+
10
)
print
(
"
[!] music volume :
"
,
pygame
.
mixer
.
Channel
(
1
).
get_volume
())
# éteind le pc
# éteind le pc
# if "eteint" in entre and "ordinateur" in entre: # Eteint l'ordinateur
# if "eteint" in entre and "ordinateur" in entre: # Eteint l'ordinateur
...
@@ -468,11 +504,11 @@ def tests(entre):
...
@@ -468,11 +504,11 @@ def tests(entre):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
parle
(
"
Bonjour !
"
+
random
.
choice
([
""
,
"
Vous allez bien aujourd
'
hui ?
"
]))
parle
(
"
Bonjour !
"
+
random
.
choice
([
""
,
"
Vous allez bien aujourd
'
hui ?
"
]))
get_busy
=
pygame
.
mixer
.
music
.
get_busy
()
get_busy
=
pygame
.
mixer
.
Channel
(
0
)
.
get_busy
()
currently_playing
=
get_busy
currently_playing
=
get_busy
"""
boucle principale
"""
"""
boucle principale
"""
while
True
:
while
True
:
get_busy
=
pygame
.
mixer
.
music
.
get_busy
()
get_busy
=
pygame
.
mixer
.
Channel
(
0
)
.
get_busy
()
# booléen qui indique si l'ia est en train de parler
# booléen qui indique si l'ia est en train de parler
# end_event = pygame.mixer.music.get_endevent() # booléen indique si l'ia a fini de parler
# end_event = pygame.mixer.music.get_endevent() # booléen indique si l'ia a fini de parler
currently_playing
=
get_busy
currently_playing
=
get_busy
...
@@ -490,9 +526,9 @@ if __name__ == "__main__":
...
@@ -490,9 +526,9 @@ if __name__ == "__main__":
if
currently_playing
:
if
currently_playing
:
print
(
'
[!]talkin...
'
,
end
=
''
)
print
(
'
[!]talkin...
'
,
end
=
''
)
print
(
'
vol:
'
,
pygame
.
mixer
.
music
.
get_volume
())
print
(
'
vol:
'
,
pygame
.
mixer
.
Channel
(
0
)
.
get_volume
())
if
currently_playing
and
'
stop
'
in
entre
:
if
currently_playing
and
'
stop
'
in
entre
:
pygame
.
mixer
.
music
.
stop
()
pygame
.
mixer
.
Channel
(
0
)
.
stop
()
elif
deverouillage
(
entre
):
elif
deverouillage
(
entre
):
tests
(
entre
)
tests
(
entre
)
Ce diff est replié.
Cliquez pour l'agrandir.
__pycache__/myimports.cpython-37.pyc
+
0
−
0
Voir le fichier @
7b5f736b
Aucun aperçu pour ce type de fichier
Ce diff est replié.
Cliquez pour l'agrandir.
myimports.py
+
3
−
0
Voir le fichier @
7b5f736b
...
@@ -96,6 +96,9 @@ fonctionnalites = [
...
@@ -96,6 +96,9 @@ fonctionnalites = [
'
jouer de la musique
'
'
jouer de la musique
'
# 'traduire un texte ou un mot dans une autre langue'
# 'traduire un texte ou un mot dans une autre langue'
]
]
with
open
(
"
playlist.txt
"
)
as
f
:
playlist_text
=
f
.
readlines
()
playlist_sound
=
[
pygame
.
mixer
.
Sound
(
sound
)
for
sound
in
playlist_text
]
class
BreakoutException
(
Exception
):
class
BreakoutException
(
Exception
):
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter