Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - misko_2083

#1
Jedi do you sense the disturbance in the force?   ;)
Don't worry it's me.

Can you try this clock, actually two clocks, I made this summer.
They are very similar one is with Gtk3 the other Xlib.
https://github.com/Misko-2083/sclock
They have command line options like yad.
#2
Played a little. In the back is my hometown eary in the morning.

The original photo used here for the front. Made it in  the countryside.
#3
Zenity & Yad / Re: PMRP UI yad
May 08, 2017, 12:52:25 AM
Quote from: filip on May 07, 2017, 08:36:44 PM
Between the couch cushions perhaps!?  ;D :D :D
Joke aside, I did take a quick look @docs/google, but didn't find anything. The "bad" here is that MPV has support for real remote controlers ( the hardware ones ), which is the main hit on Google, making the shell "remote" we need here hard to find... And the docs are longer then the Bible...  ;D
Whish it was between the couch cushions... That was a a big documentation to read.  :D
Found some usefull options on the way...
Mpv loads entire list file at once, and I had to do "playlist_remove current" to load a new list.
After sorting that out, the rest weas relatively easy.
Instead of saving the current song metadata, we call it with the internal print command 'print_text ${metadata}'.
That way it fills in the text column after returning from tray.
*Changes
1. Now uses mpv
2. Close to tray option added
*What doesn't work?
1. error status
2. category is lost when returning from tray
#!/bin/bash
command -v mpv >/dev/null 2>&1 || (yad --text="PMRP requires 'mpv' but it's not installed!\nInstall 'mpv' to enjoy PMRP."; exit 1)

TEXTDOMAIN=ydesk
TEXTDOMAINDIR=/usr/share/locale

export LANG=C.UTF-8

export pmrp='@bash -c "run_stations %2"'
export pmrp_stations="stations"

export fpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
export ppipe=$(mktemp -u --tmpdir ppmrp.XXXXXXXX)
export cpipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export statuspipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export PMRPLIST=$(mktemp -u --tmpdir PMRPLIST.XXXXXXXX)

# Pipe for setting values in the form tab
mkfifo "$fpipe"
# control pipe - send commands to mpv
mkfifo "$cpipe"
# status pipe - send text to left text pane
mkfifo "$statuspipe"

# Create the list file
> $PMRPLIST

trap "rm -f $fpipe $ppipe $cpipe $statuspipe $PMRPLIST" EXIT

pmkey=$(($RANDOM * $$))

# Categories are separated with "!" (without quotes)
# The last item in category is without trailing "!"
Categories="181.FM!
Blues!
Bollywood!
Classical!
Country!
Electronic!
Hits!
Jazz!
Medley!
Metal!
News_&_Views!
Oldies!
Reggae!
Rock!
Serbia!
SomaFM!
Urban"


function stations
{
   echo "Category: $1" >> "$ppipe"
   < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
   | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
}
export -f stations

function run_stations
{
    echo "3:@disabled@"
    echo -e '\f' >> "$fpipe"

    case "$1" in
181.FM)
          stations "$1"
    ;;
Blues)
          stations "$1"
    ;;
Bollywood)
          stations "$1"
    ;;
Classical)
          stations "$1"
    ;;
Country)
          stations "$1"
    ;;
Electronic)
          stations "$1"
    ;;
Hits)
          stations "$1"
    ;;
Jazz)
          stations "$1"
    ;;
Medley)
          stations "$1"
    ;;
Metal)
          stations "$1"
    ;;
"News_&_Views")
          stations "$1"
    ;;
Oldies)
          stations "$1"
    ;;
Reggae)
          stations "$1"
    ;;
Rock)
          stations "$1"
    ;;
Serbia)
          stations "$1"
    ;;
SomaFM)
          stations "$1"
    ;;
Urban)
          stations "$1"
    ;;
         *)
          echo "PMRP: Error! No such Category $1" >> "$ppipe"
            ;;
    esac
    echo "3:$pmrp"
}
export -f run_stations

function load_url
{
    echo "Station: $1   Url: $3" >> $ppipe   
    # Station to the list
    echo "$3" > $PMRPLIST
    # Unload current Playlist
    echo "playlist_remove current" > $cpipe
    # Load list
    echo "loadlist $PMRPLIST" > $cpipe
}
export -f load_url

function status_block
{
if [[ ! -z "$PMRP" ]]; then
   unset PMRP
else
  if [[ "$(echo "$1" | grep -c "^Name*")" = 1 ]]; then
      STATION="$1"
  elif [[ "$(echo "$1" | grep -c "^Title*")" = 1 ]];then
      TITLE="$1"
  elif [[ "$(echo "$1" | grep -c "^Bitrate")" = 1 ]];then
      BITRATE="$1 Kb/s"
  elif [[ "$(echo "$1" | grep -c "^PMRP:*")" = 1 ]];then
      PMRP="$1"
  fi
 
  if [[ -z "$PMRP" ]]; then
    echo "$STATION\n$BITRATE\n$TITLE" >> "$statuspipe"
  else
    echo "\n$PMRP\n" >> "$statuspipe"
  fi

   echo "$(for category in $Categories; do printf "%s" "$category"; done)" >> "$statuspipe"
   echo "$pmrp" >> "$statuspipe"
fi
}

exec 3<> $fpipe
exec 4<> $ppipe
exec 5<> $cpipe
exec 6<> $statuspipe

echo "PMRP: Ready to Play" >> "$ppipe"

killall mpv 2>/dev/null

  mpv --playlist=$PMRPLIST --input-file=$cpipe --cache 2048 --no-config --idle=yes 2>&1 \
     | awk '/[statusline]/{if ($0 ~ "icy-br:*") {gsub(/^.*icy-br:/,"");print "Bitrate  ", $0 ;}
                                 else {if ($0 ~ "icy-name:*") {gsub(/^.*icy-name:/,"");print "Name    ", $0;}
                                 else {if ($0 ~ "icy-genre:*") {gsub(/^.*icy-genre:/,"");print "Genre -", $0;}
                                 else {if ($0 ~ "icy-title:*") {gsub(/^.*icy-title:/,"");print "Title        ", $0;}}}}}
                                 {fflush(stdout)}'  | while read -r line; do status_block "$line"; echo "$line" >>"$ppipe"; done &
function main() {
  yad --plug="$pmkey" --tabnum=1 --form --cycle-read --field "":TXT --field "Category":CB  \
     --image-ontop --field="Load Stations!gtk-add:fbtn" <&6  &

  yad --plug="$pmkey" --tabnum=2 --list --no-markup --dclick-action='bash -c "load_url %s"' \
    --text "Double click to play" --text-align=center --column="Name" --column="Category" --column="Url" \
    --search-column=1 --expand-column=1 --print-column="3" <&3 &

  # Uncoment next line if you want to start with log
  # tail -f "$ppipe" | yad --text-info --title="PMRP-Log" --tail --window-icon=radio --width=600 --height=500 --button="gtk-close" &

  # loads fields on startup
  status_block "PMRP:   Poor Man's Radio Player"

  # Reprints metadata after returning from tray
  echo 'print_text ${metadata}' > $cpipe

  yad --paned --key="$pmkey" --button="Close to Tray!gtk-close":1 \
      --button="Show Log":'bash -c "tail -f -n +1 $ppipe | yad --text-info --tail --title=PMRP-Log --window-icon=radio --width=600 --height=500 --button=gtk-close" &' \
      --button="Pause/Continue":'bash -c "echo cycle pause >> $cpipe"' \
      --button="Stop":'bash -c "echo stop >> $cpipe"'  --text="Select a Category and click to Load Stations" --width=700 --height=500 \
      --title=$"PMRP" --splitter=300 --window-icon="radio" --orient=hor --image=radio --image-on-top --posx=10 --posy=100
RET="$?"

case $RET in
  252)
    echo "quit" >> $cpipe
    echo "PMRP: Preparing for radio silence" >> "$ppipe"
    echo "PMRP: Zzzzzzz" >> "$ppipe"
    ;;
   1)  yad --notification   \
          --image="radio"  \
          --text="PMRP"
        # Need to do this after returned from tray
        status_block ""
main
    ;;
   *) exit 1
    ;;
esac
}
main

exec 3>&-
exec 4>&-
exec 5>&-
exec 6>&-


@hakerdefo thanks. ;)
#4
Zenity & Yad / Re: youtube-dl wrapper
May 07, 2017, 11:28:30 AM
Quote from: a on May 06, 2017, 10:21:45 AM
hey Misko why not post your colour chooser yad script here?
the one you posted on bunsen labs, I am using it and it works great.  :)
Will do. Once I find it. :))
Quote from: PackRat on May 06, 2017, 01:37:03 PM
Nice one, working as advertised.
One suggestion though. For this and future yad scripts add the "--class" flag. That will give your scripts a unique identifier so that per app settings can be applied in fluxbox, openbox, and any other window manager that supports it.
The default is for the name to be "yad" and the class to be "Yad", so any per app settings apply to all scripts.
Great to see it works. :)
That's interesting. Will add --class to scripts in the future.
yad --class "Youtube..."
Quote from: hakerdefo on May 06, 2017, 07:12:19 PM
Cheers Misko  8)
Cheers hakerdefo  8)
#5
Zenity & Yad / Re: PMRP UI yad
May 07, 2017, 11:10:31 AM
Quote from: filip on May 05, 2017, 11:44:50 PM
@Misko

Nice work!  :) :)

Couple of notes/ideas:

1. I don't know for sure whether "mpv" has a remote control, however if it does it might be much better then "mpg123" ( atleast there woudn't be a "Quit lag" )
2. "Close to tray" would be awesome, though AFAIK it's not (yet) possible with YAD??  ???
@Filip
Thanks.  :)
mpv - That's a great idea! mpv has a remote (somewhere :)) ), I will dig into documentation.
Close to tray - It's easy to close it, bringing it back is another story  :D  :D  :D
                          Will see about that. It's a good option to have a radio that stays out of the way.
Quote from: hakerdefo on May 06, 2017, 07:17:04 PM
Great job Misko  8)
No one scripts better in YAD than you  8)
^

Quote from: hakerdefo on May 06, 2017, 07:17:04 PM
One of these days I'll port all the PMRP stations to the format supported by PMRP-UI. Promise  :)
Cheers!!!

Thank you, that would be awesome.
#6
Zenity & Yad / Re: PMRP UI yad
May 05, 2017, 11:08:30 PM
Thanks Zephyr.  ;)
Changed the looks. It's still slow when the station is geo-blocked or unavailable (404).

#!/bin/bash
command -v mpg123 >/dev/null 2>&1 || (yad --text="PMRP requires 'mpg123' but it's not installed!\nInstall 'mpg123' to enjoy PMRP."; exit 1)

TEXTDOMAIN=ydesk
TEXTDOMAINDIR=/usr/share/locale

export pmrp='@bash -c "run_stations %2"'
export pmrp_stations="stations"

export fpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
export ppipe=$(mktemp -u --tmpdir ppmrp.XXXXXXXX)
export cpipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export statuspipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export PMRPID=$(mktemp -u --tmpdir PMRPID.XXXXXXXX)

mkfifo "$fpipe"
mkfifo "$cpipe"
mkfifo "$statuspipe"

trap "rm -f $fpipe $ppipe $cpipe $statuspipe $PMRPID" EXIT

pmkey=$(($RANDOM * $$))

# Categories are separated with "!" (without quotes)
# The last item in category is without trailing "!"
Categories="181.FM!
Blues!
Bollywood!
Classical!
Country!
Electronic!
Hits!
Jazz!
Medley!
Metal!
News_&_Views!
Oldies!
Reggae!
Rock!
Serbia!
SomaFM!
Urban"


function stations
{
   echo "Category: $1" >> "$ppipe"
   < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
   | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
}
export -f stations

function run_stations
{
    echo "3:@disabled@"
    echo -e '\f' >> "$fpipe"

    case "$1" in
181.FM)
          stations "$1"
    ;;
Blues)
          stations "$1"
    ;;
Bollywood)
          stations "$1"
    ;;
Classical)
          stations "$1"
    ;;
Country)
          stations "$1"
    ;;
Electronic)
          stations "$1"
    ;;
Hits)
          stations "$1"
    ;;
Jazz)
          stations "$1"
    ;;
Medley)
          stations "$1"
    ;;
Metal)
          stations "$1"
    ;;
"News_&_Views")
          stations "$1"
    ;;
Oldies)
          stations "$1"
    ;;
Reggae)
          stations "$1"
    ;;
Rock)
          stations "$1"
    ;;
Serbia)
          stations "$1"
    ;;
SomaFM)
          stations "$1"
    ;;
Urban)
          stations "$1"
    ;;
         *)
          echo "PMRP: Error! No such Category $1" >> "$ppipe"
            ;;
    esac
    echo "3:$pmrp"
}
export -f run_stations

function load_url
{
    echo "Station: $1   Url: $3" >> $ppipe
    echo "LOAD $3" >> $cpipe
    curl -Is "$3" | awk -F':' '/icy-br/{print "Bitrate:" $2}' >>$ppipe
}
export -f load_url

function status_block
{
if [[ ! -z "$ERROR" ]]; then
   unset ERROR
else
  if [[ "$(echo "$1" | grep -c "^Station:*")" = 1 ]]; then
      STATION="$1"
  elif [[ "$(echo "$1" | grep -c "^Title:*")" = 1 ]];then
      TITLE="$1"
  elif [[ "$(echo "$1" | grep -c "^PMRP:*")" = 1 ]];then
      if [[ "$(echo "$1" | grep -c "^PMRP:   Error opening stream:*")" = 1 ]];then
         ERROR="$1"
      else
         STATUS="$1"
      fi
  fi
 
  if [[ -z "$ERROR" ]]; then
    echo "$STATION\n$STATUS\n$TITLE" >> "$statuspipe"
  else
    echo "\n$ERROR\n" >> "$statuspipe"
  fi

   echo "$(for category in $Categories; do printf "%s" "$category"; done)" >> "$statuspipe"
   echo "$pmrp" >> "$statuspipe"
fi
}

exec 3<> $fpipe
exec 4<> $ppipe
exec 5<> $cpipe
exec 6<> $statuspipe

killall mpg123 2>/dev/null
# Don't use buffer here because of geo-locked stations
PLAYER="mpg123 --remote --fifo $cpipe --title --preload 1 --no-resync"
$PLAYER 2>&1 /dev/null | awk '/@E/ || /@P/ || /@I/{if ($0=="@P 0") {print "PMRP: stop";}
                                                else {if ($0=="@P 1") {print "PMRP: paused";}
                                                else {if ($0=="@P 2") {print "PMRP: playing";}
                                                else {if ($0 ~ "@E.*") {print "PMRP:",$1="",$0;}
                                                else {if ($0 ~ "StreamTitle=*") {gsub(/^.*StreamTitle=/,"");gsub(/'\''/,"");gsub(/\;/,"");print "Title:", $0;}
                                                else {if ($0 ~ "ICY-NAME:*"){gsub(/^@I ICY-NAME:/,"");print "Station:", $0}}}}}}}
                                                {fflush(stdout)}'  | while read -r line; do status_block "$line"; echo "$line" >>"$ppipe"; done &  echo $! > "$PMRPID"

yad --plug="$pmkey" --tabnum=1 --form --cycle-read --field "":TXT --field "Category":CB  \
     --image-ontop --field="Load Stations!gtk-add:fbtn" <&6  &

yad --plug="$pmkey" --tabnum=2 --list --no-markup --dclick-action='bash -c "load_url %s"' \
    --text "Double click to play" --text-align=center --column="Name" --column="Category" --column="Url" \
    --search-column=1 --expand-column=1 --print-column="3" <&3 &

# Uncoment next line if you want to start with log
# tail -f "$ppipe" | yad --text-info --title="PMRP-Log" --tail --window-icon=radio --width=600 --height=500 --button="gtk-close" &

echo "PMRP: Ready to Play" >> "$ppipe"

# loads fields on startup
status_block "PMRP:   Poor Man's Radio Player"

yad --paned --key="$pmkey" --button="Show Log":'bash -c "tail -f -n +1 $ppipe | yad --text-info --tail --title=PMRP-Log --window-icon=radio --width=600 --height=500 --button=gtk-close" &' \
    --button="Pause/Continue":'bash -c "echo pause >> $cpipe"' \
    --button="Stop":'bash -c "echo stop >> $cpipe"'  --text="Select a Category and click to Load Stations" --width=700 --height=500 \
    --title=$"PMRP" --splitter=300 --window-icon="radio" --orient=hor --image=radio --image-on-top --posx=10 --posy=100

[[ $? == 252 ]] && echo quit >> $cpipe
echo "PMRP: Preparing for radio silence" >> "$ppipe"
# Takes a lot to quit, patience
sleep 10
# Well, sometimes it fails to quit, kill
kill $(<$PMRPID) 2>/dev/null
echo "PMRP: Zzzzzzz" >> "$ppipe"

exec 3>&-
exec 4>&-
exec 5>&-
exec 6>&-
#7
Conky / Re: conky and yad - some possibilities
May 05, 2017, 11:03:12 PM
I know very little about conky.
If you can make conky write to stdout and format the output to correct format it would work.
yad notification icon can read from standard input but only possible
    commands are icon, tooltip, visible, action, menu and quit.

NOTIFICATION
       Allows commands to be sent to yad in the form  command:args.   Possible
       commands are icon, tooltip, visible, action, menu and quit.

       icon:ICONNAME
              Set notification icon to ICONNAME.

       tooltip:STRING
              Set notification tooltip.

       visible:[true|false|blink]
              Set notification icon to visible, invisible or blinking states.

       action:COMMAND
              Specify  the  command  running  when click on the icon.  Special
              string "quit" exit the program.

       menu:STRING
              Set popup menu for notification icon.  STRING must  be  in  form
              name1[!action1[!icon1]]|name2[!action2[!icon2]]....   Empty name
              add separator to menu.  Separator  character  for  values  (e.g.
              `|')  sets  with  --separator argument.  Separator character for
              menu items (e.g. `!') sets with --item-separator argument.

       quit   Exit the program. Middle click on icon also send quit command.

Open a terminal window and enter
yad --notification --image="gtk-help" --listen
then enter and type in
tooltip:Hello\nPackrat
mouse over the icon and you will see a tooltip.
To quit type in
quit
This example shows how to use it in a script.
I don't think it can be done without some scripting.
#8
Zenity & Yad / Re: PMRP UI yad
May 01, 2017, 09:38:48 PM
The code is ready. I just need to enter the stations.

New script here:
#!/bin/bash
command -v mpg123 >/dev/null 2>&1 || (yad --text="PMRP requires 'mpg123' but it's not installed!\nInstall 'mpg123' to enjoy PMRP."; exit 1)

TEXTDOMAIN=ydesk
TEXTDOMAINDIR=/usr/share/locale

export pmrp='@bash -c "run_stations %2"'
export pmrp_stations="/home/misko/Desktop/pmrpui/stations"

export fpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
export ppipe=$(mktemp -u --tmpdir ppmrp.XXXXXXXX)
export cpipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export statuspipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)
export PMRPID=$(mktemp -u --tmpdir PMRPID.XXXXXXXX)

mkfifo "$fpipe"
mkfifo "$cpipe"
mkfifo "$statuspipe"

trap "rm -f $fpipe $ppipe $cpipe $statuspipe $PMRPID" EXIT

pmkey=$(($RANDOM * $$))

# Categories are separated with "!" (without quotes)
# The last item in category is without trailing "!"
Categories="181.FM!
Blues!
Bollywood!
Classical!
Country!
Electronic!
Hits!
Jazz!
Medley!
Metal!
News_&_Views!
Oldies!
Reggae!
Rock!
SomaFM!
Urban"


function run_stations
{
    echo "3:@disabled@"
    echo -e '\f' >> "$fpipe"

    case "$1" in
181.FM)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Blues)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Bollywood)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Classical)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Country)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Electronic)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Hits)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Jazz)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Medley)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Metal)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
"News_&_Views")
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Oldies)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Reggae)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Rock)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
SomaFM)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Urban)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
         *)
          echo "PMRP: Error! No such Category $1" >> "$ppipe"
            ;;
    esac
    echo "3:$pmrp"
}
export -f run_stations

function load_url
{
    #status_block "Station: $1  Genre: $2 url: $3"
    echo "Station: $1   Url: $3" >> $ppipe
    echo "load $3" > $cpipe
}
export -f load_url

function status_block
{
if [[ ! -z "$ERROR" ]]; then
   unset ERROR
else
  if [[ "$(echo "$1" | grep -c "^Station:*")" = 1 ]]; then
      STATION="$1"
  elif [[ "$(echo "$1" | grep -c "^Title:*")" = 1 ]];then
      TITLE="$1"
  elif [[ "$(echo "$1" | grep -c "^PMRP:*")" = 1 ]];then
      if [[ "$(echo "$1" | grep -c "^PMRP:   Error opening stream:*")" = 1 ]];then
         ERROR="$1"
      else
         STATUS="$1"
      fi
  fi

  if [[ -z "$ERROR" ]]; then
    echo "$STATION\n$STATUS\n$TITLE" >> "$statuspipe"
    echo "$(for category in $Categories; do printf "%s" "$category"; done)" >> "$statuspipe"
    echo "$pmrp" >> "$statuspipe"
  else
    echo "\n$ERROR\n" >> "$statuspipe"
    echo "$(for category in $Categories; do printf "%s" "$category"; done)" >> "$statuspipe"
    echo "$pmrp" >> "$statuspipe"
  fi
fi
}
export -f status_block

exec 3<> $fpipe
exec 4<> $ppipe
exec 5<> $cpipe
exec 6<> $statuspipe

killall mpg123 2>/dev/null
PLAYER="mpg123 --remote --fifo $cpipe --utf8 --title --preload 1 --buffer 768 --smooth"
$PLAYER 2>&1 /dev/null | awk '/@E/ || /@P/ || /@I/{if ($0=="@P 0") {print "PMRP: stop";}
                                                else {if ($0=="@P 1") {print "PMRP: paused";}
                                                else {if ($0=="@P 2") {print "PMRP: playing";}
                                                else {if ($0 ~ "@E.*") {print "PMRP:",$1="",$0;}
                                                else {if ($0 ~ "StreamTitle=*") {gsub(/^.*StreamTitle=/,"");gsub(/'\''/,"");gsub(/\;/,"");print "Title:", $0;}
                                                else {if ($0 ~ "ICY-NAME:*"){gsub(/^@I ICY-NAME:/,"");print "Station:", $0}}}}}}}
                                                {fflush(stdout)}'  | tee >(while read -r line; do status_block "$line"; done) >>"$ppipe" &  echo $! > "$PMRPID"

yad --plug="$pmkey" --tabnum=1 --form --cycle-read --field "Status":CB --field "Category":CB  \
    --image=radio --image-ontop --field="Load Stations!gtk-add:fbtn" <&6  &

yad --plug="$pmkey" --tabnum=2 --list --no-markup --dclick-action='bash -c "load_url %s"' \
    --text "Double click to play" --text-align=center --column="Name" --column="Category" --column="Url" \
    --search-column=1 --expand-column=1 --print-column="3" <&3 &

# Uncoment next line if you want to start with log
# tail -f "$ppipe" | yad --text-info --title="PMRP-Log" --tail --window-icon=radio --width=600 --height=500 --button="gtk-close" &

echo "PMRP: Ready to Play" >> "$ppipe"

# loads fields on startup
status_block "PMRP:   Poor Man's Radio Player"

yad --paned --key="$pmkey" --button="Show Log":'bash -c "tail -f -n +1 $ppipe | yad --text-info --tail --title=PMRP-Log --window-icon=radio --width=600 --height=500 --button=gtk-close" &' \
    --button="Pause/Continue":'bash -c "echo pause >> $cpipe"' \
    --button="Stop":'bash -c "echo stop >> $cpipe"'  --text="Select a Category and click to Load Stations" --width=700 --height=500 \
    --title=$"PMRP" --window-icon="radio" --posx=10 --posy=100

[[ $? == 252 ]] && echo quit >> $cpipe
echo "PMRP: Preparing for radio silence" >> "$ppipe"
# Takes a lot to quit, patience
sleep 10
# Well, sometimes it fails to quit, kill
kill $(<$PMRPID) 2>/dev/null
echo "PMRP: Zzzzzzz" >> "$ppipe"

exec 3>&-
exec 4>&-
exec 5>&-
exec 6>&-

What do you think?   :)
#9
Zenity & Yad / Re: PMRP UI yad
April 27, 2017, 07:17:58 PM
Thank you zephyr, I'm really glad you like it.
Lookin good on your desktop.  ;)
I'm thinking of changing a few things. Not sure what is the best approach.
I could redirect the data to the upper tab to dispay the info about the curent status of the player, like the title, playing status and errors.
Then, there won't be need for two windows. The log window will be available to open but I think from a file. That way, when it's closed, it will not lose the data.
Will see what can I do and what is the best way.

I want to thank Hakerdefo for creating pmrp (poor man's radio player).
Cheers
#10
Zenity & Yad / PMRP UI yad
April 27, 2017, 03:49:54 AM
Played a little with this, there are just a few stations, but it looks ok to me.
I have compiled the latest yad and mpg123, so I'm not sure how it works with older versions.

It's a little slow on exit but that's how the remote control works with mpg123. There is a 10 seconds sleep on quit, then if mpg123 doesn't want to quit, we call the "killall".
How to setup? First you need a stations file. I think it's better to keep the stations out of the script. It's easier to maintain them this way.
There are just a few stations in there for now.
Honestly, I lost the willpower after seeing how many stations are there in the original pmrp script  :D
stations file:
## Stations
# Tag: "Name" "Category" "URL"

## 181.FM

181.FM: "Chilled Out" "Techno" "http://relay.181.fm:8700"
181.FM: "Energy 93" "Techno" "http://relay.181.fm:8044"
181.FM: "Energy 98" "Techno" "http://relay.181.fm:8800"
181.FM: "Studio 181" "Techno" "http://relay.181.fm:8072"
181.FM: "Techno Club" "Techno" "http://icyrelay.181.fm/181-technoclub_128k.mp3"
181.FM: "The Vibe of Vegas" "Techno" "http://relay.181.fm:8074"
181.FM: "Jammin 181" "Urban" "http://relay.181.fm:8042"
181.FM: "Old School HipHop" "Urban" "http://relay.181.fm:8068"
181.FM: "The Beat" "Urban" "http://relay.181.fm:8054"
181.FM: "The Box" "Urban" "http://relay.181.fm:8024"
181.FM: "True R&B" "Urban" "http://relay.181.fm:8022"

# Needs at least one empty new line at the end of the list
# to avoid yad list issue

OK, now the script (remember to change the path to stations file in this line => export pmrp_stations="/home/misko/Desktop/pmrpui/stations")
#!/bin/bash
command -v mpg123 >/dev/null 2>&1 || (yad --text="PMRP requires 'mpg123' but it's not installed!\nInstall 'mpg123' to enjoy PMRP."; exit 1)

TEXTDOMAIN=ydesk
TEXTDOMAINDIR=/usr/share/locale

export pmrp='@bash -c "run_stations %1"'
export pmrp_stations="/home/misko/Desktop/pmrpui/stations"

export fpipe=$(mktemp -u --tmpdir pmrp.XXXXXXXX)
export ppipe=$(mktemp -u --tmpdir ppmrp.XXXXXXXX)
export cpipe=$(mktemp -u --tmpdir cpmrp.XXXXXXXX)

mkfifo "$fpipe"
mkfifo "$ppipe"
mkfifo "$cpipe"

trap "rm -f $fpipe $ppipe $cpipe" EXIT

pmkey=$(($RANDOM * $$))

# Categories are separated with "!" (without quotes)
# The last item in category is without trailing "!"
Categories="181.FM!
Blues!
Bollywood!
Classical!
Country!
Electronic!
Hits!
Jazz!
Medley!
Metal!
News_&_Views!
Oldies!
Reggae!
Rock!
SomaFM!
Urban"


function run_stations
{
    echo "2:@disable@"
    echo -e '\f' >> "$fpipe"

    ECHO_ONE='echo "Category: $1" >> "$ppipe"'
    ECHO_TWO='echo "-----------------------" >> "$ppipe"'
    case "$1" in
181.FM)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Blues)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Bollywood)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Classical)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Country)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Electronic)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Hits)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Jazz)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Medley)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Metal)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
"News_&_Views")
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Oldies)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Reggae)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Rock)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
SomaFM)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
Urban)
          echo "Category: $1" >> "$ppipe"
          echo "-----------------------" >> "$ppipe"
  < "$pmrp_stations" sed -n -e 's/^.*'"$1: "'//p' \
          | sed -e $'s/\" \"/\\\n/g;s/\"//g' >> "$fpipe"
    ;;
         *)
          echo "PMRP: Error! No such Category $1" >> "$ppipe"
            ;;
    esac
    echo "2:$pmrp"
}
export -f run_stations



function load_url
{
    echo "Station:$1   Url: $3" >> $ppipe
    echo "load $3" > $cpipe
}
export -f load_url

exec 3<> $fpipe
exec 4<> $ppipe
exec 5<> $cpipe

killall mpg123 2>/dev/null
PLAYER="mpg123 --remote --fifo $cpipe --utf8 --title --preload 1 --buffer 768 --smooth"
$PLAYER 2>&1 /dev/null | tee >(awk '/@E/ || /@P/{if ($0=="@P 0") print "PMRP: playing stopped";
                                                else if ($0=="@P 1") print "PMRP: playing paused";
                                                else if ($0=="@P 2") print "PMRP: playing";
                                                else if ($0 ~ "^@E.") print "PMRP:",$1="",$0;
                                                else print $0; fflush(stdout)}'  >> "$ppipe") \
                            >(awk -F'=' '/StreamTitle/{gsub(/'\''/,"",$2);
                            gsub(/\;/,"",$2); print "Title:", $2; fflush(stdout)}' >> "$ppipe") &>/dev/null &

yad --plug="$pmkey" --tabnum=1 --form --field "Category":CB "$(for category in $Categories; do printf "%s" "$category"; done)" \
    --image=radio --image-ontop --field="Load Stations!gtk-add:fbtn" "$pmrp" &

yad --plug="$pmkey" --tabnum=2 --list --no-markup --dclick-action='bash -c "load_url %s"' \
    --text "Double click to play" --text-align=center --column="Name" --column="Category" --column="Url" \
    --search-column=1 --expand-column=1 --print-column="3" <&3 &

yad --text-info --title="PMRP-Log" --window-icon=radio --posx=710 --posy=100 --width=600 --height=500 --button="gtk-close" <&4 &

echo "PMRP: Ready to Play" >> "$ppipe"

yad --paned --key="$pmkey" --button="Show Log":'bash -c "yad --text-info --title=PMRP-Log --window-icon=radio --posx=710 --posy=100 --width=600 --height=500 < $ppipe" &' \
    --button="Pause/Continue":'bash -c "echo pause >> $cpipe"' \
    --button="Stop":'bash -c "echo stop >> $cpipe"'  --text="Select a Category and click to Load Stations" --width=700 --height=500 \
    --title=$"PMRP" --window-icon="radio" --posx=10 --posy=100

[[ $? == 252 ]] && echo quit >> $cpipe
echo "PMRP: Preparing for radio silence" >> "$ppipe"
# Takes a lot to quit, patience
sleep 10
# Well, sometimes it fails to quit, SIGTERM
killall mpg123 2>/dev/null
echo "PMRP: Zzzzzzz" >> "$ppipe"

exec 3>&-
exec 4>&-
exec 5>&-

#11
Scripts / Re: PMRP - Poor Man's Radio Player
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)

#12
Good to hear the theme issue is solved. It all pointed to the theme, but the file permissions never crossed my mind.
Downloading iso now. It  is going slow with FF, like 8+ hours to download.  :'(
Ah wait, with aria2 and 5 connections it takes 10 minutes. Much better :D
aria2c -x 5 http://www.nixnut.com/vsido/VSIDO_x32_21Oct2016.iso
*** Download Progress Summary as of Thu Oct 27 19:02:30 2016 ***             
===============================================================================
[#554950 56MiB/634MiB(8%) CN:5 DL:0.9MiB ETA:9m45s]

I will try to squeeze the install on an old desktop. I'll probably need plop boot to even start.
I'll see how it goes.
#13
Scripts / Re: PMRP - Poor Man's Radio Player
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.
#14
Scripts / Re: Poor Man's Youtube Downloader
August 28, 2016, 06:44:00 PM
Quote from: VastOne on August 27, 2016, 03:01:11 AM
Hey Misko... downloaded and installed and after updating youtube-dl all is working as advertised... I love the multiple gui options and the ease to switch between them

Well done!

I recommend you start a new thread with this excellent tool
Thank you. I've started a new thread > youtube-dl wrapper
Quote from: zephyr on August 27, 2016, 10:33:07 PM
misko: super awesome addition to youtube-dl and works as advertised, as VastOne pointed out... nice to be able to switch over for multiple downloads.

Thanx!

cheers to all! : )

Z
Cheers Z
I'm glad it works  ;)
#15
Zenity & Yad / youtube-dl wrapper
August 28, 2016, 06:40:55 PM
This is a youtube-dl wrapper; supports videos and lists from YouTube.
https://gitlab.com/misko_2083/yt-get/tags/v0.1.2

- detects if a url is a YT video or a list
- has options to select a custom download format
- can select videos from a list
- multiple GUI modes for single or multiple urls
- can download to mp3





Custom Format selection:

Selecting individual videos from a list:

Multiple download of videos and/or lists: