You are not logged in.
11
Last edited by kleiner_hussar (2016-06-02 10:43:22)
Offline
12
Last edited by kleiner_hussar (2016-06-02 10:43:32)
Offline
@kleiner_hussar cool, I have posted something similar on a few forums only for checksums
This is the weather wttr.in script.
I've had a zenity version for this before. Switched to yad and borrowed the usage instructions text from damo's github.
#!/bin/bash
text=" # wttr.in
#Usage: :help (from http://wttr.in/:help )
#$ (none) # current location
#$ muc # weather in the Munic airport
#Supported locations:
# paris # city name
# muc # airport code (3 letters)
# @stackoverflow.com # domain name"
weather_wttr() {
yad --html --browser --uri="http://wttr.in/$location" --width=900 --height=700 \
--button="Return!gtk-ok:0" --button="Exit!gtk-cancel:1" --title="Weather"
if (( $? == 1 )); then
exit
fi
}
while (true); do
location=$(yad --button="gtk-cancel:1" --button="gtk-ok:0" --entry \
--text="$text" --width=500 --height=300 --borders=10 \
--title="Weather" )
if (( $? == 1 ));then
exit
fi
weather_wttr
done
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
NB youtube-dl can manage the downloading of videos from many more sites than just youtube
Nice, works perfectly. A new BL-yt-downloadrer hopefully . Grat, Damo
We could have a repository, or maybe just a list somewhere, so people can find these cool things easily. Googling is fine, but if you just want to look round the candy store and see what's on the shelves then some kind of index...
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )
Offline
13
Last edited by kleiner_hussar (2016-06-02 10:43:44)
Offline
^ I must revisit the tabs functionality - I couldn't get my head around it first time
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
14
Last edited by kleiner_hussar (2016-06-02 10:43:54)
Offline
Today's one is a real gem. Not only why it's code shows us how to use tabs in yad, but it is a rally neat application , a gtk settings editor merely similar to Lxapparence .
I found it in the yad wiki ( wasn't a great deal ) but it worked only partially, and screwed up my gtkrc files.
...
^Thanks for sharing
This is my little color dialog experiment. xclip required
#!/bin/bash
#Misko_2083
if ! hash xclip 2>/dev/null; then
echo "Error: xclip not found"
exit
fi
text="Select the color and click <b>Copy</b> to copy the color to the clipboard\n
You can change the output mode to hex or rgb\n"
# Initial values
RGB=0
COLOR_SWITCH="HEX"
COLOR_MODE="hex"
COLOR="#FFFFFF"
# Copy to Clipboard
copy_color() {
printf "%s" "$color" | xclip -selection clipboard
}
color_mode() {
return
}
while (true); do
color=$(yad --color --separator="" --gtk-palette --button="${COLOR_SWITCH}:2" \
--button="gtk-close:1" --button="gtk-copy:0" --entry \
--text="$text" --width=500 --height=300 --borders=10 \
--title="Color Selector" --mode="${COLOR_MODE}" --buttons-layout=spread \
--init-color="${COLOR}"
)
RET=$?
if (( $RET == 1 )) || (( $RET == 252 ));then
exit
fi
COLOR="$color"
if (( $RET == 2 ));then
if [[ "$RGB" = "0" ]];then
RGB=1
COLOR_SWITCH="Rgb"
COLOR_MODE="rgb"
else
RGB=0
COLOR_SWITCH="Hex"
COLOR_MODE="hex"
fi
color_mode
fi
copy_color
done
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
15
Last edited by kleiner_hussar (2016-06-02 10:44:05)
Offline
This is my little color dialog experiment. xclip required
With either setting copy/paste only pastes the HEX code. No RGB.
The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!
Offline
16
Last edited by kleiner_hussar (2016-06-02 10:44:15)
Offline
misko_2083 wrote:This is my little color dialog experiment. xclip required
With either setting copy/paste only pastes the HEX code. No RGB.
Sorry mate, I forgot that hidrogen has an older version of YAD.
yad --about
0.27
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
17
Last edited by kleiner_hussar (2016-06-02 10:44:27)
Offline
18
Last edited by kleiner_hussar (2016-06-02 10:44:38)
Offline
A new one for today : a manpage browser.
Found on the GitHub.
Here is it : yaman
MOD EDIT: Post restored for yad contet from email notification.
Last edited by Sector11 (2016-06-02 21:43:09)
Offline
@kleiner_hussar What happened to your posts?
Self-censorship or your cat played with the keyboard?
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
@kleiner_hussar What happened to your posts?
Self-censorship or your cat played with the keyboard?
https://s14-eu5.ixquick.com/cgi-bin/ser … de3e7971c6
The first. I had to admit that this topic was a mistake from me. False address.
Last edited by kleiner_hussar (2016-06-02 13:22:37)
Offline
40 replies in the short time it was here isn't a mistake.
This was taking off ..
The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!
Offline
I had to admit that this topic was a mistake from me.
Please do not handle any "mistake" threads or posts like this in the future. By removing your posts, you have derailed the thread that you yourself created. Your posts were useful and contained important content necessary for comprehendeing the context of the other posts. You have destroyed that.
If there is a next time, please PM a forum moderator, we can either edit the thread so it still makes sense or just replace references to your forum name with a pseudonym.
This is a warning, please don't remove posts en masse again, it will be grounds for a ban. Thank you.
Offline
Currently trying to make a UI for PMRP - Poor Man's Radio Player
Works, just has issues with geo-blocked stations.
Why do they even use geo-blocking?
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
The other problem with radio players is that radio streaming urls seem to die very quickly. While more and more stations use flash (maybe with rtmp), the remaining ones that still provide urls to a stream that media players can use, change those urls often! How often you install some handy radio player, only to find that half the presets don't work...
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )
Offline
^ i regularly scrape somafm:
wget --recursive --no-directories --level=2 --accept pls,PLS,m3u,M3U \
--reject "*32.pls","*24.pls" \
http://somafm.com/ ; rm robots.txt
should also apply to other stations that use playlists.
Please use CODE tags for code.
Search youtube without a browser: repo | thread
BL quote proposals to this thread please.
my repos / my repos
Offline
The other problem with radio players is that radio streaming urls seem to die very quickly. While more and more stations use flash (maybe with rtmp), the remaining ones that still provide urls to a stream that media players can use, change those urls often! How often you install some handy radio player, only to find that half the presets don't work...
Exactly. Maintaining the presets can be a headake sometimes. Especially if there are lots of them in the preset.
^ i regularly scrape somafm:
wget --recursive --no-directories --level=2 --accept pls,PLS,m3u,M3U \ --reject "*32.pls","*24.pls" \ http://somafm.com/ ; rm robots.txt
should also apply to other stations that use playlists.
^I like that. That approach is much better.
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
^ i regularly scrape somafm:
It's been a while since I was here last time and I totally forgot about this method.
Today I had a look at the radio script and fixed some glitches.
It has a log to view the previously played tracks. Also, it can be minimized to tray and restored.
So this is the radio script: pmrp.sh
Requres yad and mpv. (On this machine yad --version is 0.38.2 (GTK+ 2.24.25), mpv --version is mpv 0.6.2 )
#!/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
#File to store default category
export CAT_FILE=$(mktemp -u --tmpdir pmrpcat.XXXXXXXX)
> $CAT_FILE
trap "rm -f $fpipe $ppipe $cpipe $statuspipe $PMRPLIST $CAT_FILE" EXIT
pmkey=$(($RANDOM * $$))
# Categories are separated with "!" (without quotes)
# The last item in category is without trailing "!"
Categories="181.FM!
Blues!
Urban"
function stations
{
if [[ "$1" != "$CAT_DEFAULT" ]]; then
echo "Category: $1" >> "$ppipe"
fi
< "$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"
echo "$1" > "$CAT_FILE"
case "$1" in
181.FM)
stations "$1"
;;
Blues)
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"
date +"Time: %T" >> $ppipe
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
CAT_DEFAULT="$(cat $CAT_FILE)"
if [[ "$CAT_DEFAULT" == "" ]]; then
CAT_DEFAULT="181.FM"
fi
echo "$(for category in $Categories
do
if [[ "$category" == "$CAT_DEFAULT" ]]; then
printf "^%s" "$CAT_DEFAULT"
elif [[ "$category" != "$CAT_DEFAULT!" ]]; then
printf "%s" "$category"
else
printf "^%s!" "$CAT_DEFAULT"
fi
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 &
# comment out 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 ""
run_stations "$(cat $CAT_FILE)" &>/dev/null
main
;;
*) exit 1
;;
esac
}
main
exec 3>&-
exec 4>&-
exec 5>&-
exec 6>&-
It uses this file to load stations from. needs to be in the same dir and named "stations" (without the quotes)
## Stations
# Tag: "Name" "Category" "URL"
## 181.FM
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"
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: "80's Hairband" "Rock" "http://relay.181.fm:8014"
181.FM: "Chloe" "Rock" "http://relay.181.fm:8100"
181.FM: "Classic Buzz" "Rock" "http://relay.181.fm:8038"
181.FM: "Rock 181" "Rock" "http://relay.181.fm:8008"
181.FM: "Rock 40" "Rock" "http://relay.181.fm:8028"
181.FM: "The Buzz" "Rock" "http://relay.181.fm:8126"
181.FM: "The Eagle" "Rock" "http://relay.181.fm:8030"
181.FM: "The Rock" "Rock" "http://relay.181.fm:8064"
181.FM: "Party 181" "Pop" "http://relay.181.fm:8036"
181.FM: "Power 181" "Pop" "http://relay.181.fm:8128"
181.FM: "Smooth AC" "Pop" "http://relay.181.fm:8094"
181.FM: "The Heart" "Pop" "http://relay.181.fm:8006"
181.FM: "The Mix" "Pop" "http://relay.181.fm:8032"
181.FM: "The Office" "Pop" "http://relay.181.fm:8002"
181.FM: "The Point" "Pop" "http://relay.181.fm:8010"
181.FM: "UK Top 40" "Pop" "http://relay.181.fm:8070"
181.FM: "Beatles" "Oldies" "http://relay.181.fm:8062"
181.FM: "Classic Hits" "Oldies" "http://relay.181.fm:8132"
181.FM: "Good Time Oldies" "Oldies" "http://relay.181.fm:8046"
181.FM: "Mellow Gold" "Oldies" "http://relay.181.fm:8060"
181.FM: "Soul" "Oldies" "http://relay.181.fm:8058"
181.FM: "Super 70s" "Oldies" "http://relay.181.fm:8066"
181.FM: "Reggae Roots" "Latin" "http://relay.181.fm:8096"
181.FM: "Salsa" "Latin" "http://relay.181.fm:8098"
181.FM: "Acid Jazz" "Easy" "http://icyrelay.181.fm/181-acidjazz_128k.mp3"
181.FM: "Bebop" "Easy" "http://icyrelay.181.fm/181-bebop_128k.mp3"
181.FM: "Classical Guitar" "Easy" "http://icyrelay.181.fm/181-classicalguitar_128k.mp3"
181.FM: "Classical Jazz" "Easy" "http://icyrelay.181.fm/181-classicaljazz_128k.mp3"
181.FM: "Classical Music" "Easy" "http://icyrelay.181.fm/181-classical_128k.mp3"
181.FM: "Fusion Jazz" "Easy" "http://icyrelay.181.fm/181-fusionjazz_128k.mp3"
181.FM: "Sensual World" "Easy" "http://icyrelay.181.fm/181-sensual_128k.mp3"
181.FM: "The Breeze" "Easy" "http://relay.181.fm:8004"
181.FM: "Trance Jazz" "Easy" "http://icyrelay.181.fm/181-trancejazz_128k.mp3"
181.FM: "True Blues" "Easy" "http://icyrelay.181.fm/181-blues_128k.mp3"
181.FM: "Vocal Jazz" "Easy" "http://icyrelay.181.fm/181-vocals_128k.mp3"
181.FM: "Front Porch" "Country" "http://relay.181.fm:8016"
181.FM: "Highway 181" "Country" "http://relay.181.fm:8018"
181.FM: "Kickin' Country" "Country" "http://relay.181.fm:8130"
181.FM: "Real Country" "Country" "http://relay.181.fm:8034"
181.FM: "US 181" "Country" "http://relay.181.fm:8056"
181.FM: "Comedy Club" "Comedy" "http://relay.181.fm:8026"
181.FM: "90's Alternative" "90s" "http://relay.181.fm:8052"
181.FM: "90's Country" "90s" "http://relay.181.fm:8050"
181.FM: "90's Dance" "90s" "http://relay.181.fm:8140"
181.FM: "Lite 90's" "90s" "http://relay.181.fm:8048"
181.FM: "Star 90's" "90s" "http://relay.181.fm:8012"
181.FM: "80's Country" "80s" "http://relay.181.fm:8134"
181.FM: "Awesome 80's" "80s" "http://relay.181.fm:8000"
181.FM: "Lite 80's" "80s" "http://relay.181.fm:8040"
## Blues
Blues: "12 Bar" "Blues" "http://streaming.radionomy.com:80/12Bar"
Blues: "A Better Classic Blues Vintage Station" "Blues" "http://streaming.radionomy.com/A-Better-Classic-Blues-Vintage-Station"
Blues: "A Blues Dream" "Blues" "http://streaming.radionomy.com/ABLUESDREAM-Classic-NewBlues24H"
Blues: "Aardvark Blues FM" "Blues" "http://74.208.45.146:8639/stream"
Blues: "AcousticFM" "Blues" "http://listen.radionomy.com/Acoustic-FM"
Blues: "Best Blues I Know" "Blues" "http://streaming.radionomy.com/BestBluesIKnow"
Blues: "Blues Radio" "Blues" "http://185.33.22.13:8030"
Blues: "Cocktelera Blues" "Blues" "http://streaming.radionomy.com/Cocktelera-Blues"
Blues: "Con Alma de Blues" "Blues" "http://listen.radionomy.com/Con-Alma-de-Blues"
Blues: "Funky Blues" "Blues" "http://streaming.radionomy.com/FunkyBlues"
Blues: "Big Blue Swing" "Blues" "http://209.236.126.18:8002"
Blues: "Blues Radio UK" "Blues" "http://206.217.213.16:8430/"
Blues: "Crossroads Blues Radio" "Blues" "http://174.127.114.128:8134/stream"
Blues: "Houston Blues Radio" "Blues" "http://74.208.170.137:8640/stream"
Blues: "K-BLUES" "Blues" "http://listen.radionomy.com:80/K-BLUES"
Blues: "Radio Mississipi Blues" "Blues" "http://listen.radionomy.com:80/RadioMississipi-Blues"
I'd like to add playlist support and easier way to add/edit stations later.
Што ни оштровиди ум сагледати не може - љубав превазилази.
Offline
Currently trying to make a UI for PMRP - Poor Man's Radio Player
I just gave it a try and it's way too cool! Using it in a terminal, works like a charm. Thank you for mentioning it.
Edit: Tried the GUI version too. Fantastic! Playing: [90's Dance - Reel 2 Reel - Can You Feel It? (Erick 'More' Radio Edit)]
Last edited by martix (2017-08-05 10:40:20)
Offline