You are not logged in.

#3261 2020-03-11 16:24:52

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

unklar wrote:

Here is the complete, current code for bl-lithium and the background image to play.

aaaaaaaaaaaaa  OK thank you.

unklar wrote:

But, you have to fix your moon script first. ;)

We are already older and have time, my friend.   :D

OH no wonder I could not see.  The darkness of a missing moon and ancient eyes.
(dirty glasses nop cleaned)

OK time to turn the moon on.

Hey you, MOON, get up there already will ya, we need the tides flowing!"

I start again ...


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3262 2020-03-11 16:28:14

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

First run after converting ... needs tweaking and a HUGE magnifying glass!
How do you see that unklar?

You mean the Conky or the Sreen?

With the Conky, the goal was to keep the thing very small.
Therefore monofur 8 and

minimum_size 180 00
maximum_width 180

finally the picture 185x720 (I assumed the "addition of a total of 12 lines)   big_smile

2020-03-11-17-55-36_scrot.th.png

Last edited by unklar (2020-03-11 16:58:35)

Offline

#3263 2020-03-11 21:23:16

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Guten Abend mein Freund unklar

unklar wrote:
Sector11 wrote:

First run after converting ... needs tweaking and a HUGE magnifying glass!
How do you see that unklar?

You mean the Conky or the Sreen?

The small text on  the conky, I need a magnifying glass.  big_smile

With the Conky, the goal was to keep the thing very small.

Well, it worked - it is smaller than small. ...  Now I just need to wait to see when the "yellow" squares show up.  Should be sometime after 18:00 here and it's 17:05 now.
2020-03-11-170202-S11.jpg

Interesting that your BL-Lithium conky (Debian 10) does not line up right on my Debian 10 install.  I needed "some" tweaking to get it to play right.

FIRST thing I did was make a new image: com-5-20.png it is 20 pixels wider and 20 pixels taller, transparent, with your image pasted into the centre - to help with the alignment of the conky text.  Gives it a 10 pixel transparent edge to play with,

And I call it into the conky like this:

${image /media/5/Conky/Weather_com_conky_script/com5-20.png -p -10,-10 -s 205x740}\

Notice the -10 offsets.

And then set the "inner border" and a "dashed border" to see the edge of the conky, the visible part of your image lines up perfectly with the stippled border conky edge:

draw_borders yes #no
stippled_borders 5
border_inner_margin 10
border_outer_margin 0
border_width 0

However it cause the conky to move away from the edge of the screen ... so another tweak:

## Gap between borders of screen and text
	gap_x -5	## ←|→
	gap_y 80	## ↑|↓

pushes it back to the edge of the screen quite nicely.

Alsosince things are set to be "10 pixels" from the edge the

${goto 160}

you had I changed to

${alignr 20}

Remember the wider image is offset a -10 and they there is the other transparent 10 pixels, so this sets all text in the WETTER section to align to the right nice like.

Here's the code with the red+x.png, green+x.png and yellow+x.png still in place

Oh and in the bottom part where you see TODAY and TONIGHT  get rid of the first ${goto} statement you have see my code:

## pkill -xf "conky -c /media/5/Conky/Weather_com_conky_script/unklar-1_1.9.conky" &

## https://forums.bunsenlabs.org/viewtopic.php?pid=1545#p1545
## after a design idea from 2015 by @Sector11
## https://forums.mageia.org/de/download/file.php?id=1352&mode=view
## @unklar 2020-03-10
## conky.config = {
## Create own window instead of using desktop (required in nautilus)
	background false## true
	own_window true
	own_window_type normal
	own_window_transparent true
	own_window_hints undecorated,below,skip_taskbar,skip_pager
	own_window_class Conky
## 	own_window_color 000000
## 	own_window_argb_visual true
## 	own_window_argb_value 200

## Use double buffering (reduces flicker may not work for everyone)
	double_buffer true
	no_buffers true

## fiddle with window
	use_spacer none ## rightleft
	use_xft true
	## font freesans -12
	xftalpha 1.0
	font monofur:size=8
	uppercase false

## Update interval in seconds
	update_interval 2 ## 1

## Minimum size of text area

minimum_size 185 720
maximum_width 185

	override_utf8_locale true

## Draw shades?
	draw_shades false ## true

## Text stuff
	draw_outline false ## true

draw_borders yes #no
stippled_borders 5
border_inner_margin 10
border_outer_margin 0
border_width 0

## Default colors and also border colors grey90 == #e5e5e5
	default_color ffffff
	color1 ffffff ## 949494
	color2 cyan
	color3 ed2323

## Text alignment other possible values are commented
## alignment top_left
	alignment top_right
## alignment bottom_left
## alignment bottom_right

## Gap between borders of screen and text
	gap_x -5	## ←|→
	gap_y 80	## ↑|↓

##imlib_cache_size 0
	imlib_cache_flush_interval 900
	max_user_text 48552

#${texeci 500 bash /media/5/Conky/Weather_com_conky_script/weather_com}


TEXT
${image /media/5/Conky/Weather_com_conky_script/com5-20.png -p -10,-10 -s 205x740}\
${color1}${voffset 4}${font monofur:size=12}${alignc 10}WETTER${color}
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/now.png -p 5,90 -s 40x40}${image /media/5/Conky/images/red+x.png -p 5,90 -s 40x40}\
${font monofur:size=10}${color1}${texeci 600 sed -n '1p' /media/5/Conky/Weather_com_conky_script/10days} ${color}${texeci 600 sed -n '1p' /media/5/Conky/Weather_com_conky_script/now}°C(${texeci 600 sed -n '3p' /media/5/Conky/Weather_com_conky_script/now}°C)
${font}${texeci 600 sed -n '19p' /media/5/Conky/Weather_com_conky_script/10days}
${goto 50}MOND${color}${alignr 20}${texeci 600 sed -n '17p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}${font}Hoch / Tief${color}${alignr 20}${texeci 600 sed -n '4p' /media/5/Conky/Weather_com_conky_script/now}° / ${texeci 600 sed -n '5p' /media/5/Conky/Weather_com_conky_script/now}°
${goto 50}${color1}WIND${color}${alignr 20}${texeci 600 sed -n '7p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}UV INDEX${color}${alignr 20}${texeci 600 sed -n '6p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Sonnenaufgang${color}${alignr 20}${texeci 600 sed -n '13p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Sonnenuntergang${color}${alignr 20}${texeci 600 sed -n '15p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Luftdruck${color}${alignr 20}${texeci 600 sed -n '10p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Mondaufgang${color}${alignr 20}${texeci 600 sed -n '19p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Monduntergang${color}${alignr 20}${texeci 600 sed -n '21p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Fernsicht${color}${alignr 20}${texeci 600 sed -n '11p' /media/5/Conky/Weather_com_conky_script/now}
${goto 50}${color1}Rel.Luftfeuchte${color}${alignr 20}${texeci 600 sed -n '8p' /media/5/Conky/Weather_com_conky_script/now} %
${goto 50}${color1}Taupunkt${color}${alignr 20}${texeci 600 sed -n '9p' /media/5/Conky/Weather_com_conky_script/now} °C
${color3}${swapbar 0,165}${color}
${image /media/5/Conky/images/bk-n-dots/white_1.png -p 90,202 -s 1x314}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h2.png -p 105,212 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,212 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h3.png -p 105,245 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,245 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h4.png -p 105,278 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,278 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h5.png -p 105,311 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,311 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h6.png -p 105,344 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,344 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h7.png -p 105,377 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,377 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h8.png -p 105,410 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,410 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h9.png -p 105,443 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,443 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/h10.png -p 105,476 -s 30x30}${image /media/5/Conky/images/red+x.png -p 105,476-s 30x30}\
${if_match "${texeci 600 sed -n '1p' /media/5/Conky/Weather_com_conky_script/10days}" == "Heute"}
${goto 60}${execi 3600 date  --date='1 day' '+%a %e'}${alignr}${tztime GMT-2 %H} h
${goto 55}${texeci 600 sed -n '71p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '3p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='2 day' '+%a %e'}${goto 150}${tztime GMT-3 %H} h
${goto 55}${texeci 600 sed -n '133p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '32p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='3 day' '+%a %e'}${goto 150}${tztime GMT-4 %H} h
${goto 55}${texeci 600 sed -n '195p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '61p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='4 day' '+%a %e'}${goto 150}${tztime GMT-5 %H} h
${goto 55}${texeci 600 sed -n '257p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '90p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='5 day' '+%a %e'}${goto 150}${tztime GMT-6 %H} h
${goto 55}${texeci 600 sed -n '319p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '119p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='6 day' '+%a %e'}${goto 150}${tztime GMT-7 %H} h
${goto 55}${texeci 600 sed -n '381p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '148p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='7 day' '+%a %e'}${goto 150}${tztime GMT-8 %H} h
${goto 55}${texeci 600 sed -n '443p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '177p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='8 day' '+%a %e'}${goto 150}${tztime GMT-9 %H} h
${goto 55}${texeci 600 sed -n '505p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '206p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 60}${execi 3600 date  --date='9 day' '+%a %e'}${goto 150}${tztime GMT-10 %H} h
${goto 55}${texeci 600 sed -n '567p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '235p' /media/5/Conky/Weather_com_conky_script/hourly}°
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d2.png -p 10,212 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,212 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d3.png -p 10,245 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,245 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d4.png -p 10,278 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,278 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d5.png -p 10,311 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,311 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d6.png -p 10,344 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,344 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d7.png -p 10,377 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,377 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d8.png -p 10,410 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,410 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d9.png -p 10,443 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,443 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d10.png -p 10,476 -s 30x30}${image /media/5/Conky/images/yellow+x.png -p 10,476 -s 30x30}\
hello ${color3}${swapbar 0,165}${color}
${goto 20}${font monofur:size=10}${texeci 600 sed -n '1p' /media/5/Conky/Weather_com_conky_script/10days}${font}
${goto 20}${texeci 600 sed -n '21p' /media/5/Conky/Weather_com_conky_script/10days | fold -s35}
${goto 20}${font monofur:size=10}${texeci 600 sed -n '32p' /media/5/Conky/Weather_com_conky_script/10days|tr a-z A-Z}${font}
${goto 20}${color}${texeci 600 sed -n '52p' /media/5/Conky/Weather_com_conky_script/10days | fold -s35}
${else}
${goto 50}${execi 3600 date  --date='1 day' '+%a %e'}${goto 150}${tztime GMT-2 %H} h
${goto 55}${texeci 600 sed -n '40p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '3p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='2 day' '+%a %e'}${goto 150}${tztime GMT-3 %H} h
${goto 55}${texeci 600 sed -n '133p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '32p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='3 day' '+%a %e'}${goto 150}${tztime GMT-4 %H} h
${goto 55}${texeci 600 sed -n '195p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '61p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='4 day' '+%a %e'}${goto 150}${tztime GMT-5 %H} h
${goto 55}${texeci 600 sed -n '257p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '90p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='5 day' '+%a %e'}${goto 150}${tztime GMT-6 %H} h
${goto 55}${texeci 600 sed -n '319p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '119p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='6 day' '+%a %e'}${goto 150}${tztime GMT-7 %H} h
${goto 55}${texeci 600 sed -n '381p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '148p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='7 day' '+%a %e'}${goto 150}${tztime GMT-8 %H} h
${goto 55}${texeci 600 sed -n '443p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '177p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='8 day' '+%a %e'}${goto 150}${tztime GMT-9 %H} h
${goto 55}${texeci 600 sed -n '505p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '206p' /media/5/Conky/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='9 day' '+%a %e'}${goto 150}${tztime GMT-10 %H} h
${goto 55}${texeci 600 sed -n '567p' /media/5/Conky/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '235p' /media/5/Conky/Weather_com_conky_script/hourly}°
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d2.png -p 10,212 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,212 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d3.png -p 10,245 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,245 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d4.png -p 10,278 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,278 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d5.png -p 10,311 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,311 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d6.png -p 10,344 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,344 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d7.png -p 10,377 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,377 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d8.png -p 10,410 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,410 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d9.png -p 10,443 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,443 -s 30x30}\
${image /media/5/Conky/Weather_com_conky_script/Forecast_Images/d10.png -p 10,476 -s 30x30}${image /media/5/Conky/images/green+x.png -p 10,476 -s 30x30}
${voffset -5}${color3}${swapbar 0,165}${color}
${font monofur:size=10}${texeci 600 sed -n '1p' /media/5/Conky/Weather_com_conky_script/10days|tr a-z A-Z}${font}
${texeci 600 sed -n '21p' /media/5/Conky/Weather_com_conky_script/10days | fold -s35}

${font monofur:size=10}${texeci 600 sed -n '32p' /media/5/Conky/Weather_com_conky_script/10days|tr a-z A-Z}${font}
${color}${texeci 600 sed -n '52p' /media/5/Conky/Weather_com_conky_script/10days | fold -s35}
${endif}

CHIMO!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3264 2020-03-12 11:14:57

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Good morning my friend!

I just discovered everything.  smile

unklar wrote:

I admit I was speculating that you might be able to take care of it. Who else is going to solve this mystery...


I didn't mean for you to take care of it right away. But I guess it made you really hot   big_smile  ]:D


I confess you live up to your name. I never would have thought of this solution in my young Conky life.
I want to thank you and your time

I'll be in touch, brilliant!   O:)

Offline

#3265 2020-03-12 16:48:20

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Teo I need your help..... 
I start 3 scripts like this in ~/.conkyrc :

TEXT
${execpi 900 /media/5/Conky/Accuweather_conky_script/accuweather -f2015 -h2015 -f2016 -h2016}\
${execpi 900 /media/5/Conky/Moongiant_conky_script/moongiant}\
${execpi 900 /media/5/Conky/Weather_com_conky_script/weather_com}\
${font LED_mono:size=34}${goto 12}${color1}88:88:88${goto 12}${color5}${time %T}${color}${font}
bla bla bla


accuweather
Trying to run the script in a terminal:

 12 Mar 20 @ 13:24:13 ~
   $ /media/5/Conky/Accuweather_conky_script/accuweather
Invalid arguments!
 
 12 Mar 20 @ 13:24:26 ~
   $ 

In "accuweather" is this line:

address="https://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"

Opening that link in a web browser and the info matches perfectly with what I see in the conky.

confusing as all get up and go.

next: moongiant

 12 Mar 20 @ 13:24:30 ~
   $ /media/5/Conky/Moongiant_conky_script/moongiant
 
 12 Mar 20 @ 13:24:34 ~
   $ 

works perfect...

last: weather_com

 12 Mar 20 @ 13:25:01 ~
   $ /media/5/Conky/Weather_com_conky_script/weather_com
rm: cannot remove '/media/5/Conky/Weather_com_conky_script/Forecast_Images/*.svg': No such file or directory
 
 12 Mar 20 @ 13:25:10 ~
   $ 

Tell me if you can help and what you might need and you got it.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3266 2020-03-12 16:59:20

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Just in case:

/media/5/Conky/Accuweather_conky_script/accuweather

#!/bin/bash

#########################################################################################
# Put the command that launches the conky configuration file that uses this script here #
#########################################################################################
#weather_conky_launch_command="conky -b"
weather_conky_launch_command="conky -c ~/.conkyrc"


#####################################
# Put your Accuweather address here #
#####################################
address="https://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"
#address="https://www.accuweather.com/en/us/hutto-tx/78634/weather-forecast/2110192"
#address="https://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
#address="https://www.accuweather.com/en/de/lichtenstein/09350/weather-forecast/171261"


#Pause weather conky
pkill -STOP -xf "$weather_conky_launch_command"

#function: test_image
test_image () {
    case $1 in
         1)
           echo a
         ;;
         2|3)
           echo b
         ;;
         4|5)
           echo c
         ;;
         6)
           echo d
         ;;
         7)
           echo e
         ;;
         8)
           echo f
         ;;
         11)
           echo 0
         ;;
         12)
           echo h
         ;;
         13|14)
           echo g
         ;;
         15)
           echo m
         ;;
         16|17)
           echo k
         ;;
         18)
           echo i
         ;;
         19)
           echo q
         ;;
         20|21|23)
           echo o
         ;;
         22)
           echo r
         ;;
         24|31)
           echo E
         ;;
         25)
           echo v
         ;;
         26)
           echo x
         ;;
         29)
           echo y
         ;;
         30)
           echo 5
         ;;
         32)
           echo 6
         ;;
         33)
           echo A
         ;;
         34|35)
           echo B
         ;;
         36|37)
           echo C
         ;;
         38)
           echo D
         ;;
         39|40)
           echo G
         ;;
         41|42)
           echo K
         ;;
         43|44)
           echo O
         ;;
         *)
		   echo -
		 ;;
        esac
}


############################
# Check the user arguments #
############################

if (( $# < 1 || $# > 15 )); then
	echo "Invalid arguments!"
	exit
fi

forecast0=0
forecast2015=0
forecast2016=0
hourly0=0
hourly2015=0
hourly2016=0
h_24hours=1
h_real=1
h_wind=1
h_rain=1
h_snow=1
h_ice=1
h_uv=1
h_cloud=1
h_humid=1
h_dew=1
h_visib=1

for i in $*
	do
		if [[ $i != -f && $i != -f2015 && $i != -f2016 && $i != -h && $i != -h2015 && $i != -h2016 && $i != -h_12h && $i != -h_no_real && $i != -h_no_wind && $i != -h_no_rain && $i != -h_no_snow && $i != -h_no_ice && $i != -h_no_uv && $i != -h_no_cloud && $i != -h_no_humid && $i != -h_no_dew && $i != -h_no_visib ]]; then
			echo "Invalid arguments!"
			exit
		fi
		case $i in
			-f)
				forecast0=1
			;;
			-f2015)
				forecast2015=1
			;;
			-f2016)
				forecast2016=1
			;;
			-h)
				hourly0=1
			;;
			-h2015)
				hourly2015=1
			;;
			-h2016)
				hourly2016=1
			;;
			-h_12h)
				h_24hours=0
			;;
			-h_no_real)
				h_real=0
			;;
			-h_no_wind)
				h_wind=0
			;;
			-h_no_rain)
				h_rain=0
			;;
			-h_no_snow)
				h_snow=0
			;;
			-h_no_ice)
				h_ice=0
			;;
			-h_no_uv)
				h_uv=0
			;;
			-h_no_cloud)
				h_cloud=0
			;;
			-h_no_humid)
				h_humid=0
			;;
			-h_no_dew)
				h_dew=0
			;;
			-h_no_visib)
				h_visib=0
			;;
		esac
	done

if [[ $forecast0 == 1 ]]; then
	forecast2015=0
	forecast2016=0
fi
if [[ $hourly0 == 1 ]]; then
	hourly2015=0
	hourly2016=0
fi


last_number=$(echo $address|sed 's/^.*\///')


#############################################################
# NORMAL FORECAST: -f, -f2015 or -f2016 passed as arguments #
#############################################################
if [[ $forecast0 == 1 || $forecast2015 == 1 || $forecast2016 == 1 ]]; then

	#function: convert_time
	convert_time ()
	{
		hours=$(echo $1|awk -F ":| " '{print $1}')
		minutes=$(echo $1|awk -F ":| " '{print $2}')
		am_or_pm=$(echo $1|awk -F ":| " '{print $3}')
		if [[ $am_or_pm == "" ]]; then
			echo $1
			return 0
		elif [[ $am_or_pm == AM ]]; then
			if (( $hours < 10 )); then
				hours_24=0$hours
			fi
			if (( $hours == 10 || $hours == 11 )); then
				hours_24=$hours
			fi
			if (( $hours == 12 )); then
				hours_24=00
			fi
		elif [[ $am_or_pm == PM ]]; then
			if (( $hours != 12 )); then
				hours_24=$((hours+12))
			fi
			if (( $hours == 12 )); then
				hours_24=12
			fi
		fi
		time_24=$hours_24:$minutes
		echo $time_24
	}

	#function: test_wind
	test_wind () {
	    case $1 in
	         CLM)
	           echo -
	         ;;
	         S)
	           echo 1
	         ;;
	         SSW)
	           echo 2
	         ;;
	         SW)
	           echo 3
	         ;;
	         WSW)
	           echo 4
	         ;;
	         W)
	           echo 5
	         ;;
	         WNW)
	           echo 6
	         ;;
	         NW)
	           echo 7
	         ;;
	         NNW)
	           echo 8
	         ;;
	         N)
	           echo 9
	         ;;
	         NNE)
	           echo :
	         ;;
	         NE)
	           echo ;
	         ;;
	         ENE)
	           echo \<
	         ;;
	         E)
	           echo =
	         ;;
	         ESE)
	           echo \>
	         ;;
	         SE)
	           echo ?
	         ;;
	         SSE)
	           echo @
	         ;;
	    esac
	}

	curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
	curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' -H 'Accept-Language: en-US,en;q=0.5' --compressed -o /media/5/Conky/Accuweather_conky_script/curr_cond_raw "$curr_addr"

	daily_addr="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' -H 'Accept-Language: en-US,en;q=0.5' --compressed -o /media/5/Conky/Accuweather_conky_script/daily_forecast "$daily_addr"

	if [[ $forecast2015 == 1 ]]; then
		rm /media/5/Conky/Accuweather_conky_script/forecast_2015/forecast_*.png
	fi
	if [[ $forecast2016 == 1 ]]; then
		rm /media/5/Conky/Accuweather_conky_script/forecast_2016/forecast_*.png
	fi

	#current conditions
	if [[ -s /media/5/Conky/Accuweather_conky_script/curr_cond_raw ]]; then
		sed '/conditions-card card panel conditions/,/class="card-button "/!d' /media/5/Conky/Accuweather_conky_script/curr_cond_raw > /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		sed -i -e '/\.svg"\|&#xB0\|phrase\|: /!d' -e '/style="transform: /d' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		sed -i -e 's/^.*weathericons\///' -e 's/\.svg.*$//' -e 's/&#xB0.*$//g' -e 's/^[ ,\t]*//g' -e 's/^.*phrase">//' -e 's/<\/div>//' -e 's/: /\n/g' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		sed -i -e '20s/\(.*\) /\1\n/' -e 's/ at /\n/g' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		sed -n 1,3p /media/5/Conky/Accuweather_conky_script/curr_cond_temp > /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 5p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 9,10p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 14p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 18p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 7p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 20p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		echo 'EMPTY LINE FOR COMPATIBILITY WITH THE OLD CONKYRC FILES' >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 16p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 22p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond

		moonrise=1
		moonset=1
		sed '/<div class="panel-1"><div class="sunrise">/,/<div class="temp-history">/!d' /media/5/Conky/Accuweather_conky_script/curr_cond_raw > /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		if (( $(grep '"section-header">Moonrise' /media/5/Conky/Accuweather_conky_script/curr_cond_temp|wc -l) == 0 )); then
			moonrise=0
		fi
		if (( $(grep '"section-header">Moonset' /media/5/Conky/Accuweather_conky_script/curr_cond_temp|wc -l) == 0 )); then
			moonset=0
		fi
		sed -i '/:[0-9][0-9]/!d' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		sed -i -e 's/^.*content">//g' -e 's/^[ ,\t]*//g' -e 's/<\/span>//g' -e 's/ hr//g' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		if (( $moonrise == 0 )); then
			sed -i '3s/$/\n-/' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
			sed -i '5s/$/\n-/' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		fi
		if (( $moonset == 0 )); then
			sed -i '4s/$/\n-/' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
			sed -i '5s/$/\n-/' /media/5/Conky/Accuweather_conky_script/curr_cond_temp
		fi
		sed -n 1,3p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		echo 'EMPTY LINE FOR COMPATIBILITY WITH THE OLD CONKYRC FILES' >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sed -n 4,6p /media/5/Conky/Accuweather_conky_script/curr_cond_temp >> /media/5/Conky/Accuweather_conky_script/curr_cond
		echo 'EMPTY LINE FOR COMPATIBILITY WITH THE OLD CONKYRC FILES' >> /media/5/Conky/Accuweather_conky_script/curr_cond
		rm /media/5/Conky/Accuweather_conky_script/curr_cond_temp

	    image=$(sed -n 1p /media/5/Conky/Accuweather_conky_script/curr_cond)
	    echo $(test_image $image) >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sunrise_time=$(sed -n 14p /media/5/Conky/Accuweather_conky_script/curr_cond)
		echo $(convert_time "$sunrise_time") >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sunrise_time=$(sed -n 15p /media/5/Conky/Accuweather_conky_script/curr_cond)
		echo $(convert_time "$sunrise_time") >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sunrise_time=$(sed -n 18p /media/5/Conky/Accuweather_conky_script/curr_cond)
		echo $(convert_time "$sunrise_time") >> /media/5/Conky/Accuweather_conky_script/curr_cond
		sunrise_time=$(sed -n 19p /media/5/Conky/Accuweather_conky_script/curr_cond)
		echo $(convert_time "$sunrise_time") >> /media/5/Conky/Accuweather_conky_script/curr_cond
		wind=$(sed -n 5p /media/5/Conky/Accuweather_conky_script/curr_cond)
		echo $(test_wind $wind) >> /media/5/Conky/Accuweather_conky_script/curr_cond
        if (( $(sed -n 14p /media/5/Conky/Accuweather_conky_script/curr_cond|wc -c) == 8 )); then
			sed -i '14s/^/0/' /media/5/Conky/Accuweather_conky_script/curr_cond
		fi
		if (( $(sed -n 15p /media/5/Conky/Accuweather_conky_script/curr_cond|wc -c) == 8 )); then
			sed -i '15s/^/0/' /media/5/Conky/Accuweather_conky_script/curr_cond
		fi
		if (( $(sed -n 18p /media/5/Conky/Accuweather_conky_script/curr_cond|wc -c) == 8 )); then
			sed -i '18s/^/0/' /media/5/Conky/Accuweather_conky_script/curr_cond
		fi
		if (( $(sed -n 19p /media/5/Conky/Accuweather_conky_script/curr_cond|wc -c) == 8 )); then
			sed -i '19s/^/0/' /media/5/Conky/Accuweather_conky_script/curr_cond
		fi
	    if [[ $forecast2015 == 1 ]]; then
			cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2015/$(sed -n 1p /media/5/Conky/Accuweather_conky_script/curr_cond).png /media/5/Conky/Accuweather_conky_script/forecast_2015/forecast_0.png
			cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2015/$(sed -n 5p /media/5/Conky/Accuweather_conky_script/curr_cond).png /media/5/Conky/Accuweather_conky_script/forecast_2015/wind_0.png
		fi
		if [[ $forecast2016 == 1 ]]; then
			cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2016/$(sed -n 1p /media/5/Conky/Accuweather_conky_script/curr_cond).png /media/5/Conky/Accuweather_conky_script/forecast_2016/forecast_0.png
			cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2016/$(sed -n 5p /media/5/Conky/Accuweather_conky_script/curr_cond).png /media/5/Conky/Accuweather_conky_script/forecast_2016/wind_0.png
		fi
	fi

	#Daily forecast
	if [[ -s /media/5/Conky/Accuweather_conky_script/daily_forecast ]]; then
		sed -i '/forecast-list-card forecast-card  today/,/card-button centered nav-card next/!d' /media/5/Conky/Accuweather_conky_script/daily_forecast
		sed -i -e 's/^.*weathericons\///g' -e 's/\.svg.*$//g' -e 's/^.*high"> //g' -e 's/^.*low"> \/ //g' -e 's/&#xB0;.*$//g' -e 's/^.*<p>//g' -e 's/<\/p>.*$//g' -e '/<\|>\|class\|href/d' -e 's/^ \|\t*//g' -e '/^$/d' -e '/Precip/d' -e 's/Sun$/Sunday/g' -e 's/Mon$/Monday/g' -e 's/Tue$/Tuesday/g' -e 's/Wed$/Wednesday/g' -e 's/Thu$/Thursday/g' -e 's/Fri$/Friday/g' -e 's/Sat$/Saturday/g' /media/5/Conky/Accuweather_conky_script/daily_forecast
		sed -i '106,$d' /media/5/Conky/Accuweather_conky_script/daily_forecast
		for (( i=3; i<=101; i+=7 ))
		  do
	          image=$(sed -n "${i}"p /media/5/Conky/Accuweather_conky_script/daily_forecast)
	          echo $(test_image $image) >> /media/5/Conky/Accuweather_conky_script/daily_forecast
		  done
		if [[ $forecast0 == 0 ]]; then
			j=1
			for (( i=3; i<=101; i+=7 ))
			  do
				if [[ $forecast2015 == 1 ]]; then
					cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2015/$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/daily_forecast).png /media/5/Conky/Accuweather_conky_script/forecast_2015/forecast_$j.png
				fi
				if [[ $forecast2016 == 1 ]]; then
					cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2016/$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/daily_forecast).png /media/5/Conky/Accuweather_conky_script/forecast_2016/forecast_$j.png
				fi
				((j++))
			  done
		fi
	fi
fi


#############################################################
# HOURLY FORECAST: -h, -h2015 or -h2016 passed as arguments #
#############################################################

if [[ $hourly0 == 1 || $hourly2015 == 1 || $hourly2016 == 1 ]]; then

	#Hourly: 24h

	if [[ $hourly2015 == 1 ]]; then
		rm /media/5/Conky/Accuweather_conky_script/hourly_2015/hourly_*.png
	fi
	if [[ $hourly2016 == 1 ]]; then
		rm /media/5/Conky/Accuweather_conky_script/hourly_2016/hourly_*.png
	fi

	hourly_addr1="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"
	hourly_addr2="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"?day=2
	curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' -H 'Accept-Language: en-US,en;q=0.5' --compressed -o /media/5/Conky/Accuweather_conky_script/hourly_raw1 "$hourly_addr1"
	curl -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0' -H 'Accept-Language: en-US,en;q=0.5' --compressed -o /media/5/Conky/Accuweather_conky_script/hourly_raw2 "$hourly_addr2"

	if [[ -s /media/5/Conky/Accuweather_conky_script/hourly_raw1 && -s /media/5/Conky/Accuweather_conky_script/hourly_raw2 ]]; then
		sed -i '/<div class=\"hourly-wrapper\">/,/day=/!d' /media/5/Conky/Accuweather_conky_script/hourly_raw1
		sed -i -e 's/\.svg.*$//g' -e 's/^.*weathericons\///g' -e '/div\|=/d' -e 's/<p>/<p>\n/g' -e 's/<\/p>/\n<\/p>/g' /media/5/Conky/Accuweather_conky_script/hourly_raw1
		sed -i -e '/<\|>/d' -e '/^[ ,\t]*$/d' -e 's/^[ ,\t]*//g' -e 's/&#xB0;//g' -e 's/ km\/h//g' -e 's/ mph//g' -e 's/ (/\n/g' -e 's/)//g' /media/5/Conky/Accuweather_conky_script/hourly_raw1

		sed -i '/<div class=\"hourly-wrapper\">/,/day=/!d' /media/5/Conky/Accuweather_conky_script/hourly_raw2
		sed -i -e 's/\.svg.*$//g' -e 's/^.*weathericons\///g' -e '/div\|=/d' -e 's/<p>/<p>\n/g' -e 's/<\/p>/\n<\/p>/g' /media/5/Conky/Accuweather_conky_script/hourly_raw2
		sed -i -e '/<\|>/d' -e '/^[ ,\t]*$/d' -e 's/^[ ,\t]*//g' -e 's/&#xB0;//g' -e 's/ km\/h//g' -e 's/ mph//g' -e 's/ (/\n/g' -e 's/)//g' /media/5/Conky/Accuweather_conky_script/hourly_raw2
		cat /media/5/Conky/Accuweather_conky_script/hourly_raw1 /media/5/Conky/Accuweather_conky_script/hourly_raw2 > /media/5/Conky/Accuweather_conky_script/hourly

		sed -i '769,$d' /media/5/Conky/Accuweather_conky_script/hourly

		for (( i=3; i<=768; i+=32 ))
		  do
	          image=$(sed -n "${i}"p /media/5/Conky/Accuweather_conky_script/hourly)
	          echo $(test_image $image) >> /media/5/Conky/Accuweather_conky_script/hourly
		  done
		if [[ $hourly0 == 0 ]]; then
			j=1
			for (( i=3; i<=768; i+=32 ))
			  do
		    	if [[ $hourly2015 == 1 ]]; then
					cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2015/$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly).png /media/5/Conky/Accuweather_conky_script/hourly_2015/hourly_$j.png
				fi
				if [[ $hourly2016 == 1 ]]; then
					cp /media/5/Conky/Accuweather_conky_script/Forecast_Images_2016/$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly).png /media/5/Conky/Accuweather_conky_script/hourly_2016/hourly_$j.png
				fi
		    	((j++))
			  done
		fi
	fi


	# Full info, next 24h - altogether24 file
	rm /media/5/Conky/Accuweather_conky_script/{altogether24,altogether24_2015,altogether24_2016}

	#TIME
	echo "\${color1}TIME\${goto 100}$(sed -n 1p /media/5/Conky/Accuweather_conky_script/hourly)" > /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=160
	for (( i=33; i<=384; i+=32 ))
		do
			time=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "1s/$/\${goto $jump_to}$time/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=385; i<=768; i+=32 ))
			do
				time=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "1s/$/\${goto $jump_to}$time/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	sed -i '1s/$/\n\n\n/' /media/5/Conky/Accuweather_conky_script/altogether24

	#FORECAST
	echo "\${color1}FORECAST\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=5; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly|awk '{print $1}'|cut -c1-8)
			sed -i "5s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=389; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly|awk '{print $1}'|cut -c1-8)
				sed -i "5s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi
	sed -i '5s/$/\n/' /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=5; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly|awk '{print $2}'|cut -c1-8)
			sed -i "6s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=389; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly|awk '{print $2}'|cut -c1-8)
				sed -i "6s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#TEMPERATURE
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "TEMPER.\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=4; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "8s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=388; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "8s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#REAL FEEL
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "REAL FEEL\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=9; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "10s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=393; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "10s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#WIND
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "WIND\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=11; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "12s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=395; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "12s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#RAIN
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "RAIN\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=24; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "14s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=408; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "14s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#SNOW
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "SNOW\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=26; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "16s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=410; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "16s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#ICE
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "ICE\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=28; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "18s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=412; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "18s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#UV INDEX
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "UV INDEX\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=19; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "20s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=403; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "20s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#CLOUD COVER
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "CLOUD COV.\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=22; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "22s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=406; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "22s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#HUMIDITY
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "HUMIDITY\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=15; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "24s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=399; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "24s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#DEW POINT
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "DEW POINT\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=17; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "26s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=401; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "26s/$/\${goto $jump_to}$messg°/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#VISIBILITY
	echo "\${color1}\${goto 100}\${hr 1}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	echo "VISIBILITY\${color}" >> /media/5/Conky/Accuweather_conky_script/altogether24
	jump_to=100
	for (( i=30; i<=384; i+=32 ))
		do
			messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
			sed -i "28s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
			((jump_to+=60))
		done
	if [[ $h_24hours == 1 ]]; then
		for (( i=414; i<=768; i+=32 ))
			do
				messg=$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)
				sed -i "28s/$/\${goto $jump_to}$messg/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
	fi

	#IMAGES
	if [[ $hourly0 == 0 ]]; then
		if [[ $hourly2015 == 1 ]]; then
					jump_to=75
					cp /media/5/Conky/Accuweather_conky_script/altogether24 /media/5/Conky/Accuweather_conky_script/altogether24_2015
		fi
		if [[ $hourly2016 == 1 ]]; then
					jump_to=85
					cp /media/5/Conky/Accuweather_conky_script/altogether24 /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
		rm /media/5/Conky/Accuweather_conky_script/altogether24
		hours=$((12+$h_24hours*12))
		for (( i=1; i<=$hours; i+=1 ))
			do
				if [[ $hourly2015 == 1 ]]; then
					sed -i "4s/$/\${image \/media/5/Conky\/Accuweather_conky_script\/hourly_2015\/hourly_$i.png -s 60x36 -p $jump_to,49}/" /media/5/Conky/Accuweather_conky_script/altogether24_2015
				fi
				if [[ $hourly2016 == 1 ]]; then
					sed -i "4s/$/\${image \/media/5/Conky\/Accuweather_conky_script\/hourly_2016\/hourly_$i.png -s 36x36 -p $jump_to,49}/" /media/5/Conky/Accuweather_conky_script/altogether24_2016
				fi
				((jump_to+=60))
			done
	fi

	#CONKYFONT
	if [[ $hourly0 == 1 ]]; then
		sed -i '4s/$/\${color}\${font conkyweather:size=35}/' /media/5/Conky/Accuweather_conky_script/altogether24
		jump_to=95
		for (( i=769; i<=780; i+=1 ))
			do
				sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)/" /media/5/Conky/Accuweather_conky_script/altogether24
				((jump_to+=60))
			done
		if [[ $h_24hours == 1 ]]; then
			for (( i=781; i<=792; i+=1 ))
				do
					sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p /media/5/Conky/Accuweather_conky_script/hourly)/" /media/5/Conky/Accuweather_conky_script/altogether24
					((jump_to+=60))
				done
		fi
		sed -i '4s/$/\${font}/' /media/5/Conky/Accuweather_conky_script/altogether24
		sed -i '2,3d' /media/5/Conky/Accuweather_conky_script/altogether24
	fi

	#DELETE UNWANTED VARIABLES
	if [[ $h_real == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '7,8s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_wind == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_rain == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_snow == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi


	if [[ $h_ice == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi


	if [[ $h_uv == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_cloud == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_humid == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_dew == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	if [[ $h_visib == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '27,28s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '27,28s/^.*$/VOID/' /media/5/Conky/Accuweather_conky_script/altogether24_2016
		fi
	fi

	sed -i '/VOID/d' /media/5/Conky/Accuweather_conky_script/{altogether24,altogether24_2015,altogether24_2016}

fi

#Resume weather conky
pkill -CONT -xf "$weather_conky_launch_command"

=====================================
Also would it not be easier to have all of these:

/media/5/Conky/Accuweather_conky_script

setup as a variable:

thefiles="/media/5/Conky/Accuweather_conky_script"

EXAMPLE:

		sed -i '/:[0-9][0-9]/!d' $thefiles/curr_cond_temp
		sed -i -e 's/^.*content">//g' -e 's/^[ ,\t]*//g' -e 's/<\/span>//g' -e 's/ hr//g' $thefiles/curr_cond_temp
		if (( $moonrise == 0 )); then
			sed -i '3s/$/\n-/' $thefiles/curr_cond_temp
			sed -i '5s/$/\n-/' $thefiles/curr_cond_temp
		fi
		if (( $moonset == 0 )); then
			sed -i '4s/$/\n-/' $thefiles/curr_cond_temp
			sed -i '5s/$/\n-/' $thefiles/curr_cond_temp

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3267 2020-03-12 18:37:28

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sorry for being late guys, lot of work the last couple of days...

unklar wrote:

Teo,  smile
can you possibly conky "brake"?

Conky is just too fast for the work of your script.
I notice this again and again especially at the start of Conky and the changes of "Today", "Tonight", "Tomorrow" etc. The complete data is only available at the second run.
So, after 8.333333... minutes.

Please, it's just a question to your expertise.   cool

I'm well aware of this unklar and I admit that I have yet to find a solution. It happens to me as well.
It's a nuisance, especially on the first run when you have to wait until the first conky update to see a full conky, but I've grown accustomed to it.
I'll try to investigate it a bit more, you know what they say, once you get used to it it doesn't bother you any more.
So it's good that you remind me that it's a real problem...

@S11
When you run the accuweather script on your terminal without any arguments it will return the error code you get.
Otherwise, I don't see any problem with your scripts, everything should work fine.

As for the path being setup in a variable, this would totally break git I think, you know, whenever you update.


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

#3268 2020-03-12 22:11:04

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Hello, my friend Sector11,
Hello, El Conkystador  O:)

with great pleasure I can tell you, a splendid weather conky has been created. Thanks to your excellent ideas, I was able to complete the work without any problems. It was really not difficult because of your preparations. clapping.gif
I thank you!

CHIMO!

2020-03-12-20-27-18_scrot.th.png 2020-03-12-20-26-51_scrot.th.png

BL-Weather.com  wink

-- https://forums.bunsenlabs.org/viewtopic.php?pid=1545#p1545
-- after a design idea from 2015 by @Sector11
-- https://forums.mageia.org/de/download/file.php?id=1352&mode=view
-- @unklar 2020-03-10
conky.config = {
-- Create own window instead of using desktop (required in nautilus)
	background = false,--true,
	own_window = true,
	own_window_type = 'normal',
	own_window_transparent = true,
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
	own_window_class = 'Conky',
--	own_window_color = '000000',
--	own_window_argb_visual = true,
--	own_window_argb_value = 200,

-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,
	no_buffers = true,

-- fiddle with window
	use_spacer = 'none', --right',left',
	use_xft = true,
	xftalpha = 1.0,
	font = 'monofur:size=8',
	uppercase = false,

-- Update interval in seconds
	update_interval = 1, --1,

-- Minimum size of text area
	minimum_width = 205, minimum_height = 740,
	maximum_width = 205,

	override_utf8_locale = true,

	draw_shades = false, --true,
	draw_outline = false, --true,
	draw_borders = false,
	stippled_borders = 0,
	draw_graph_borders = false,
	border_inner_margin = 10,
	border_outer_margin = 0,
	border_width = 0,

-- Default colors and also border colors, grey90 == #e5e5e5
	default_color = 'ffffff',
	color1 = 'ffffff', --949494',
	color2 = 'cyan',
	color3 = 'ed2323',

-- Text alignment, other possible values are commented
--alignment top_left
	alignment = 'top_right',
--alignment bottom_left
--alignment bottom_right

-- Gap between borders of screen and text
	gap_x = -5, -- ←|→
	gap_y = 80, -- ↑|↓

--imlib_cache_size = 0,
	imlib_cache_flush_interval = 900,
	max_user_text = 48552,

};

conky.text = [[${image $HOME/bin/com5-20.png -p -10,-10 -s 205x740}\
${color1}${voffset -6}${font monofur:size=12}${alignc 20}WETTER ${color}${texeci 500 bash $HOME/Weather_com_conky_script/weather_com}
${image $HOME/Weather_com_conky_script/Forecast_Images/now.png -p 5,90 -s 40x40}\
${font monofur:size=10}${color1}${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/10days} ${color}${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/now}°C(${texeci 600 sed -n '3p' $HOME/Weather_com_conky_script/now}°C)
${font}${texeci 600 sed -n '19p' $HOME/Weather_com_conky_script/10days}
${goto 50}MOND${color}${alignr 40} ${texeci 600 sed -n '17p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}${font}Hoch / Tief${color}${alignr 40} ${texeci 600 sed -n '4p' $HOME/Weather_com_conky_script/now}° / ${texeci 600 sed -n '5p' $HOME/Weather_com_conky_script/now}°
${goto 50}${color1}WIND${color}${alignr 40} ${texeci 600 sed -n '7p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}UV INDEX${color}${alignr 40} ${texeci 600 sed -n '6p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Sonnenaufgang${color}${alignr 40} ${texeci 600 sed -n '13p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Sonnenuntergang${color}${alignr 40} ${texeci 600 sed -n '15p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Luftdruck${color}${alignr 40} ${texeci 600 sed -n '10p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Mondaufgang${color}${alignr 40} ${texeci 600 sed -n '19p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Monduntergang${color}${alignr 40} ${texeci 600 sed -n '21p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Fernsicht${color}${alignr 40} ${texeci 600 sed -n '11p' $HOME/Weather_com_conky_script/now}
${goto 50}${color1}Rel.Luftfeuchte${color}${alignr 40} ${texeci 600 sed -n '8p' $HOME/Weather_com_conky_script/now} %
${goto 50}${color1}Taupunkt${color}${alignr 40} ${texeci 600 sed -n '9p' $HOME/Weather_com_conky_script/now} °C
${color3}${swapbar 0,165}${color}
${image $HOME/1_pixel_images/white_1.png -p 90,202 -s 1x335}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h2.png -p 105,210 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h3.png -p 105,252 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h4.png -p 105,288 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h5.png -p 105,325 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h6.png -p 105,360 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h7.png -p 105,400 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h8.png -p 105,435 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h9.png -p 105,470 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/h10.png -p 105,505 -s 30x30}\
${if_match "${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/10days}" == "Heute"}
${goto 50}${execi 3600 date  --date='1 day' '+%a. %e'}${goto 160}${tztime GMT-2 %H} h
${goto 45}${texeci 600 sed -n '71p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '3p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='2 day' '+%a. %e'}${goto 150}${tztime GMT-3 %H} h
${goto 45}${texeci 600 sed -n '133p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '32p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='3 day' '+%a. %e'}${goto 150}${tztime GMT-4 %H} h
${goto 45}${texeci 600 sed -n '195p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '61p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='4 day' '+%a. %e'}${goto 150}${tztime GMT-5 %H} h
${goto 45}${texeci 600 sed -n '257p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '90p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='5 day' '+%a. %e'}${goto 150}${tztime GMT-6 %H} h
${goto 45}${texeci 600 sed -n '319p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '119p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='6 day' '+%a. %e'}${goto 150}${tztime GMT-7 %H} h
${goto 45}${texeci 600 sed -n '381p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '148p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='7 day' '+%a. %e'}${goto 150}${tztime GMT-8 %H} h
${goto 45}${texeci 600 sed -n '443p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '177p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='8 day' '+%a. %e'}${goto 150}${tztime GMT-9 %H} h
${goto 45}${texeci 600 sed -n '505p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '206p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='9 day' '+%a. %e'}${goto 150}${tztime GMT-10 %H} h
${goto 45}${texeci 600 sed -n '567p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '235p' $HOME/Weather_com_conky_script/hourly}°
${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 10,210 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 10,252 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 10,288 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 10,325 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 10,360 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 10,400 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d8.png -p 10,435 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d9.png -p 10,470 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d10.png -p 10,505 -s 30x30}\
${color3}${swapbar 0,165}${color}
${font monofur:size=10}${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/10days}${font}
${texeci 600 sed -n '21p' $HOME/Weather_com_conky_script/10days | fold -s35}
${font monofur:size=10}${texeci 600 sed -n '32p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z}${font}
${color}${texeci 600 sed -n '52p' $HOME/Weather_com_conky_script/10days | fold -s35}
${else}
${goto 50}${execi 3600 date  --date='1 day' '+%a. %e'}${goto 150}${tztime GMT-2 %H} h
${goto 45}${texeci 600 sed -n '40p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '3p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='2 day' '+%a. %e'}${goto 150}${tztime GMT-3 %H} h
${goto 45}${texeci 600 sed -n '133p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '32p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='3 day' '+%a. %e'}${goto 150}${tztime GMT-4 %H} h
${goto 45}${texeci 600 sed -n '195p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '61p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='4 day' '+%a. %e'}${goto 150}${tztime GMT-5 %H} h
${goto 45}${texeci 600 sed -n '257p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '90p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='5 day' '+%a. %e'}${goto 150}${tztime GMT-6 %H} h
${goto 45}${texeci 600 sed -n '319p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '119p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='6 day' '+%a. %e'}${goto 150}${tztime GMT-7 %H} h
${goto 45}${texeci 600 sed -n '381p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '148p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='7 day' '+%a. %e'}${goto 150}${tztime GMT-8 %H} h
${goto 45}${texeci 600 sed -n '443p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '177p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='8 day' '+%a. %e'}${goto 150}${tztime GMT-9 %H} h
${goto 45}${texeci 600 sed -n '505p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '206p' $HOME/Weather_com_conky_script/hourly}°
${color1}${swapbar 0,165}
${goto 50}${execi 3600 date  --date='9 day' '+%a. %e'}${goto 150}${tztime GMT-10 %H} h
${goto 45}${texeci 600 sed -n '567p' $HOME/Weather_com_conky_script/10days}°${goto 150}${texeci 600 sed -n '235p' $HOME/Weather_com_conky_script/hourly}°
${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 10,210 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 10,252 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 10,288 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 10,325 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 10,360 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 10,400 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d8.png -p 10,435 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d9.png -p 10,470 -s 30x30}\
${image $HOME/Weather_com_conky_script/Forecast_Images/d10.png -p 10,505 -s 30x30}\
${color3}${swapbar 0,165}${color}
${font monofur:size=10}${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/10days}${font}
${texeci 600 sed -n '21p' $HOME/Weather_com_conky_script/10days | fold -s35}
${font monofur:size=10}${texeci 600 sed -n '32p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z}${font}
${color}${texeci 600 sed -n '52p' $HOME/Weather_com_conky_script/10days | fold -s35}
${endif}

]];

Offline

#3269 2020-03-12 22:23:50

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:

...
So it's good that you remind me that it's a real problem...

Thanks Teo, for your clear opinion. I will always be here if you need a tester.   wink


Sector11 wrote:

last: weather_com

 12 Mar 20 @ 13:25:01 ~
   $ /media/5/Conky/Weather_com_conky_script/weather_com
rm: cannot remove '/media/5/Conky/Weather_com_conky_script/Forecast_Images/*.svg': No such file or directory
 
 12 Mar 20 @ 13:25:10 ~
   $ 

Tell me if you can help and what you might need and you got it.

This is related to the problem mentioned above. Conky is (still) too fast for Teo's script.  big_smile

Offline

#3270 2020-03-14 00:43:01

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

try this my friend open synaptic serch inxscape click and mark recommended for installation python-scour do the same to imagemagick-6.q16 install libmagickcore-6.q16-6-extra....

Offline

#3271 2020-03-14 18:26:54

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:

Sorry for being late guys, lot of work the last couple of days...

I was going into panic mode here.

I had inadvertently turned off notifications.

I was thinking CV-19 got Teo. PANIC  My friend ... MORE PANIC ....

SOOOOOOOOOOOO glad to see you.

Work is good - Work is Great news!

Now let me continue about conky stuff and read the rest now that the priorities are out of the way.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3272 2020-03-14 18:49:17

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

@ unklar

Der Konkystador und Freund unklar

Awesome ... so glad I could help.
Had to use a combination of tricks picked up from other problems.
They worked quite well together, so believe me, it was my pleasure.
I learned as I tested and tweaked things for that conky.

CHIMO!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3273 2020-03-14 19:34:15

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:

@S11
When you run the accuweather script on your terminal without any arguments it will return the error code you get.
Otherwise, I don't see any problem with your scripts, everything should work fine.

Face palm!  DUH!

Of course I knew that I just forgot I knew that!

As for the path being setup in a variable, this would totally break git I think, you know, whenever you update.

Well, it would break mine anyway as I put them in /media/5/Conky/

So would would it hurt to that in my scripts?
Any script or place it will not work that you can think of?

let's face it:

accufiles="/media/5/Conky/Accuweather_conky_script"

		sed '/conditions-card card panel conditions/,/class="card-button "/!d' /media/5/Conky/Accuweather_conky_script/curr_cond_raw > /media/5/Conky/Accuweather_conky_script/curr_cond_temp

		sed '/conditions-card card panel conditions/,/class="card-button "/!d' $accufiles/curr_cond_raw > $accufiles/curr_cond_temp

makes for shorter cleaner line - see the second line.

Plus I have to rename the directory anyway from:

/media/5/Conky/Accuweather_conky_script_master/

to

/media/5/Conky/Accuweather_conky_script/

to match the code in the script:

$HOME/Accuweather_conky_script/curr_cond

so:
accufiles
moonfiles
wcomfiles

see a natural for me.

You know me, I gotta be different  big_smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3274 2020-03-14 19:43:59

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

unklar wrote:
TeoBigusGeekus wrote:

...
So it's good that you remind me that it's a real problem...

Thanks Teo, for your clear opinion. I will always be here if you need a tester.   wink


Sector11 wrote:

last: weather_com

 12 Mar 20 @ 13:25:01 ~
   $ /media/5/Conky/Weather_com_conky_script/weather_com
rm: cannot remove '/media/5/Conky/Weather_com_conky_script/Forecast_Images/*.svg': No such file or directory
 
 12 Mar 20 @ 13:25:10 ~
   $ 

Tell me if you can help and what you might need and you got it.

This is related to the problem mentioned above. Conky is (still) too fast for Teo's script.  big_smile

OH   OK ....  I wait for Master Teo and his Script-Fu  big_smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3275 2020-03-14 23:50:25

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

I was thinking CV-19 got Teo. PANIC  My friend ... MORE PANIC ....
SOOOOOOOOOOOO glad to see you.

I'm hale and hearty, at least for now; if CV-19 is a plot from accuweather to get rid of me, it's failed miserably.

As for the script, it's a matter of the webpages that take a long time to download.
This is not an easy one, conky behaves differently when paused by the pkill command and when running for the first time at boot up.


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

#3276 2020-03-16 13:08:30

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:
Sector11 wrote:

I was thinking CV-19 got Teo. PANIC  My friend ... MORE PANIC ....
SOOOOOOOOOOOO glad to see you.

I'm hale and hearty, at least for now; if CV-19 is a plot from accuweather to get rid of me, it's failed miserably.

That's a given actually, if one stops and thinks about it.  Look at all the times these sites have laid out trap for you.  You always figure them out..

As for the script, it's a matter of the webpages that take a long time to download.
This is not an easy one, conky behaves differently when paused by the pkill command and when running for the first time at boot up.

OK as we all know I am not a programmer but I am an idea guy so let toss out an idea.

Your scripts end with this:

#################
pkill -CONT -xf "$weather_conky_launch_command"

delay the restarting conky IF the uptime is less than 2|3 minutes

#################
start loop
if "uptime" < 2 min ; goto start loop
exit loop
pkill -CONT -xf "$weather_conky_launch_command"

I'd be a months pension check you know how you can do that

OR maybe remove the "rm" commands from the script giving conky "something to read while the script is updating - old stuff on first run - then at the end of your scripts:

pkill -STOP -xf "$weather_conky_launch_command" ; sleep 2 ; pkill -CONT -xf "$weather_conky_launch_command"

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3277 2020-03-16 22:06:10

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Something like this was my initial thought, ie. check

/proc/uptime

for the, well, uptime...
and delete the now, 10days and hourly files, as well as the pngs and svgs in the Forecast_Images folder, only if the pc has been running for more than 300sec or whatever.
But this would only solve the problem partially, as the images and forecast would still disappear for a few seconds between conky updates.

So, I tried the following and it works, but I had to sacrifice cleaning up the files and the images:
Delete the lines that clean up the now, hourly and 10days files, as well as the forecast images, before new files and images are created by the script

#!/usr/bin/env bash


#########################################################################################
# Put the command that launches the conky configuration file that uses this script here #
#########################################################################################
weather_conky_launch_command="conky -b"


#########################################################################################################
# Put your language's interpretation of today, tenday and hourly - as shown in weather.com's url - here #
# Example for German:														   	   					    #
#     today=heute																						#
#     tenday=10tage																						#
#     hourly=stundlich                                                                                  #	
# Example for French:																					#
#     today=aujour																						#
#     tenday=10jours																					#
#     hourly=parheure																					#
# etc., you get the idea																				#
#########################################################################################################
today=today
tenday=tenday
hourly=hourbyhour


###############################################################################################################################
# Put your Weather.com address here, add en-GB between weather.com and weather for metric. You can use any language you want. #
###############################################################################################################################
#address="https://weather.com/weather/today/l/USHI0026:1:US"
address="https://weather.com/en-GB/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/en-GB/weather/today/l/ARBA0009:1:AR"
#address="https://weather.com/de-LI/wetter/heute/l/6f62e1be6a5f0d36914ae9eab7c3aedbbec5b5c6e0946c3fe6069a94435fc196"
#address="https://weather.com/el-GR/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/de-DE/wetter/heute/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/fr-FR/temps/aujour/l/0121bf9710ae35daa414ce903453d12358ddc10bee696b17d1f973fafc5260c4"


##########################
# Function: colorize_svg #
##########################
colorize_svg () {
    sed -i -e 's/var(--color-cloud)/#fff/g' -e 's/var(--color-star)/#fff/g' -e 's/var(--color-wind)/#fff/g' -e 's/var(--color-fog)/#fff/g' -e 's/var(--color-moon)/#e6e6e6/g' -e 's/var(--color-lightning)/#f2df00/g' -e 's/var(--color-drop)/#6ec4e9/g' -e 's/var(--color-sun)/#f9ed32/g' -e 's/var(--color-snowflake)/#fff/g' -e 's/var(--color-hail)/#fff/g' -e 's/var(--color-sun-center)/#f9ed32/g' -e 's/var(--color-sun-ray)/#f9ed32/g' $1
}


#######################
# Pause weather conky #
#######################
pkill -STOP -xf "$weather_conky_launch_command"


#######
# Now #
#######
wget -o /dev/null -O $HOME/Weather_com_conky_script/now_raw $address
sed '/\(<span>as of\)\|\(<\/span><\/td><\/tr><\/tbody><\/table>\)/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/now
tr -d '\n' < $HOME/Weather_com_conky_script/now > $HOME/Weather_com_conky_script/now_temp
mv $HOME/Weather_com_conky_script/now_temp $HOME/Weather_com_conky_script/now
sed -i -e 's/^.*<span>as of//' -e 's/<\/span><\/td><\/tr><\/tbody><\/table>.*$//' $HOME/Weather_com_conky_script/now
sed -i -e 's/^.*<\/svg><\/icon><\/div><div class="today_nowcard-temp"><span class="">//' -e 's/today_nowcard-phrase">/\n/' -e 's/deg-feels">/\n/' -e 's/\(<span class="">\)\|\(<span>\)/\n/g' $HOME/Weather_com_conky_script/now
sed -i 's/<.*$//g' $HOME/Weather_com_conky_script/now
sed -i '/^$/d' $HOME/Weather_com_conky_script/now
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/now

sed '/"sunrise"/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/sun_moon
tr -d '\n' < $HOME/Weather_com_conky_script/sun_moon > $HOME/Weather_com_conky_script/sun_moon_temp
mv $HOME/Weather_com_conky_script/sun_moon_temp $HOME/Weather_com_conky_script/sun_moon
sed -i 's/"sunrise":"/\n"sunrise":"/' $HOME/Weather_com_conky_script/sun_moon
sed -i -e '1d' -e 's/","dayOfWeek":.*$//' $HOME/Weather_com_conky_script/sun_moon
sed -i -e 's/^.*"sunrise":"/sunrise\n/' -e 's/","sunset":"/\nsunset\n/' -e 's/","moonIcon".*"moonPhrase":"/\nmoonphrase\n/' -e 's/","moonrise":"/\nmoonrise\n/' -e 's/","moonset":"/\nmoonset\n/' -e 's/","dayOfWeek.*$//' /$HOME/Weather_com_conky_script/sun_moon
echo "" >> $HOME/Weather_com_conky_script/now
cat $HOME/Weather_com_conky_script/sun_moon >> $HOME/Weather_com_conky_script/now
rm $HOME/Weather_com_conky_script/sun_moon
sed -i -e '13s/^.*T//' -e '13s/:/END/2' -e '13s/END.*$//' -e '15s/^.*T//' -e '15s/:/END/2' -e '15s/END.*$//' -e '19s/^.*T//' -e '19s/:/END/2' -e '19s/END.*$//' -e '21s/^.*T//' -e '21s/:/END/2' -e '21s/END.*$//' $HOME/Weather_com_conky_script/now

sed '/<svg>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/now_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/now_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '2,$d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
cat $HOME/Weather_com_conky_script/now_svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/now.svg
colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/now.svg
rm $HOME/Weather_com_conky_script/{now_raw,now_svg_classes}


###########
# 10 Days #
###########
address10=$(echo $address|sed s/$today/$tenday/)
wget -o /dev/null -O $HOME/Weather_com_conky_script/10days_raw $address10
sed '/{"dayPartName"/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days
sed -i 's/{"dayPartName"/\n{"dayPartName"/g' $HOME/Weather_com_conky_script/10days
sed -i -e '/{"dayPartName"/!d' -e '/{"dayPartName":null/d' $HOME/Weather_com_conky_script/10days
sed -i 's/\(validDate.*}}]}\).*$/\1/' $HOME/Weather_com_conky_script/10days
sed -i 's/\("humidityPct":.*\),"qualifier".*$/\1/g' $HOME/Weather_com_conky_script/10days
sed -i -e 's/\(":"\)\|\(","\)\|\(":\)\|\(\,"\)\|\("}},{"\)/\n/g' -e 's/"}//g' -e 's/}]}//g' $HOME/Weather_com_conky_script/10days
sed -i '/{"dayPartName/d' $HOME/Weather_com_conky_script/10days
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/10days

sed '/<svg>/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/10days_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days_svgs
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/10days_svgs
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/10days_svgs
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/10days_svgs
for (( i=1; i<=15; i++ ))
	do
		sed -n ${i}p $HOME/Weather_com_conky_script/10days_svgs > $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		cat $HOME/Weather_com_conky_script/10days_svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
	done
rm $HOME/Weather_com_conky_script/{10days_svgs,10days_raw,10days_svg_classes}


##########
# Hourly #
##########
addressH=$(echo $address|sed s/$today/$hourly/)
wget -o /dev/null -O $HOME/Weather_com_conky_script/hourly_raw $addressH
sed '/\[{"processTime"/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly
sed -i 's/^.*\[{"processTime"/{"processTime"/' $HOME/Weather_com_conky_script/hourly
sed -i 's/{"processTime":"/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i '$d' $HOME/Weather_com_conky_script/hourly
sed -i 's/\(,"\)\|\(":\)/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i 's/\("\)\|\(},\)//g' $HOME/Weather_com_conky_script/hourly
sed -i '/^$/d' $HOME/Weather_com_conky_script/hourly
for (( i=1; i<=1335; i+=29 ))
	do
		sed -i -e ${i}s/^.*T// -e ${i}s/:/END/2 -e ${i}s/END.*$// $HOME/Weather_com_conky_script/hourly
	done
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/hourly

sed '/<svg>/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/hourly_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly_svgs
sed -i 's/^.*main-HourlyForecast//' $HOME/Weather_com_conky_script/hourly_svgs
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/hourly_svgs
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/hourly_svgs
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/hourly_svgs
for (( i=1; i<=16; i++ ))
	do
		sed -n ${i}p $HOME/Weather_com_conky_script/hourly_svgs > $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		cat $HOME/Weather_com_conky_script/hourly_svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
	done
rm $HOME/Weather_com_conky_script/{hourly_svgs,hourly_raw,hourly_svg_classes}


########################
# Convert svgs to pngs "
########################
for i in $HOME/Weather_com_conky_script/Forecast_Images/*.svg
do
	fn=$(basename "$i")
	n=${fn%.*}
	convert -background none $HOME/Weather_com_conky_script/Forecast_Images/"$n".svg $HOME/Weather_com_conky_script/Forecast_Images/"$n".png
done
rm $HOME/Weather_com_conky_script/Forecast_Images/*.svg


########################
# Resume weather conky #
########################
pkill -CONT -xf "$weather_conky_launch_command"

As you can see, the clean up section has been removed.
This takes care of the empty conky between updates.
Due to the time it takes for the web pages to be downloaded from weather.com and the fact that the previous version of the script deleted all data before downloading everything again, there was a small amount of time (couple of seconds) in which the user was left with an empty desktop.
Well, not anymore...

But what about fresh data when I start my pc?
I solved this by running the script once before I launch conky in my autostart file

# This shell script is run before Openbox launches.
# Environment variables set here are passed to the Openbox session.

# Set a background color
BG=""
if which hsetroot >/dev/null 2>&1; then
    BG=hsetroot
else
    if which esetroot >/dev/null 2>&1; then
	BG=esetroot
    else
	if which xsetroot >/dev/null 2>&1; then
	    BG=xsetroot
	fi
    fi
fi
test -z $BG || $BG -solid "#303030"

# D-bus
if which dbus-launch >/dev/null 2>&1 && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
       eval `dbus-launch --sh-syntax --exit-with-session`
fi

# Make GTK apps look and behave how they were set up in the gnome config tools
if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
  /usr/libexec/gnome-settings-daemon &
elif which gnome-settings-daemon >/dev/null 2>&1; then
  gnome-settings-daemon &
# Make GTK apps look and behave how they were set up in the XFCE config tools
elif which xfce-mcs-manager >/dev/null 2>&1; then
  xfce-mcs-manager n &
fi

# Preload stuff for KDE apps
if which start_kdeinit >/dev/null 2>&1; then
  LD_BIND_NOW=true start_kdeinit --new-startup +kcminit_startup &
fi

# Run XDG autostart things.  By default don't run anything desktop-specific
# See xdg-autostart --help more info
DESKTOP_ENV="OPENBOX"
if which /usr/lib/openbox/xdg-autostart >/dev/null 2>&1; then
  /usr/lib/openbox/xdg-autostart $DESKTOP_ENV
fi
bash /home/teo/Weather_com_conky_script/weather_com
expressvpn connect smart &
numlockx &
setxkbmap -option grp:switch,grp:win_space_toggle,grp_led:scroll us,el &
bash ~/.fehbg &
conky -b -c /home/teo/.conkyrc_nighthawks &

As you can see, before I start conky, I execute the weather.com script once (WITHOUT an ambersand, so that it first finishes its job and then control is passed to the next command) and I now have fresh data, even on first launch.
You can do something similar with whatever window manager/deskop environment you have.

As I said, this solution sacrifices the cleaning up of the files before every script update, so if the latter fails for some reason, the user will be seeing the same forecast again and again and again.
But if it is midnight and conky's still reporting afternoon weather, then you should know that something's not right, shouldn't you?
Also, I think a couple of seconds have been added to my pc boot time (it makes sense), but I've never cared about whether my rig boots up in 10, 12 or 20 seconds, as long as it is within a reasonable amount of time.

Try it and tell me what you think, it runs really smoothly on my system.

Last edited by TeoBigusGeekus (2020-03-16 22:09:31)


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

#3278 2020-03-17 08:38:23

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:

and delete the now, 10days and hourly files, as well as the pngs and svgs in the Forecast_Images folder, only if the pc has been running for more than 300sec or whatever.
But this would only solve the problem partially, as the images and forecast would still disappear for a few seconds between conky updates.

I solve this problem by updating to a separate location, and only moving the new config on top of the current config in the very last step.

...

Sorry, are you downloading all forecast images anew each time the conky updates???

Offline

#3279 2020-03-17 09:09:37

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Yes I do.

Last edited by TeoBigusGeekus (2020-03-17 14:35:25)


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

#3280 2020-03-17 17:02:33

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

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

@ unklar

Der Konkystador und Freund unklar

I am a simple Conky user.
I can't even begin to "hold a candle" to you  big_smile
Thanks for the flowers.  cool


Teo, I can confirm Conky's behavior upstairs
However, I have an error in my configuration here.
Because, the pictures are always the same for the days and (opposite) the hours (e.g. d2.png <--> h2.png)

I have your script for the autostart in lithium in the
conky-sessionfile.
e.g.

wmctrl -s 1 && ./weather_start.sh & sleep 1

Offline

Board footer

Powered by FluxBB