Open wturrell opened 3 months ago
Hi @wturrell It took me a while to reply, sorry about that...
What exactly are you trying to do with this?
What you've asked can be achieved with the following script, which will start mpv
and exit, but then what do you want to do with it?
import subprocess
import sys
command = ['mpv', '--no-video', '--quiet', '--profile=pyradio', '--input-ipc-server=/tmp/mpvsocket', '--playlist=http://somafm.com/illstreet.pls']
# print the command to be executed
print(' '.join(command))
# Start the media player
process = subprocess.Popen(command)
# Exit the script while leaving the media player running
sys.exit()
You can save this to a file, pplay.py
for example, and execute it from a terminal as python pplay.py
mpv
will be executed in the background, but the only way to communicate with it it through socat
, and then again you need to know mpv's IPC commands...
Other than that, you can just kill it killall mpv
They just want to play/extract the url/stream in a separate mpv process for better player control. Here's a little workaround (for linux):
mpv $(ps uax |grep -i pyradio |grep -oP 'https?\://[^ ]+')
This is manual way of doing it. They ask to implement it directly in pyradio and i also think it's a good idea.
Independent player means:
You could also add a kill-switch to have control over a separate mpv process
(i.e. to cleanup any already running pyradio mpv players):
kill $(ps uax |grep -i pyradio |tr -s ' ' |cut -f2 -d ' ')
Do you mean something like this?
Download this file: https://github.com/s-n-g/pyradio/archive/refs/heads/tmp.zip
Unzip it and you will get a folder named pyradio-tmp
Then
cd pyradio-tmp
./devel/build_install_pyradio
Start pyradio
select a station and press "X"
I have pushed an update to this...
Always at https://github.com/s-n-g/pyradio/archive/refs/heads/tmp.zip
Now you cane even execute like this
pyradio -p21 -x
which will play (with the external player) station No 21 in the default playlist
Installation and testing instructions as above :wink:
i.e. supposing you want to use mpv rather than pyradio occasionally, because of its ability to pause/rewind/fast-forward a stream.
Rather than typing the command yourself and finding and manually copying/pasting the stream URL, you could just press a button in pyradio: it would quit and then launch the appropriate mpv command in your terminal. Maybe call it "play in command line" or similar.