Move examples out of tests directory (#193)
This commit is contained in:
1 parent
d4f5b549da
commit
c3885a494b
2 files changed
No files matched your search
@@ -1,37 +0,0 @@
|
||||
import time
|
||||
import mpv
|
||||
|
||||
"""
|
||||
mpv_smoke_test.py - test playback of media
|
||||
"""
|
||||
|
||||
def handle_event(event):
|
||||
print(f"EVENT: {event['event_id']}")
|
||||
|
||||
|
||||
player = mpv.MPV(
|
||||
audio_display=False,
|
||||
log_handler=print,
|
||||
loglevel="info",
|
||||
)
|
||||
|
||||
player.event_callback = handle_event
|
||||
|
||||
print("Loading media...")
|
||||
player.play("https://icecast.radiofrance.fr/fip-midfi.mp3")
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
print("Pausing...")
|
||||
player.pause = True
|
||||
time.sleep(2)
|
||||
|
||||
print("Resuming...")
|
||||
player.pause = False
|
||||
time.sleep(5)
|
||||
|
||||
print("Stopping...")
|
||||
player.stop()
|
||||
|
||||
time.sleep(2)
|
||||
print("Done.")
|
||||
@@ -1,39 +0,0 @@
|
||||
import time
|
||||
import logging
|
||||
|
||||
from linux_voice_assistant.player.libmpv import LibMpvPlayer
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
player = LibMpvPlayer()
|
||||
|
||||
player.play("https://icecast.radiofrance.fr/fip-midfi.mp3")
|
||||
time.sleep(5)
|
||||
|
||||
player.pause()
|
||||
time.sleep(2)
|
||||
|
||||
player.resume()
|
||||
time.sleep(5)
|
||||
|
||||
print("Set volume to 80")
|
||||
player.set_volume(80)
|
||||
time.sleep(2)
|
||||
|
||||
print("Duck")
|
||||
player.duck()
|
||||
time.sleep(2)
|
||||
|
||||
print("Set volume to 40 while ducked")
|
||||
player.set_volume(40)
|
||||
time.sleep(2)
|
||||
|
||||
print("Unduck")
|
||||
player.unduck()
|
||||
time.sleep(2)
|
||||
|
||||
player.stop()
|
||||
time.sleep(2)
|
||||
|
||||
print("Final state:", player.state())
|
||||
Reference in new issue
Block a user