PMRP - Poor Man's Radio Player

hakerdefo

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!!!
You Can't Always Git What You Want

misko_2083

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)