VSIDO Community

VSIDO Support => Scripts and How To's => Scripts => Topic started by: hakerdefo on August 06, 2015, 06:36:49 PM

Title: PMRP - Poor Man's Radio Player
Post by: hakerdefo on August 06, 2015, 06:36:49 PM
I was confused whether to post this as update to 'RADIO VSIDO - VSIDO's very own Internet radio player' or to start a new thread? But after some consideration I decided to start it as a new topic.
* So here it is. PMRP - Poor Man's Radio Player. Probably the best bash based Internet radio player in the world.
* Over 250 hand-picked radio stations spanning across different genres and subjects. Whatever you feel like listening to, you'll find it in PMRP.
* Better menus for easier navigation-selection of radio stations.
* Currently playing track information (If available).
Installing PMRP is easy. PMRP uses mpg123 as the back-end so first install it,


sudo apt-get install mpg123


I've attached pmrp here so download it first.

Download PMRP (http://vsido.org/index.php?action=dlattach;topic=1052.0;attach=406)

And save it somewhere in your $PATH with the name 'pmrp' and 'chmod 755' it.
That's it! Open terminal, run 'pmrp', and enjoy from over 250 radio stations.
As usual view-review-comments are welcome.
Cheers!!!

Title: Re: PMRP - Poor Man's Radio Player
Post by: Snap on August 06, 2015, 08:15:00 PM
IIRC, mpg123 is amongst the Vsido defaults.

Cool, hackerdefo! Downloading and checking
Title: Re: PMRP - Poor Man's Radio Player
Post by: VastOne on August 07, 2015, 12:07:28 AM
Fantastic work... This is brilliant

I appreciate the ambient inclusions.. It is a genre I listen to quite a bit, keeps me calm as I dev..

Listening to and recording PMRP - Electronic - Chill One in one tab and recording with the How To : Record effortlessly from terminal in VSIDO/Linux (http://vsido.org/index.php?topic=773.msg8674#msg8674) in another tab while building the next ISO's in VirtualBox

Ya gotta fucking love VSIDO!
Title: Re: PMRP - Poor Man's Radio Player
Post by: jedi on August 07, 2015, 02:56:58 AM
W  O  W!!!

color me blown-away!  Listening to 'Air Lounge'...
outstanding little radio player hakerdefoe!  very nice work!   8)
Title: Re: PMRP - Poor Man's Radio Player
Post by: PackRat on August 08, 2015, 12:14:45 AM
Awesome piece of work. Excellent mix of music.

Need to add:

sakura -e pmrp

to the VSIDO fluxbox menu.
Title: Re: PMRP - Poor Man's Radio Player
Post by: hakerdefo on August 08, 2015, 06:40:51 PM
Quote from: VastOne on August 07, 2015, 12:07:28 AM
Fantastic work... This is brilliant

I appreciate the ambient inclusions.. It is a genre I listen to quite a bit, keeps me calm as I dev..

Listening to and recording PMRP - Electronic - Chill One in one tab and recording with the How To : Record effortlessly from terminal in VSIDO/Linux (http://vsido.org/index.php?topic=773.msg8674#msg8674) in another tab while building the next ISO's in VirtualBox

Ya gotta fucking love VSIDO!
Yeah Ya fuc**ng Gotta  8)
By the way VastOne, 'Station  Categories' -> '14 Rock' -> '14 pinkfloydteguz' was added keeping in mind a certain Mr. Terry Ganus.
Cheers!!!
Title: Re: PMRP - Poor Man's Radio Player
Post by: hakerdefo on August 08, 2015, 06:43:58 PM
@jedi @PackRat Thanks for encouraging words!
Cheers!!!
Title: Re: PMRP - Poor Man's Radio Player
Post by: seppalta on August 12, 2015, 06:37:51 AM
A very nice script-application!  I took the liberty of upgrading the classical music (my music passion) category and adding a small folk music category.  You can get the result with wget http://lxlinux.com/pmrp .
Title: Re: PMRP - Poor Man's Radio Player
Post by: Snap on August 12, 2015, 07:40:39 AM
Nice addition. Thanks.

EDIT: BTW, are you the man behind the http://lxlinux.com/ site? Great job!. It made my day a few times when tweaking OB. One of my main bookmarked references for Openbox.
Title: Re: PMRP - Poor Man's Radio Player
Post by: seppalta on August 12, 2015, 06:21:11 PM
"are you the man behind the http://lxlinux.com/ site?"  Yes, and happy to hear that you use it.   It is my Linux Toolbox, or Memory Bank - saves a lot of searching!  Just add new things as they cross my path and try to keep the rest up-to-date.  Will put up a section on pmrp, a really well put-together app, and lightweight, too, soon. 

Oh!  I corrected (today Wed, Aug. 12) in the lxlinux version a typo (by me) at the end of the classics section: "13) clear Muzic ;;" should be "33) clear Muzic ;;".    Cheers.
Title: Re: PMRP - Poor Man's Radio Player
Post by: Snap on August 13, 2015, 05:18:56 AM
Quotesaves a lot of searching!

Ideed!

Thanks for the correction.
Title: Re: PMRP - Poor Man's Radio Player
Post by: PackRat on August 16, 2015, 10:09:02 PM
Quote from: seppalta on August 12, 2015, 06:37:51 AM
....... and adding a small folk music category.

Irish pub folk songs - now that is classical music -  8)
Title: Re: PMRP - Poor Man's Radio Player
Post by: seppalta on August 19, 2015, 06:09:30 AM
I made another small change in the pmrp script to accommodate those who might want quick availability of the station link, for example, to rip what is playing.  By replacing the following line in each station section, echo -e "$BLUE PMRP $NC -> $BLUE Classical $NC -> $BLUE $Name01 $NC:", with  echo -e "$BLUE PMRP $NC -> $BLUE Classical $NC -> $BLUE $Name01 $NC -> $BLUE $link01 $NC:".   This will then display the link on the main page.  I only made the change for classical stations, since I rarely use the others.
Title: Re: PMRP - Poor Man's Radio Player
Post by: Digit on February 07, 2016, 06:12:27 PM
gave this a whirl.  unuseable on my bandwidth.  is there a way to get it to only use the low bandwidth streams?

*gone back to my own even-more-poor man's radio player for now.*
Title: Re: PMRP - Poor Man's Radio Player
Post by: misko_2083 on October 02, 2016, 01:16:25 PM
Excelent script hakerdeko.

I'm going to play with yad and this.

#!/bin/bash

mpg123 --remote --fifo /tmp/pipem --utf8 --title --preload 1 --buffer 768 --smooth &
PID="$!"

if [ ! -e "/tmp/pipem" ]; then
  mkfifo /tmp/pipem
fi
sleep 1

function load () {
  echo "load http://relay.181.fm:8134" > /tmp/pipem
}
export -f load

function pause () {
  echo "pause" > /tmp/pipem
}
export -f pause

function stop () {
  echo "stop" > /tmp/pipem
}
export -f stop

yad --form --button "exit!gtk-no:1" \
    --field "load:btn" 'bash -c load' \
    --field "pause:btn" 'bash -c pause' \
    --field "stop:btn" 'bash -c stop'

if [[ $? == 1 || $? == 252 ]]; then
  echo stop > /tmp/pipem
  kill $PID
  rm /tmp/pipem
fi


Categories could go into notebook tabs. I doubt it would all fit. There are tons of stations and categories in PMRP. :)
As for displaying what's playing, separate --text-info window is the only way.
Title: Re: PMRP - Poor Man's Radio Player
Post by: hakerdefo on October 02, 2016, 06:45:27 PM
Hi there misco_2083,
I envy your YAD skills  8)
yt-get is the best GUI tool out there to download from YouTube. Using jq and json data in yt-get is ingenious 8)
Coming to PMRP, if anyone can dress it in GUI, it's you my friend 8)
Can't wait to see PMRP-YAD :)
Cheers!!!
Title: Re: PMRP - Poor Man's Radio Player
Post by: misko_2083 on November 08, 2016, 06:10:04 PM
Quote from: hakerdefo on October 02, 2016, 06:45:27 PM
Hi there misko_2083,
I envy your YAD skills  8)
yt-get is the best GUI tool out there to download from YouTube. Using jq and json data in yt-get is ingenious 8)
Coming to PMRP, if anyone can dress it in GUI, it's you my friend 8)
Can't wait to see PMRP-YAD :)
Cheers!!!
Hi hakerdefo.
I'm afraid there is nothing to envy  on, I can't make it work like I imagined with mpg123.  :(
Trying with VLC MPRIS player interface. That way I can control the VLC with dbus.
This script  will launch the vlc command line interface.
#!/bin/bash
i=o
cvlc -I rc  -vvv http://relay.181.fm:8042 2>&1 >/dev/null | grep --line-buffered "New Icy-Title=" \
| stdbuf -oL -eL sed -e 's/;.*//' -e 's/.*=//' -e "s/'//g" \
| while read -r line; do
     i=$(($i+1))
     echo $i $line
  done

and this would control the vlc (from the second terminal)
#!/bin/sh
# Use
# control-player.sh vlc [pause|rpause|prev|next|stop]
name="$1"
shift
PATHS="org.mpris.MediaPlayer2.$name /org/mpris/MediaPlayer2"
DBUS_SEND="dbus-send --type=method_call --dest=$PATHS"
RC="$DBUS_SEND org.mpris.MediaPlayer2.Player"

if [ "$@" = "prev" ]; then
    $RC.Previous   #previous radio station
elif [ "$@" = "rpause" ]; then
    $RC.Pause
elif [ "$@" = "stop" ]; then
    $RC.Stop
elif [ "$@" = "pause" ]; then
    $RC.PlayPause
elif [ "$@" = "next" ]; then
    $RC.Next        # next radio station
else
    echo "Command not found for player $name: $@" 1>&2
    exit 1
fi

Right now, I'm exploring what can I do with dbus-send

#get Metadata
#  dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'

#Open Url
# dbus-send --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri string:"http://relay.181.fm:8068"

#Get Volume
dbus-send --print-reply  --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Volume'

#Set Volume (min 0.0 to max 1.0)
# dbus-send  --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:'org.mpris.MediaPlayer2.Player' string:'Volume' variant:double:0.0
# dbus-send  --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:'org.mpris.MediaPlayer2.Player' string:'Volume' variant:double:1.0

It would be cool if I could catch the signal when Metadata changes. ;)
qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2method QString org.freedesktop.DBus.Introspectable.Introspect()
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString, QString)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString)
signal void org.freedesktop.DBus.Properties.PropertiesChanged(QString, QVariantMap, QStringList)
method void org.freedesktop.DBus.Properties.Set(QString, QString, QDBusVariant)
property read bool org.mpris.MediaPlayer2.CanQuit
property read bool org.mpris.MediaPlayer2.CanRaise
property read bool org.mpris.MediaPlayer2.CanSetFullscreen
property read QString org.mpris.MediaPlayer2.DesktopEntry
property readwrite bool org.mpris.MediaPlayer2.Fullscreen
property read bool org.mpris.MediaPlayer2.HasTrackList
property read QString org.mpris.MediaPlayer2.Identity
property read QStringList org.mpris.MediaPlayer2.SupportedMimeTypes
property read QStringList org.mpris.MediaPlayer2.SupportedUriSchemes
method void org.mpris.MediaPlayer2.Quit()
method void org.mpris.MediaPlayer2.Raise()
property read bool org.mpris.MediaPlayer2.Player.CanControl
property read bool org.mpris.MediaPlayer2.Player.CanPause
property read bool org.mpris.MediaPlayer2.Player.CanPlay
property read bool org.mpris.MediaPlayer2.Player.CanSeek
property readwrite QString org.mpris.MediaPlayer2.Player.LoopStatus
property readwrite double org.mpris.MediaPlayer2.Player.MaximumRate
property read QVariantMap org.mpris.MediaPlayer2.Player.Metadata
property readwrite double org.mpris.MediaPlayer2.Player.MinimumRate
property read QString org.mpris.MediaPlayer2.Player.PlaybackStatus
property read int org.mpris.MediaPlayer2.Player.Position
property readwrite double org.mpris.MediaPlayer2.Player.Rate
property readwrite double org.mpris.MediaPlayer2.Player.Shuffle
property readwrite double org.mpris.MediaPlayer2.Player.Volume
method void org.mpris.MediaPlayer2.Player.Next()
method void org.mpris.MediaPlayer2.Player.OpenUri(QString)
method void org.mpris.MediaPlayer2.Player.Pause()
method void org.mpris.MediaPlayer2.Player.Play()
method void org.mpris.MediaPlayer2.Player.PlayPause()
method void org.mpris.MediaPlayer2.Player.Previous()
method void org.mpris.MediaPlayer2.Player.Seek(qlonglong)
method void org.mpris.MediaPlayer2.Player.SetPosition(QDBusObjectPath, qlonglong)
method void org.mpris.MediaPlayer2.Player.Stop()
property read bool org.mpris.MediaPlayer2.TrackList.CanEditTracks
property read QList<QDBusObjectPath> org.mpris.MediaPlayer2.TrackList.Tracks
method void org.mpris.MediaPlayer2.TrackList.AddTrack(QString, QDBusObjectPath, bool)
method QDBusRawType::aa{sv} org.mpris.MediaPlayer2.TrackList.GetTracksMetadata(QList<QDBusObjectPath>)
method void org.mpris.MediaPlayer2.TrackList.GoTo(QDBusObjectPath)
method void org.mpris.MediaPlayer2.TrackList.RemoveTrack(QDBusObjectPath)
signal void org.mpris.MediaPlayer2.TrackList.TrackAdded(QVariantMap, QDBusObjectPath)
signal void org.mpris.MediaPlayer2.TrackList.TrackListReplaced(QList<QDBusObjectPath>, QDBusObjectPath)
signal void org.mpris.MediaPlayer2.TrackList.TrackMetadataChanged(QDBusObjectPath, QVariantMap)
signal void org.mpris.MediaPlayer2.TrackList.TrackRemoved(QDBusObjectPath)