You are not logged in.

#1441 2021-02-23 10:47:16

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

ohnonot wrote:

^ what, why?
The audtool command from post #1437 notifies of song changes, no?
So you only have to store the old song, and comapre that regularly to what the command spits out. When it's different, you start looking for a cover again.

This quick script (requires curl and xmllint) will do it for the 50px version, not sure there's a  bigger one?

#!/bin/sh

exec 2>/dev/null
url="https://www.radioswisspop.ch/en"
echo "$url/$(curl "$url" | xmllint --nonet --html --xpath "string(//div[@class=\"current-airplay\"]//div[@class=\"time-cover-w\"]/img/@src)" -)"

That said, this works only for this one station. There's software that will fetch cover art based on the title/album. I have used glyrc with some success.

^the 50px would be enough for me for now  big_smile
Larger ones also exist and are shown e.g. here.

so, how do I get this into my $HOME ?
I have no idea, but assume here the code must be supplemented

...]/img/@src)" -)"

Offline

#1442 2021-02-23 12:19:53

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Show us your conky

unklar wrote:

so, how do I get this into my $HOME ?

It returns the URL to the image itself. Just curl/wget it to your $HOME big_smile

Offline

#1443 2021-02-23 12:28:01

manuel-909
Member
Registered: 2017-10-09
Posts: 94

Re: Show us your conky

Working good A+ loutch......

Offline

#1444 2021-02-23 12:56:40

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

ohnonot wrote:
unklar wrote:

so, how do I get this into my $HOME ?

It returns the URL to the image itself. Just curl/wget it to your $HOME big_smile

uhm   8)

Offline

#1445 2021-02-23 17:05:14

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Show us your conky

unklar wrote:

uhm   8)

Not sure what you mean.
Do you need more help?
The miniscript returns the URL to an image - of the current playing song on radioswisspop.
You can download that image with curl or wget.

Offline

#1446 2021-02-24 08:20:52

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

ohnonot wrote:

Do you need more help?

^Please - gladly

How do you pass that to curl, because I can't see anything else about this   hmm

$ ./ohnonot_radio.sh
https://www.radioswisspop.ch/en/

Last edited by unklar (2021-02-24 10:10:46)

Offline

#1447 2021-02-25 19:28:08

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Show us your conky

Do you have xmllint installed? It's part of the libxml2-utils package.

Offline

#1448 2021-02-25 23:28:59

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Show us your conky

@unklar

#!/usr/bin/env bash

line_1=$(sed -n 1p temp)
curr_playing=$(audtool current-song-tuple-data title)
if [[ $line_1 != $curr_playing ]]; then
    echo $curr_playing > temp
    wget -q -O current_playing "https://www.radioswisspop.ch/en"
    sed -i '/<div class="current-airplay">/,/<div class="vol-ctr hidden-md hidden-lg">/!d' current_playing
    sed -i -e 's/^.*"titletag">//' -e 's/^.*"artist">//' -e 's/^.*src="//' current_playing
    sed -i -e 's/<\/span>//g' -e 's/" \/>//g' -e '/<\|>/d' -e '/^ *$/d' current_playing
    wget -q -O current_playing_thumb.jpg "https://www.radioswisspop.ch$(sed -n 1p current_playing)"
fi

Have it run every 30sec or something - maybe a cron job?

Last edited by TeoBigusGeekus (2021-02-25 23:31:17)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1449 2021-02-26 12:46:11

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

Wonderful Teo!  smile

2021-02-26-11-00-50_scrot.th.png

In the beginning Conky does it without problems with these settings (I took the liberty to write this line into your script).

conky.text = [[
#${execi 3 sed -n '1p' $HOME/.conky/teoRadio/current_playing}
${execi 30 sed -n '2p' $HOME/.conky/teoRadio/current_playing}
${execi 30 sed -n '3p' $HOME/.conky/teoRadio/current_playing}
${texeci 30 $HOME/.conky/teoRadio/teo_radio.sh}${lua fDrawImage $HOME/.conky/teoRadio/teo.png 0 40 60 60 0}
	convert -resize 60x60! ~/.conky/teoRadio/current_playing_thumb.jpg ~/.conky/teoRadio/teo.png

But Conky simply stops running the script after a certain time of "editing". The reason does not become apparent. hmm

I have to switch on -DD, S11 would say.
Or, follow your advice with a cronjob.

So, first of all, thank you!  wink

Offline

#1450 2021-02-26 13:08:42

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

ohnonot wrote:

Do you have xmllint installed? It's part of the libxml2-utils package.

Sorry about that, I had relied on libxml2 as the default in BL and didn't check the -utils. :8

Now it looks correct.

https://www.radioswisspop.ch/en//wo/covers/c50x50/1376842-50x50.jpg

so i would enter

curl -o https://www.radioswisspop.ch/en//wo/covers/c50x50/1376842-50x50.jpg > image.jpg

but, can't I do that right now in your script

#!/bin/sh

exec 2>/dev/null
url="https://www.radioswisspop.ch/en"
echo "$url/$(curl "$url" | xmllint --nonet --html --xpath "string(//div[@class=\"current-airplay\"]//div[@class=\"time-cover-w\"]/img/@src)" -)"
curl -o https://www.radioswisspop.ch/en//wo/covers/c50x50/1376842-50x50.jpg > image.jpg

or should it read

curl -o -L https://www.radioswisspop.ch/en//wo/covers/c50x50/1376842-50x50.jpg > image.jpg

Last edited by unklar (2021-02-26 14:12:41)

Offline

#1451 2021-02-26 13:24:25

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: Show us your conky

unklar wrote:

Wonderful Teo!  smile

{snip}

I have to switch on -DD, S11 would say.
Or, follow your advice with a cronjob.

So, first of all, thank you!  wink

I heard my name -- it was very distinct.
What did I to now.   lol  lol


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1452 2021-02-26 18:28:06

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

@Sector11
^^Your tips were always worth their weight in gold.  big_smile

-DD spits out this

~$ conky -c ~/.conky/teoRadio/conkyrc10 -DD &
[1] 3972
~$ DEBUG(0) [/build/conky-H8e3VB/conky-1.10.6/src/conky.cc:2698]: reading contents from config file '/home/unklar/.conky/teoRadio/conkyrc10'
DEBUG(0) [/build/conky-H8e3VB/conky-1.10.6/src/x11.cc:497]: Fixed xinerama area to: 0 0 1920 1080
DEBUG(0) [/build/conky-H8e3VB/conky-1.10.6/src/x11.cc:497]: Fixed xinerama area to: 0 0 1920 1080
conky: desktop window (6b4) is root window
DEBUG(0) [/build/conky-H8e3VB/conky-1.10.6/src/x11.cc:634]: Found ARGB Visual
conky: window type - normal
conky: drawing to created window (0x3a00002)
conky: drawing to double buffer
DEBUG(1) [/build/conky-H8e3VB/conky-1.10.6/src/core.cc:1986]: no templates to replace
conky: forked to background, pid is 3973

no templates to replace
if I feed a search engine with it I get to sed

Teo, is it possible that this line also has the sed -e must contain ?

...
    sed -i '/<div class="current-airplay">/,/<div class="vol-ctr hidden-md hidden-lg">/!d' current_playing
...

  smile

Last edited by unklar (2021-02-26 18:33:06)

Offline

#1453 2021-02-26 19:41:38

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: Show us your conky

AHA!  The old double debug trick.  Totally forgot about that  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1454 2021-02-26 21:18:14

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Show us your conky

No, I don't think so. The -e option is needed when you're doing many things with one sed command, for example

sed -i -e 'something' -e 'something else' -e 'ever more' -e 'and more' -e 'etc.' /path/file/to/manipulate

Try the whole thing without the convert command.

Last edited by TeoBigusGeekus (2021-02-26 21:19:56)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1455 2021-02-27 04:36:14

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

^ forget it

Slept on it one night and I also think it's not an extra -e in sed.
You are right.

Maybe temp should be deleted periodically so conky doesn't have a "template" anymore...

Offline

#1456 2021-02-27 10:36:28

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

I have now moved to an "unencumbered" conky system (beryllium) and set everything up from scratch.

2021-02-27-10-43-47_scrot.th.png

Teo, since more than 4 hours Conky is doing its job with your excellent script.  big_smile
The cover image is usually changed after 10 seconds at the latest. Title and artist need about 30Sec. That's why I switched to temp, because this is done at least 2-5Sec. earlier.
I have this setting now:

...

--	lua_load = '~/LUA/image.lua',
--${lua fDrawImage $HOME/.conky/teoRadio/teo.png 0 40 60 60 0}

};

conky.text = [[
#${execi 3 sed -n '1p' $HOME/.conky/teoRadio/current_playing}
#${execi 30 sed -n '2p' $HOME/.conky/teoRadio/current_playing}
#${execi 30 sed -n '3p' $HOME/.conky/teoRadio/current_playing}
${execi 30 sed -n '1p' $HOME/temp | fold -s40}
${texeci 30 $HOME/.conky/teoRadio/teo_radio.sh}${image $HOME/current_playing_thumb.jpg -p 0,40 -s 50x50}

]];

You can still "tweak" it. wink
Yesterday I also had a serious error in my configuration myself.
The update time was only 0.1 sec. 8)

So, a cronjob I do not need to make according to the current state.
Teo, big thanks to you. You are the best!  O:)

Offline

#1457 2021-02-27 13:28:20

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

^So, I have now helped myself to my friend @loutch   smile

rBOHG5yt.png

So far this runs without problems that I can publish the configuration here:

-- pkill -xf "conky -c $HOME/path/to/conkyrc"
-- 2021-02-27 @unklar with the script from @TeoBigusGeekus
conky.config = {
	background = false,--true,
	
	use_xft = true,
	font = 'Fira Mono:size=8',
	xftalpha = 1,
	
	double_buffer = true,	
	update_interval = 1,
	total_run_times = 0,
	no_buffers = true,	
	
	own_window = true,
	own_window_type = 'desktop',--normal',	
	own_window_transparent = true,
--	own_window_color = '000000',
--	own_window_argb_visual = true,
--	own_window_argb_value = 180,
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',--
        own_window_class = 'Conky',	

	text_buffer_size = 2048,
	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,
	default_color = 'ffffff',
	default_outline_color = 'ffffff',

	minimum_width = 310, minimum_height = 88,
	maximum_width = 310,
	alignment = 'bottom_right',
	gap_x = 10,--350,
	gap_y = 60,

	uppercase = false,
	cpu_avg_samples = 2,
	override_utf8_locale = true,
--      imlib_cache_flush_interval 60
	imlib_cache_size = 0,

	stippled_borders = 5,

	default_color = 'ffffff',--ffd579
	default_shade_color = '333333',
	default_outline_color = '000000',

--	lua_load = '~/LUA/image.lua',
--${lua fDrawImage $HOME/.conky/teoRadio/teo.png 0 40 60 60 0}

};

conky.text = [[
${texeci 30 $HOME/.conky/teoRadio/teo_radio.sh}${image $HOME/.conky/teoRadio/images/case.png -p 0,0 -s 310x88}
${image $HOME/current_playing_thumb.jpg -p 18,12 -s 55x55}
#${goto 125}${execi 20 sed -n '1p' $HOME/temp | fold -s30}
#${execi 3 sed -n '1p' $HOME/current_playing}
${goto 125}${execi 30 sed -n '2p' $HOME/current_playing}
${goto 125}${execi 30 sed -n '3p' $HOME/current_playing}

]];

Thanks, Teo  smile

Offline

#1458 2021-02-27 14:23:12

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Show us your conky

Anytime buddy!


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1459 2021-02-27 19:36:49

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Show us your conky

unklar wrote:

but, can't I do that right now in your script

#!/bin/sh
exec 2>/dev/null
url="https://www.radioswisspop.ch/en"
curl -o image.jpg "$url/$(curl "$url" | xmllint --nonet --html --xpath "string(//div[@class=\"current-airplay\"]//div[@class=\"time-cover-w\"]/img/@src)" -)"

Fixed it for you.

Offline

#1460 2021-03-01 10:16:40

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,645

Re: Show us your conky

^Thanks!  smile

Offline

Board footer

Powered by FluxBB