audio-streamer/audio-streamer.py
20xd6 eb9115b486 First commit.
Minimum viable product on both a command line video player and a gui
player. Both need work and neither stream auido by default.
2021-01-08 16:11:25 -05:00

32 lines
769 B
Python
Executable File

#!/usr/bin/env python3
import mpv
import argparse
import os
cmd_option_set = argparse.ArgumentParser(description='Stream Audio')
cmd_option_set.add_argument('audio_stream_URL', type=str, help='URL of the audio you want streamed.')
cmd_options = cmd_option_set.parse_args()
audio_stream = cmd_options.audio_stream_URL
if ( not audio_stream ):
print ("No URL given\nPlease provide one.")
os._exit(0)
audio_player = mpv.MPV(ytdl=True, input_default_bindings=True, input_vo_keyboard=True, osc=True)
@audio_player.on_key_press('q')
def my_q_binding():
print('THERE IS NO ESCAPE')
try:
audio_player.play(audio_stream)
audio_player.fullscreen
audio_player.wait_for_playback()
del audio_player
except mpv.ShutdownError:
print("Playback has ended.")