Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 25 Sep 2018, 02:49
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 26 of 35 [512 Posts]   Goto page: Previous 1, 2, 3, ..., 24, 25, 26, 27, 28, ..., 33, 34, 35 Next
Author Message
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Mon 12 Mar 2018, 17:33    Post subject:  

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.php?p=963382#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/wiki/Frontend%20for%20find%2Bgrep%20commands/?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
yradio.tar.gz
Description  v0.0.2, bug fixed for double-click action
Extract to somewhere and run 'yradio' from inside directory
gz

 Download 
Filename  yradio.tar.gz 
Filesize  251.02 KB 
Downloaded  124 Time(s) 
yradio.jpg
 Description   Yradio GUI
 Filesize   66.15 KB
 Viewed   899 Time(s)

yradio.jpg


_________________
Dog Linux website

Last edited by fredx181 on Tue 13 Mar 2018, 16:28; edited 1 time in total
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Tue 13 Mar 2018, 12:51    Post subject:  

Bug fixed for yradio, see EDIT and new attachment above.

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2264
Location: In The Way

PostPosted: Thu 15 Mar 2018, 00:08    Post subject:  

Hi Fred

I was testing your yradio. When selecting say BBC from the dropdown box and then load ... how does the selected item (BBC) get read?

stemsee
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Thu 15 Mar 2018, 06:01    Post subject:  

Hi Stemsee,
By --select-action='bash -c "sel_file %s"' sending it to a file ("sel-file" in "tmp" folder)
See function sel_file
It's only for adding to Favorites (function "add_fav")

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12697
Location: Gatineau (Qc), Canada

PostPosted: Thu 15 Mar 2018, 09:16    Post subject:  

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.

_________________
musher0
~~~~~~~~~~
Siempre será canción nueva... (V. Jara, Manifiesto)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1619
Location: Japan

PostPosted: Thu 15 Mar 2018, 10:56    Post subject:  

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.
Simple_GTK_Radio.png
 Description   MochiMoppel's adaption of dejan555's Simple GTK Radio
 Filesize   30.88 KB
 Viewed   708 Time(s)

Simple_GTK_Radio.png

Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2264
Location: In The Way

PostPosted: Thu 15 Mar 2018, 14:53    Post subject:  

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 ....

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?

Just a thought.
stemsee
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Fri 16 Mar 2018, 07:04    Post subject:  

@mochimoppel
Quote:
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.

Thanks for testing.
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 Sad ), looks very nice your Simple GTK Radio mod ! I'm jealous Wink

@stemsee
I may have misunderstood your earlier question:
Quote:
how does the selected item (BBC) get read

Currently in yradio the output of --select-action outputs only the first part (URL only )
(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:
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

It gives the full output that way in tmp/sel-file , e.g.:
Code:
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p|BBC Radio 1 United Kingdom|Hits

So that would be better (but function add_fav needs also modified (simplified) then)

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1619
Location: Japan

PostPosted: Fri 16 Mar 2018, 07:55    Post subject:  

fredx181 wrote:
Code:
echo -en "$1\n$2\n$3" | tr '\n' '|' > $LAUNCHDIR/tmp/sel-file

Should also work:
Code:
echo -n "${1}|${2}|${3}" > $LAUNCHDIR/tmp/sel-file
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Fri 16 Mar 2018, 08:18    Post subject:  

MochiMoppel wrote:
fredx181 wrote:
Code:
echo -en "$1\n$2\n$3" | tr '\n' '|' > $LAUNCHDIR/tmp/sel-file

Should also work:
Code:
echo -n "${1}|${2}|${3}" > $LAUNCHDIR/tmp/sel-file


Ah, yes works also, better solution (compact Wink ), thanks.

_________________
Dog Linux website
Back to top
View user's profile Send private message 
mfb

Joined: 22 Mar 2016
Posts: 58

PostPosted: Sun 18 Mar 2018, 12:51    Post subject:  

musher0's post from above is reproduced below in the first screen shot.

stemsee subsequently enquired, perhaps charitably, amongst other questions to musher0,
Quote:
What psychosis compels you to publish your judgement?

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.
A few posts above quote.png
 Description   
 Filesize   66.77 KB
 Viewed   518 Time(s)

A few posts above quote.png

CMHA quote.png
 Description   
 Filesize   100.68 KB
 Viewed   523 Time(s)

CMHA quote.png

Back to top
View user's profile Send private message 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 1540

PostPosted: Sun 18 Mar 2018, 13:04    Post subject:  

I wonder where they come up with these numbers. Only 8% experience major depression? That's only around 1 in 12 people. I'm pretty sure it's closer to 100%, maybe they meant 80%. Need to research this more I think...
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2264
Location: In The Way

PostPosted: Mon 19 Mar 2018, 11:22    Post subject:  

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
Back to top
View user's profile Send private message MSN Messenger 
fredx181


Joined: 11 Dec 2013
Posts: 3387
Location: holland

PostPosted: Sat 24 Mar 2018, 19:32    Post subject:  

Hi all, learning about use of "--cycle-read" in --form, found about it here:
https://groups.google.com/forum/#%21msg/yad-common/J1XW6wl82wc/scWgA0VoBQAJ
and here;
https://groups.google.com/forum/#%21topic/yad-common/TvXl3Xf40r0

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:

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


Now while this is running, just replace the text inside 'test', e.g.
Code:
echo "My Text" > test

And it will be display it in the first field text of the yad dialog.

Fred
yad-cycle-read-form.gif
 Description   Cycle-read for form
 Filesize   163.8 KB
 Viewed   312 Time(s)

yad-cycle-read-form.gif


_________________
Dog Linux website
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 939
Location: not Bulgaria

PostPosted: Sun 25 Mar 2018, 00:55    Post subject:  

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.


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.

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/iup/en/toolkits.html

or... ?

http://www.murga-projects.com/forum/showthread.php?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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 26 of 35 [512 Posts]   Goto page: Previous 1, 2, 3, ..., 24, 25, 26, 27, 28, ..., 33, 34, 35 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0775s ][ Queries: 12 (0.0096s) ][ GZIP on ]