YAD - Tips
Hi All,
Here's my take on a radio player using yad with the "--paned" option providing a list with radio stations (by clicking 'Load' button).
Much inspired by PMRP from misko_2083, see:
http://murga-linux.com/puppy/viewtopic. ... 382#963382
However wasn't able to understand how exactly it works, so took as a base concept for it from: Victor Ananjevsky's (yad author) "find frontend" example from here:
https://sourceforge.net/p/yad-dialog/wi ... /?limit=50
Thanks also to Stemsee for suggestions about yad "--list --listen" (refresh list) options !
Would love to have the "Now Playing" info as part of the main GUI, but couldn't figure out how, any suggestions are welcome !
Workaround is a "Now Playing" button which activates a small window at right-bottom of screen displaying the title.
Search option has access to large database from "RadioSure" (commercial M$ app) converted to use with this app.
(need to click 'Update Index' first)
Choice for lots of category lists (included in 'playlist' folder), e.g. Rock, Jazz, Country, R&B ...etc...
Possible TODO'S:
- Option to remove from Favorites list (only add is possible now)
- Ability to add custom URL (http://...) to Favorites.
Depends on yad and mplayer installed.
(not sure from which yad version on it supports --paned option, I use v 0.38 )
Extract attached yradio.tar.gz to somewhere.
Run from inside yradio folder: "yradio" script (just click on it).
EDIT: Sorry, found a bad bug: Several stations not playing because of incorrect use of the quotes for option --dclick-action" (and --select-action), fixed now, attached new version.
btw, also removed "mktemp" command from script (previously used for creating variable for named pipes, now done differently) , since it may not be portable between systems.
Fred
Here's my take on a radio player using yad with the "--paned" option providing a list with radio stations (by clicking 'Load' button).
Much inspired by PMRP from misko_2083, see:
http://murga-linux.com/puppy/viewtopic. ... 382#963382
However wasn't able to understand how exactly it works, so took as a base concept for it from: Victor Ananjevsky's (yad author) "find frontend" example from here:
https://sourceforge.net/p/yad-dialog/wi ... /?limit=50
Thanks also to Stemsee for suggestions about yad "--list --listen" (refresh list) options !
Would love to have the "Now Playing" info as part of the main GUI, but couldn't figure out how, any suggestions are welcome !
Workaround is a "Now Playing" button which activates a small window at right-bottom of screen displaying the title.
Search option has access to large database from "RadioSure" (commercial M$ app) converted to use with this app.
(need to click 'Update Index' first)
Choice for lots of category lists (included in 'playlist' folder), e.g. Rock, Jazz, Country, R&B ...etc...
Possible TODO'S:
- Option to remove from Favorites list (only add is possible now)
- Ability to add custom URL (http://...) to Favorites.
Depends on yad and mplayer installed.
(not sure from which yad version on it supports --paned option, I use v 0.38 )
Extract attached yradio.tar.gz to somewhere.
Run from inside yradio folder: "yradio" script (just click on it).
EDIT: Sorry, found a bad bug: Several stations not playing because of incorrect use of the quotes for option --dclick-action" (and --select-action), fixed now, attached new version.
btw, also removed "mktemp" command from script (previously used for creating variable for named pipes, now done differently) , since it may not be portable between systems.
Fred
- Attachments
-
- yradio.tar.gz
- v0.0.2, bug fixed for double-click action
Extract to somewhere and run 'yradio' from inside directory - (251.02 KiB) Downloaded 290 times
-
- yradio.jpg
- Yradio GUI
- (66.15 KiB) Downloaded 1401 times
Last edited by fredx181 on Tue 13 Mar 2018, 20:28, edited 1 time in total.
Euh... Fredx?
You do with your time what you will of course. If your radio app above is practice
for becoming an even greater yad virtuoso than you are already, that's fine.
Otherwise, why go through the trouble? There already exist a host of good radio
players on Linux: aqualung, deadbeef, mplayer,mpv, etc.
Just a thought.
You do with your time what you will of course. If your radio app above is practice
for becoming an even greater yad virtuoso than you are already, that's fine.
Otherwise, why go through the trouble? There already exist a host of good radio
players on Linux: aqualung, deadbeef, mplayer,mpv, etc.
Just a thought.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Hi Fred,
nice, and using yad it's (still) very compact. Reminds me of dejan555's Simple GTK Radio, which is based on gtkdialog and kept me busy customizing many moons ago.
I made some code changes for my personal use and now it looks as in the screenshot (I wanted it to look like an old fashioned car radio). It has a recording function and some other features, but basically it works very similar to your yad version.
One suggestion: I find the "Failed to connect" dialog pretty annoying since it needs to be closed manually and it appears frequently as many small stations are frequently off. In SGR the problem is solved by - doing nothing. No message, no dialog. If I can't connect to a station within a reasonable time I move on to the next station.
nice, and using yad it's (still) very compact. Reminds me of dejan555's Simple GTK Radio, which is based on gtkdialog and kept me busy customizing many moons ago.
I made some code changes for my personal use and now it looks as in the screenshot (I wanted it to look like an old fashioned car radio). It has a recording function and some other features, but basically it works very similar to your yad version.
One suggestion: I find the "Failed to connect" dialog pretty annoying since it needs to be closed manually and it appears frequently as many small stations are frequently off. In SGR the problem is solved by - doing nothing. No message, no dialog. If I can't connect to a station within a reasonable time I move on to the next station.
- Attachments
-
- Simple_GTK_Radio.png
- MochiMoppel's adaption of dejan555's Simple GTK Radio
- (30.88 KiB) Downloaded 1200 times
musher0 .... I am curious, if Fred is programming yadradio for another reason other than the one you mention then you imply that it isn't ok. Why isn't it ok? What psychosis compels you to publish your judgement? If it's because you think Fred doesn't know why he does these things, then that's fine .... otherwise you're probably better off pouring your energy into writing better apps too! Don't you think?musher0 wrote:Euh... Fredx?
You do with your time what you will of course. If your radio app above is practice
for becoming an even greater yad virtuoso than you are already, that's fine.
Otherwise ....
Just a thought.
stemsee
@mochimoppel
Yes, compactness was my goal, but still yad is very limited compared to gtkdialog of course (unfortunately I'm really no good with gtkdialog programming ), looks very nice your Simple GTK Radio mod ! I'm jealous
@stemsee
I may have misunderstood your earlier question:
(and in function add_fav it does a grep for that to find the station name (BBC ...))
But I found by changing function sel_file to:
It gives the full output that way in tmp/sel-file , e.g.:
So that would be better (but function add_fav needs also modified (simplified) then)
Fred
Thanks for testing.nice, and using yad it's (still) very compact. Reminds me of dejan555's Simple GTK Radio, which is based on gtkdialog and kept me busy customizing many moons ago.
Yes, compactness was my goal, but still yad is very limited compared to gtkdialog of course (unfortunately I'm really no good with gtkdialog programming ), looks very nice your Simple GTK Radio mod ! I'm jealous
@stemsee
I may have misunderstood your earlier question:
Currently in yradio the output of --select-action outputs only the first part (URL only )how does the selected item (BBC) get read
(and in function add_fav it does a grep for that to find the station name (BBC ...))
But I found by changing function sel_file to:
Code: Select all
function sel_file
{
echo -en "$1\n$2\n$3" | tr '\n' '|' > $LAUNCHDIR/tmp/sel-file # full output
# echo $1 > $LAUNCHDIR/tmp/sel-file
# xdg-open "$1" &> /dev/null
}
export -f sel_file
Code: Select all
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p|BBC Radio 1 United Kingdom|Hits
Fred
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Should also work:fredx181 wrote:Code: Select all
echo -en "$1\n$2\n$3" | tr '\n' '|' > $LAUNCHDIR/tmp/sel-file
Code: Select all
echo -n "${1}|${2}|${3}" > $LAUNCHDIR/tmp/sel-file
Ah, yes works also, better solution (compact ), thanks.MochiMoppel wrote:Should also work:fredx181 wrote:Code: Select all
echo -en "$1\n$2\n$3" | tr '\n' '|' > $LAUNCHDIR/tmp/sel-file
Code: Select all
echo -n "${1}|${2}|${3}" > $LAUNCHDIR/tmp/sel-file
musher0's post from above is reproduced below in the first screen shot.
stemsee subsequently enquired, perhaps charitably, amongst other questions to musher0,
stemsee subsequently enquired, perhaps charitably, amongst other questions to musher0,
The second screen shot comes courtesy of the Canadian Mental Health Association and suggests a likely explanation for yet another example of disgraceful behaviour from musher0.What psychosis compels you to publish your judgement?
- Attachments
-
- A few posts above quote.png
- (66.77 KiB) Downloaded 1024 times
-
- CMHA quote.png
- (100.68 KiB) Downloaded 1016 times
-
- Posts: 1543
- Joined: Mon 22 Feb 2016, 19:43
Mental Health issues are very common ... more than acknowledged or citable ... simply because there is no norm to rate against. Of course each one of us thinks we are normal ... but the happy truth is that there is no normal. What there is is a flux and dynamic equilibrium, which easily beomes unbalanced in isolation. Best remedy is to volunteer and become part of a real physical group. Being unendingly on a computer is too unreal and inhuman, there must be daily interaction, no matter how mundane, with other real human beings, not their virtual manifestations ... get out and about, if possible.
Mental Health problems are everywhere and touch everyone, to some degree ... it is the degree which needs control. Our societies actually promote isolation, more so in 1st world than 2nd and 3rd world socieities. The continuous cerebral preoccupation with detail and trivia is driving us to a wider degree of undetectable inbalance! Instead of behaving naturally, we behave calculatedly, this is the way we acheive a seemingly normal pattern of behaviour when sharing communal spaces, but for short periods of time only. When in isolation these calculations need only be slightly out, and will be detectable if with semi-permanence put in writing, and much more noticable to others too. I blame the governments and media pressure that try to force us to conform uniformly to the commercial objectives of societal behaviourism. My conclusion is, that the more intelligent you are, the more likely you will suffer from mental health issues, as you waste your computing power on calculating average behaviour, instead of behaving naturally, albeit unacceptably.
imho
I should write a program using yad to measure one's deviance.
stemsee
Mental Health problems are everywhere and touch everyone, to some degree ... it is the degree which needs control. Our societies actually promote isolation, more so in 1st world than 2nd and 3rd world socieities. The continuous cerebral preoccupation with detail and trivia is driving us to a wider degree of undetectable inbalance! Instead of behaving naturally, we behave calculatedly, this is the way we acheive a seemingly normal pattern of behaviour when sharing communal spaces, but for short periods of time only. When in isolation these calculations need only be slightly out, and will be detectable if with semi-permanence put in writing, and much more noticable to others too. I blame the governments and media pressure that try to force us to conform uniformly to the commercial objectives of societal behaviourism. My conclusion is, that the more intelligent you are, the more likely you will suffer from mental health issues, as you waste your computing power on calculating average behaviour, instead of behaving naturally, albeit unacceptably.
imho
I should write a program using yad to measure one's deviance.
stemsee
Hi all, learning about use of "--cycle-read" in --form, found about it here:
https://groups.google.com/forum/#%21msg ... WgA0VoBQAJ
and here;
https://groups.google.com/forum/#%21top ... vXl3Xf40r0
But these examples are only for to update one field, but I wanted a form with multiple fields, update first field and keep the others "intact", here's simple example to demonstrate.
The trick is to set all the fields first (3 in this example), then when updating first field (while loop), by adding e.g. "echo "" >&3" for the other remaining fields.
Now while this is running, just replace the text inside 'test', e.g.
And it will be display it in the first field text of the yad dialog.
Fred
https://groups.google.com/forum/#%21msg ... WgA0VoBQAJ
and here;
https://groups.google.com/forum/#%21top ... vXl3Xf40r0
But these examples are only for to update one field, but I wanted a form with multiple fields, update first field and keep the others "intact", here's simple example to demonstrate.
The trick is to set all the fields first (3 in this example), then when updating first field (while loop), by adding e.g. "echo "" >&3" for the other remaining fields.
Code: Select all
export pipe="/tmp/test-cycle-read.$RANDOM"
mkfifo "$pipe"
exec 3<> $pipe
echo "Hello World" > test # Initial text, run e.g: "echo foo > test" to change displaying text
READ=$(cat test 2> /dev/null)
echo "$READ" >&3
echo 'bash -c "rox"' >&3
echo 'bash -c "geany"' >&3
while true; do
NEWREAD=$(cat test 2> /dev/null)
if [ "$NEWREAD" != "$READ" ]; then
echo "$NEWREAD" >&3 # first field, new read from 'test' file
echo "" >&3 # bash -c "rox"
echo "" >&3 # bash -c "geany"
READ=$NEWREAD
fi
sleep 2
done &
yad --title="Cycle Test" --form --cycle-read --field ": " --field="Rox:fbtn" --field="Geany:fbtn" <&3
Code: Select all
echo "My Text" > test
Fred
- Attachments
-
- yad-cycle-read-form.gif
- Cycle-read for form
- (163.8 KiB) Downloaded 834 times
I think it's a fair question, musher, and nothing to do with anyone's 'mental health' per say, except that all 'hobby-like' activities are probably undertaken for the pleasure derived in such. Different people no doubt have different motives for undertaking any kind of programming work. There are certainly usually plenty of alternatives out there nowadays, but that shouldn't mean we suddenly stop trying to do our own thing - particularly if we can achieve something slightly different. In the Puppy world it has always been the case that 'small' applications that provide a lot of functionality in a small footprint have been an important driving force.musher0 wrote:Euh... Fredx?
You do with your time what you will of course. If your radio app above is practice
for becoming an even greater yad virtuoso than you are already, that's fine.
Otherwise, why go through the trouble? There already exist a host of good radio
players on Linux: aqualung, deadbeef, mplayer,mpv, etc.
Just a thought.
It may be argued that even 'oldish' computers nowadays have sufficient resources available to them that size etc no longer matters at all to any important degree. Still, old habits die slowly, and there remains an attraction, it seems to me, to try and make tiny or small systems and that's where gtkdialog and yad-type apps come in (plus that it is relatively easy to program with them, whereas the likes of C++ and gtk or Qt, and even Python (and its extensive libs) are complicated to learn and use comparatively).
Aqualung and so on can certainly do the job but, as Fred has shown with Dog Radio, sometimes one of these tiny yad or gtkdialog-based apps has an appealing frugality, convenience and charm - perhaps because that old UNIX philosophy of designing a tool that only does one job but does it well is refreshing in this world of over-the-top-often-unnecessary-and-stressful-complexity.
But yeah, sometimes I wonder why we don't just all abandon small Linux distributions altogether since the larger offerings have most every facility available on tap anyway (in any shape or size or form). But small definitely sometimes means 'more efficient' - from a user point of view, that certainly depends on the user-interface provided though.
I haven't myself put much effort at all into learning yad, which is not a comment against yad, just that I've stuck to what I know a little of, which is gtkdialog with bash. The only thing is, I don't know who is likely to maintain gtkdialog for the future, whereas yad development appears to remain active.
Might be nice to become specialists in other programming languages such as Genie, Vala, Bacon, C etc (or even scripting ones such as Python, or small Lua) but still have to have some sort of graphical user interface toolkit to go along with the main programming language you are using. For bash, yad or gtkdialog are making that part of the programming effort relatively easy. Funnily enough early Pups came with John Murga's slant on Lua with a modified FLTK toolkit for graphics - I can't help feeling it is a shame that was left out of later Pups actually...
Despite John Murga not going with it in his early Lua/Puppy implementation, I still think this apparently simple-to-program multi-platform toolkit (IUP), for Lua, or C, sounds very interesting. It's been around for over 20 years (!) and is still actively being maintained. I guess I should try it:
http://webserver2.tecgraf.puc-rio.br/iup/
https://webserver2.tecgraf.puc-rio.br/iup/en/led.html
https://webserver2.tecgraf.puc-rio.br/i ... lkits.html
or... ?
http://www.murga-projects.com/forum/sho ... hp?tid=429
But is murga Lua still being maintainted??? Seems not?
I've started a thread for possible further discussion of IUP in following link, in case anyone starts using this in any productive way on Puppy-related distros. I can program in C, but only very little experience in using gtk+ with that, but have always had a desire to try Lua since I think a scripting language is best for small distro utils/app development work (since others can easily modify such work, without having that compile-need burden inbetween) - but need a simple graphical toolkit for such work (and Lua itself, unlike Python, is light enough to include in a small distro by default):
http://www.murga-linux.com/puppy/viewtopic.php?t=113013
wiak
See new YRadio version here:
http://murga-linux.com/puppy/viewtopic. ... 591#986591
(merged with "Dogradio and YRadio" thread)
Why ??
My interest in exploring new yad options, (e.g. --cycle-read and --paned) and attempting to provide a simple and lightweight internet radio player.
Fred
http://murga-linux.com/puppy/viewtopic. ... 591#986591
(merged with "Dogradio and YRadio" thread)
Why ??
My interest in exploring new yad options, (e.g. --cycle-read and --paned) and attempting to provide a simple and lightweight internet radio player.
Fred
- misko_2083
- Posts: 114
- Joined: Tue 08 Nov 2016, 13:42
Freddy, you've been a busy puppy since my last login.fredx181 wrote:See new YRadio version here:
http://murga-linux.com/puppy/viewtopic. ... 591#986591
(merged with "Dogradio and YRadio" thread)
Why ??
My interest in exploring new yad options, (e.g. --cycle-read and --paned) and attempting to provide a simple and lightweight internet radio player.
Fred
If I may suggest that you put that "Update Index" button somewhere else. 4 out of five times I clicked that button instead of "Load".
I would add pulse audio volume control in a popup window.
The only trouble is positioning these windows for all the monitor resolutions can be tricky. Also not sure which previous versions of yad support these kind of windows.
- Attachments
-
- yradio.fake.tar
- (22.94 KiB) Downloaded 181 times
Yeah, sure, but you should check here more often, MiskY !misko_2083 wrote:Freddy, you've been a busy puppy since my last login. Smile
I would add pulse audio volume control in a popup window.
Many thanks, nice to have volume control, however... most puppy (and 'dog') systems don't have pulseaudio by default, just alsa.
Do you think something like you did that can work with just alsa ?
Works fine for me, but first had to install pulseaudio and also "gawk" (had only "mawk" installed, setting the volume didn't work with that (EDIT, I *think* also not with busybox awk)).
Best regards, and thanks again,
EDIT: YRadio also on github now:
https://github.com/fredx181/yradio
Fred
Nowadays I just map Win key (special left) plus the up/down arrow keys to incrementally raise/lower the volume. Right menu to present the default menu (up and down arrows to navigate the menu) ... etc.fredx181 wrote:Many thanks, nice to have volume control, however... most puppy (and 'dog') systems don't have pulseaudio by default, just alsa.
Do you think something like you did that can work with just alsa ?
Works fine for me, but first had to install pulseaudio and also "gawk" (had only "mawk" installed, setting the volume didn't work with that (EDIT, I *think* also not with busybox awk)).