Author Topic: M3U/PLS stream/playlist launcher (mplayer)  (Read 1735 times)

com64 (OP)

  • Posts: 82
    • 0x64.ca
M3U/PLS stream/playlist launcher (mplayer)
« on: August 27, 2015, 10:48:02 pm »
Put this together to play internet radio streams (although normal playlists or audio files will work).

Included:
A build of mplayer
A script to either start mplayer with a playlist, or instruct it to load a new playlist
A script to stop mplayer

You could add additional commands to pause, seek, skip, or whatever command mplayer accepts. (This is trivial)

What it does:
Creates a fifo file in home directory, starts mplayer in slave mode, passes it commands through that file.

run.sh
Code: [Select]
#!/bin/sh

temp="/media/data/local/home/.radio"
player="./mplayer"
playername="mplayer"

if pgrep "$playername" > /dev/null
then
    echo loadlist "$1" > "$temp"
else
    if [ -e "$temp" ]
    then
        rm "$temp"
    fi
    mkfifo "$temp"
    nohup "$player" -slave -input file="$temp" -playlist "$1" &
fi

terminate.sh
Code: [Select]
#!/bin/sh

temp="/media/data/local/home/.radio"

if [ -e "$temp" ]
then
    echo stop > "$temp"
fi

Todo:
Probably not use mplayer
Sounder implementation (start-stop-daemon)
GUI?

OPK (dropbox) (7 528 448 Bytes)

DEMO (YouTube)
« Last Edit: August 27, 2015, 11:20:18 pm by com64 »