You are not logged in.

#1941 2017-10-25 05:28:40

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

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

Everything's fine here as well, apart from the fact that wget keeps log files. (Reminder to update the script so that it doesn't).
I'll keep the hourly script running for the whole day to see how it goes.


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

#1942 2017-10-25 08:37:21

ector1935
Member
Registered: 2017-05-03
Posts: 240

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

Good morning,
ok, guys I understand that the problem and the time conky, which I took from a user here on the forum, conky1.10 works smoothly with the conky hourly.

tuday.th.png

the problem is this piece of conky, they must be wrong!
I have to correct these -p

${execi 600 sed -n '5p' $HOME/1_accuweather/hourly1}\
${goto 75}${execi 600 sed -n '9p' $HOME/1_accuweather/hourly1}\
${goto 135}${execi 600 sed -n '13p' $HOME/1_accuweather/hourly1}\
${goto 195}${execi 600 sed -n '17p' $HOME/1_accuweather/hourly1}\
${goto 260}${execi 600 sed -n '5p' $HOME/1_accuweather/hourly2}
${color8}${execi 600 sed -n '8p' $HOME/1_accuweather/first_days}°\
${goto 77}${execi 600 sed -n '30p' $HOME/1_accuweather/hourly1}°\
${goto 137}${execi 600 sed -n '32p' $HOME/1_accuweather/hourly1}°\
${goto 199}${execi 600 sed -n '34p' $HOME/1_accuweather/hourly1}°\
${goto 264}${execi 600 sed -n '36p' $HOME/1_accuweather/hourly2}°\
${image $HOME/1_accuweather/hourly_2016/hourly_2.png -p 7,820  -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_4.png -p 77,820 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_6.png -p 137,820 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_8.png -p 197,820 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_10.png -p 251,820 -s 45x45}${color}

Offline

#1943 2017-10-25 21:01:26

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

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

Well, I don't know whether it's a help for you or not, but try referring to the 1_Output_of_the_script.pdf file in the script folder.
It'll tell you what each file's contents are, so that you can use the info to your liking.


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

#1944 2017-10-26 08:14:34

ector1935
Member
Registered: 2017-05-03
Posts: 240

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

Hi Teo,
thanks to the cue, but I'm two days trying, but I do not properly synchronize, in the weather time, when it does the update, you can take a look at the whereabouts where I'm wrong.
thanks for the help

conky.config = {
-- Create own window instead of using desktop (required in nautilus)
	own_window = true,
	own_window_type = 'desktop',
	own_window_transparent = true,
--	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
    
-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,

-- fiddle with window
	use_spacer = 'right',
	use_xft = true,

-- Update interval in seconds
	update_interval = 1,

-- Minimum size of text area
	minimum_width = 293, minimum_height = 300,
	maximum_width = 293,

	override_utf8_locale = true,

-- Draw shades?
	draw_shades = true,

-- Text stuff
	draw_outline = true,-- amplifies text if yes
	draw_borders = false,
--font freesans -12
	font = 'Arial:size=9',
	uppercase = false,-- set to yes if you want all text to be in uppercase

-- Stippled borders?
	stippled_borders = 0,

-- border margins
	border_inner_margin = 0,

-- border width
	border_width = 0,

-- Default colors and also border colors, grey90 == #e5e5e5
	default_color = '#cbcbcb',

	own_window_colour = 'brown',

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

-- Gap between borders of screen and text
	gap_x = 390,
	gap_y = -112,

	imlib_cache_size = 0,
	text_buffer_size = 4096,

-- stuff after 'TEXT' will be formatted on screen
};
conky.text = [[

















${texeci 500 bash $HOME/1_accuweather/1_accuweather -h2016}
${execi 600 sed -n '3p' $HOME/1_accuweather/hourly1}\
${goto 75}${execi 600 sed -n '9p' $HOME/1_accuweather/hourly1}\
${goto 135}${execi 600 sed -n '13p' $HOME/1_accuweather/hourly1}\
${goto 195}${execi 600 sed -n '17p' $HOME/1_accuweather/hourly1}\
${goto 260}${execi 600 sed -n '5p' $HOME/1_accuweather/hourly2}
${color8}${execi 600 sed -n '9p' $HOME/1_accuweather/first_days}°\
${goto 77}${execi 600 sed -n '32p' $HOME/1_accuweather/hourly1}°\
${goto 137}${execi 600 sed -n '34p' $HOME/1_accuweather/hourly1}°\
${goto 199}${execi 600 sed -n '36p' $HOME/1_accuweather/hourly1}°\
${goto 264}${execi 600 sed -n '39p' $HOME/1_accuweather/hourly2}°\
${image $HOME/1_accuweather/hourly_2016/hourly_2.png -p 0,259  -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_4.png -p 70,259 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_6.png -p 130,259 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_8.png -p 185,259 -s 45x45}\
${image $HOME/1_accuweather/hourly_2016/hourly_10.png -p 250,259 -s 45x45}${color}
${voffset -20}

]];

Last edited by ector1935 (2017-10-26 08:44:34)

Offline

#1945 2017-10-26 11:52:07

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

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

Your values are off. Taking the tarball's pdf example of the hourly1 and hourly2 files (1_Output_of_the_script.pdf)Q:
${execi 600 sed -n '3p' $HOME/1_accuweather/hourly1}    ->    3am
${execi 600 sed -n '9p' $HOME/1_accuweather/hourly1}    ->    6am (???)
${execi 600 sed -n '13p' $HOME/1_accuweather/hourly1}   ->   8am
${execi 600 sed -n '17p' $HOME/1_accuweather/hourly1}   ->   10am

Then you take the temperature for different hours:
${goto 77}${execi 600 sed -n '32p' $HOME/1_accuweather/hourly1}°    ->    16 (it corresponds to the 4th hour of the hourly forecast, ie. 6am)
${goto 77}${execi 600 sed -n '34p' $HOME/1_accuweather/hourly1}°    ->    17 (it corresponds to the 6th hour of the hourly forecast, ie. 8am)
${goto 77}${execi 600 sed -n '36p' $HOME/1_accuweather/hourly1}°    ->    19 (it corresponds to the 8th hour of the hourly forecast, ie. 10am)
${goto 77}${execi 600 sed -n '39p' $HOME/1_accuweather/hourly1}°    ->    14 (it corresponds to the real feel of the 2nd hour of the hourly forecast, ie. 4am ????)

Check the aforementioned pdf and decide what you want to show on your conky each time.
Then change the XXp values of the sed commands to do so.


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

#1946 2017-10-26 14:20:11

ector1935
Member
Registered: 2017-05-03
Posts: 240

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

Teo I'm in trouble now, I do not understand how I find the weather of the hours:
4 pm
6 pm
and where I find the p values of afternoon and night temperatures.
Excuse my ignorance smile
edit
in essence they want to know these temperatures and conditions without the 5pm
xxxxxxx.png

Last edited by ector1935 (2017-10-26 14:24:53)

Offline

#1947 2017-10-26 15:27:00

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

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

${execi 600 sed -n '3p' $HOME/1_accuweather/hourly1}

That line tells conky to print the 3rd line from the file hourly1.

What the hourly1 file contains, or hourly2, first_days, etc., can be found in the 1_README_INFO folder inside the script folder, in the file called 1_Output_of_the_script.pdf


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

#1948 2017-10-27 12:40:35

ector1935
Member
Registered: 2017-05-03
Posts: 240

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

I give up,thank you all teo,i'm getting too complicated for i.m.h.o.

Offline

#1949 2017-10-27 22:05:53

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 to hear that ector1935.


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

#1950 2017-10-30 14:32:44

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

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

@Teo  O:)

Offline

#1951 2017-11-06 12:25:51

Fortran
Member
Registered: 2016-09-07
Posts: 7

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

All,

I have another odd conky thing happening. My 1_accuweather hourly conky has gone a bit...off:

Screenshot-at-2017-11-06-07-20-03.th.png

On the right, you see the non-hourly one is doing okay, but the hourly one has thrown a rod and is showing all the weather. It's a bit drizzly here now, but not that apocalyptic.

I do confess every now and then to fiddling with the .conkyrc files, but I'm not sure how I caused that. I took a look at the latest 1_accuweather script and made mine look like it save for two lines:

155c155,156
< address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
---
> #address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
> address="https://www.accuweather.com/en/us/greenbelt-md/20770/weather-forecast/333570"
452c453
< 	rm $HOME/1_accuweather/altogether16 altogether16_2015 altogether16_2016
---
> 	rm $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2015 $HOME/1_accuweather/altogether16_2016

Any ideas?

Offline

#1952 2017-11-06 13:07:42

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

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

I tested the 1_accuweather hourly conkyrc and script for Greenbelt and everything's fine.
Can you post your entire script and conkyrc?


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

#1953 2017-11-06 13:16:05

Fortran
Member
Registered: 2016-09-07
Posts: 7

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

Sure. Here's the .conkyrc:

conky.config = {

   background = true,

-- Create own window instead of using desktop (required in nautilus)
   own_window = true,
-- own_window_type = 'desktop',
   own_window_transparent = true,
   own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
   own_window_argb_visual = true,
   own_window_argb_value = 255,

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

-- fiddle with window
   use_spacer = 'right',
   use_xft = true,

-- Update interval in seconds
   update_interval = 3,

-- Minimum size of text area
   minimum_width = 1030, minimum_height = 300,
   maximum_width = 1030,

   override_utf8_locale = true,

-- Draw shades?
   draw_shades = false,

-- Text stuff
   draw_outline = false,-- amplifies text if yes
   draw_borders = false,
   font = 'Roboto:size=9',
   uppercase = false,-- set to yes if you want all text to be in uppercase

-- Stippled borders?
   stippled_borders = 0,

-- border margins
   border_inner_margin = 9,

-- border width
   border_width = 10,

-- Default colors and also border colors, grey90 == #e5e5e5
   default_color = 'white',


-- 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 = -1040,
   gap_y = 740,

   imlib_cache_size = 0,
   text_buffer_size = 4096,

-- stuff after 'TEXT' will be formatted on screen
};

conky.text = [[
${font Roboto:size=11}${color ffe595}HOURLY WEATHER ${font}${hr 2}${texeci 600 bash $HOME/1_accuweather/1_accuweather -h}

${execpi 600 sed -n '1,26p' $HOME/1_accuweather/altogether16}

]];

And the 1_accuweather:

#!/bin/bash


#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 || $# > 4 )); then
	echo "Invalid arguments!"
	exit
fi

forecast0=0
forecast2015=0
forecast2016=0
hourly0=0
hourly2015=0
hourly2016=0

for i in $*
	do 
		if [[ $i != -f && $i != -f2015 && $i != -f2016 && $i != -h && $i != -h2015 && $i != -h2016 ]]; 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
			;;
		esac
	done
	
if [[ $forecast0 == 1 ]]; then
	forecast2015=0
	forecast2016=0
fi
if [[ $hourly0 == 1 ]]; then
	hourly2015=0
	hourly2016=0
fi


#Put your Accuweather address here
#address="http://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"
#address="http://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396"
#address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
address="https://www.accuweather.com/en/us/greenbelt-md/20770/weather-forecast/333570"

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 == 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
	}
	
	kill -STOP $(pidof conky)
	
	curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
	wget -O $HOME/1_accuweather/curr_cond_raw "$curr_addr"
	
	addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	wget -O $HOME/1_accuweather/first_days_raw "$addr1"
	
	addr2="$addr1"?day=6
	wget -O $HOME/1_accuweather/last_days_raw "$addr2"
	
	if [[ $forecast2015 == 1 ]]; then
		rm $HOME/1_accuweather/forecast_2015/forecast_*.png
	fi
	if [[ $forecast2016 == 1 ]]; then
		rm $HOME/1_accuweather/forecast_2016/forecast_*.png
	fi
	
	#current conditions
	if [[ -s $HOME/1_accuweather/curr_cond_raw ]]; then
	    sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/1_accuweather/curr_cond_raw
	    egrep -i '"cond"|icon i-|large-temp|small-temp|wind-point|"wind"><strong>|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|Duration|Sunrise:|Sunset:|Moonrise:|Moonset:' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
	    sed -i -e 's/^.*<strong>//g' -e 's/^.*<span>//g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*<\/em> //g' -e 's/^.*"cond">//g' -e 's/^.*wind-point //g' $HOME/1_accuweather/curr_cond
	    sed -i -e 's/">.*$//g' -e 's/&deg.*$//g' -e 's/<\/span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/<\/strong>.*$//g' $HOME/1_accuweather/curr_cond
	    sed -i '1s/-.*$//' $HOME/1_accuweather/curr_cond
	    image=$(sed -n 1p $HOME/1_accuweather/curr_cond)
	    echo $(test_image $image) >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 14p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 15p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 18p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 19p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		wind=$(sed -n 5p $HOME/1_accuweather/curr_cond)
		echo $(test_wind $wind) >> $HOME/1_accuweather/curr_cond
        if (( $(sed -n 14p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '14s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 15p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '15s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 18p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '18s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 19p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '19s/^/0/' $HOME/1_accuweather/curr_cond
		fi
	    if [[ $forecast2015 == 1 ]]; then
			cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/forecast_0.png
			cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/wind_0.png
		fi
		if [[ $forecast2016 == 1 ]]; then
			cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/forecast_0.png
			cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/wind_0.png
		fi
	fi
	
	#First 5 days
	if [[ -s $HOME/1_accuweather/first_days_raw ]]; then
	
	    sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/first_days_raw
	    egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
	    sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' -e 's/^.*"temp-label tonight selected">//g' $HOME/1_accuweather/first_days
	    sed -i -e 's/&deg.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/first_days
	    sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' -e 's/Today$/TODAY/' -e 's/Tonight$/TONIGHT/' -e 's/Early AM/EARLY AM/' $HOME/1_accuweather/first_days
	    for (( i=2; i<=22; i+=5 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/first_days)
	          echo $(test_image $image) >> $HOME/1_accuweather/first_days
		  done
		if [[ $forecast0 == 0 ]]; then
			j=1
			for (( i=2; i<=22; i+=5 ))
			  do
				if [[ $forecast2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
				fi
				if [[ $forecast2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
				fi
				((j++))
			  done
		fi
	fi
	
	#Next 5 days
	if [[ -s $HOME/1_accuweather/last_days_raw ]]; then
		
		sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/last_days_raw
	    egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
	    sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' $HOME/1_accuweather/last_days
	    sed -i -e 's/&deg.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/last_days
	    sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' $HOME/1_accuweather/last_days
	    for (( i=2; i<=22; i+=5 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/last_days)
	          echo $(test_image $image) >> $HOME/1_accuweather/last_days
		  done
		if [[ $forecast0 == 0 ]]; then
			j=6
			for (( i=2; i<=22; i+=5 ))
			  do
			    if [[ $forecast2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
				fi
				if [[ $forecast2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
				fi
				((j++))
			  done
		fi
	fi

	if [[ $hourly0 != 1 && $hourly2015 != 1 && $hourly2016 != 1 ]]; then
		kill -CONT $(pidof conky)
	fi

fi


#############################################################
# HOURLY FORECAST: -h, -h2015 or -h2016 passed as arguments #
#############################################################
if [[ $hourly0 == 1 || $hourly2015 == 1 || $hourly2016 == 1 ]]; then

	#Hourly: First 8h
	
	if [[ $forecast0 != 1 && $forecast2015 != 1 && $forecast2016 != 1 ]]; then
		kill -STOP $(pidof conky)
	fi
	
	if [[ $hourly2015 == 1 ]]; then
		rm $HOME/1_accuweather/hourly_2015/hourly_*.png
	fi
	if [[ $hourly2016 == 1 ]]; then
		rm $HOME/1_accuweather/hourly_2016/hourly_*.png
	fi	
	
	hourly_addr1="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"
	wget -O $HOME/1_accuweather/hourly_raw1 "$hourly_addr1"
	
	if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
		sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw1
		egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw1 > $HOME/1_accuweather/hourly1
		sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly1
		sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly1
		echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly1
		for (( i=4; i<=18; i+=2 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/hourly1)
	          echo $(test_image $image) >> $HOME/1_accuweather/hourly1
		  done
		if [[ $hourly0 == 0 ]]; then
			j=1
			for (( i=4; i<=18; i+=2 ))
			  do
		    	if [[ $hourly2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
				fi
				if [[ $hourly2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
				fi	    	
		    	((j++))
			  done
		fi
	fi
	
	#Hourly: Next 8h
	hourly_addr2=$(sed -n 1p $HOME/1_accuweather/hourly1)
	wget -O $HOME/1_accuweather/hourly_raw2 "$hourly_addr2"
	
	if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
		sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw2
		egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw2 > $HOME/1_accuweather/hourly2
		sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly2
		sed -i 1d $HOME/1_accuweather/hourly2
		sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly2
		echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly2
		for (( i=4; i<=18; i+=2 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/hourly2)
	          echo $(test_image $image) >> $HOME/1_accuweather/hourly2
		  done
		if [[ $hourly0 == 0 ]]; then
			j=9
			for (( i=4; i<=18; i+=2 ))
			  do
		    	if [[ $hourly2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
				fi
				if [[ $hourly2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
				fi	    	
		    	((j++))
			  done
		fi
	fi
	
	
	# Full info, next 16h - altogether16 file
	rm $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2015 $HOME/1_accuweather/altogether16_2016
	
	#TIME
	echo "\${color ffe595}TIME\${goto 100}" > $HOME/1_accuweather/altogether16
	sed -i "1s/$/$(sed -n 2p $HOME/1_accuweather/hourly1):$(sed -n 3p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
	jump_to=160
	for (( i=5; i<=17; i+=2 ))
		do
			time=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "1s/$/\${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	sed -i "1s/$/\${goto 580}$(sed -n 2p $HOME/1_accuweather/hourly2):$(sed -n 3p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
	jump_to=640
	for (( i=5; i<=17; i+=2 ))
		do
			time=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "1s/$/\${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	
	sed -i '1s/$/\n\n\n/' $HOME/1_accuweather/altogether16
	
	#FORECAST
	echo "\${color ffe595}FORECAST\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $1}'|cut -c1-8)
			sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $1}'|cut -c1-8)
			sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	sed -i '5s/$/\n/' $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $2}'|cut -c1-8)
			sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $2}'|cut -c1-8)
			sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	
	#TEMPERATURE
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "TEMPER.\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=29; i<=36; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=29; i<=36; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	
	#REAL FEEL
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "REAL FEEL\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=38; i<=45; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done	
	for (( i=38; i<=45; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done	
		
	#WIND
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "WIND\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=47; i<=54; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=47; i<=54; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#RAIN
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "RAIN\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=64; i<=71; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=64; i<=71; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#SNOW
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "SNOW\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=73; i<=80; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=73; i<=80; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	
	#ICE
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "ICE\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=82; i<=89; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=82; i<=89; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#UV INDEX
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "UV INDEX\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=99; i<=106; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=99; i<=106; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#CLOUD COVER
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "CLOUD COV.\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=108; i<=115; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=108; i<=115; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	
	#HUMIDITY
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "HUMIDITY\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=117; i<=124; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=117; i<=124; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#DEW POINT
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "DEW POINT\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=126; i<=133; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	for (( i=126; i<=133; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
			sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
		
	#IMAGES
	if [[ $hourly0 == 0 ]]; then
		if [[ $hourly2015 == 1 ]]; then
					jump_to=75
					cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2015
		fi
		if [[ $hourly2016 == 1 ]]; then
					jump_to=85
					cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2016
		fi
		rm $HOME/1_accuweather/altogether16
		for (( i=1; i<=16; i+=1 ))
			do
				if [[ $hourly2015 == 1 ]]; then
					sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2015\/hourly_$i.png -s 60x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2015
				fi
				if [[ $hourly2016 == 1 ]]; then
					sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2016\/hourly_$i.png -s 36x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2016
				fi			
				((jump_to+=60))
			done
	fi
	
	#CONKYFONT
	if [[ $hourly0 == 1 ]]; then
		sed -i '4s/$/\${color}\${font conkyweather:size=35}/' $HOME/1_accuweather/altogether16
		jump_to=95
		for (( i=135; i<=142; i+=1 ))
			do
				sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
		for (( i=135; i<=142; i+=1 ))
			do
				sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
		sed -i '4s/$/\${font}/' $HOME/1_accuweather/altogether16
		sed -i '2,3d' $HOME/1_accuweather/altogether16
	fi
	
	kill -CONT $(pidof conky)
fi	

Offline

#1954 2017-11-06 16:27:02

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

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

Oh crap, you're right, I was testing it with the images, the weatherfont has indeed problems.
Standby everyone...

EDIT: Accuweather added Visibility values to their hourly forecast. So, up until now, lines 134-142 in the hourly1 and hourly2 files (see 1_Output_of_the_script.pdf) had the Conkyweather Font Icons for the next 8 hours' forecast.
The latter have been moved to the lines 142-150 and now the lines 134-141 show the Visibility for the following 8 hours.

The script will be updated later in the evening/night.

Thanks fortran for your prompt notification.

EDIT2: Question to all hourly forecast users: should I add the visibility line to the hourly forecasts or will it screw up your desktops?

Last edited by TeoBigusGeekus (2017-11-06 17:19:40)


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

#1955 2017-11-06 16:56:44

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

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

TeoBigusGeekus wrote:

Thanks fortran for your prompt notification.

EDIT2: Question to all hourly forecast users: should I add the visibility line to the hourly forecasts or will it screw up your desktops?

Yea nice catch fortran.

Since Visibility is a "NOW" thing it's a toss of a coin BUT if people are using the "hourly" forecast because they use motorcycles or bikes for transport it might be a nice thing to have.

Local area Cessina pilots would LOVE it!  Just saying.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1956 2017-11-06 17:18:56

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

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

I believe so myself, but I'll leave it for maybe a day for hourly forecast users, if any, to express their opinions, or forever hold their silence.

One idea would be to add variables to the script, something like

time=1
icon_image=1
forecast=1
temp=1
real_feel=1
...
etc.

all 1 by default.
If a user doesn't want visibility for example, they could just change

visibility=0

and then, when the altogether file would be created, visibility would be ignored.

Just a thought...


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

#1957 2017-11-06 17:56:56

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

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

TeoBigusGeekus wrote:

Just a thought...

Teo, you're the master here! O:)

The thought is, of course, brilliant.
I don't always run the hourly forecast. Only on demand in arch-linux. In the other six distributions I have refused to update to conky1.10 so far.

Sometimes I don't have room for more Conky's. 8o (To knit it over, I mean.)  big_smile

Offline

#1958 2017-11-07 02:17:34

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

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

TeoBigusGeekus wrote:

Just a thought...

I agree with unklar - brilliant idea, Teo.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1959 2017-11-07 22:50:30

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

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

Alright:

#!/bin/bash


#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 || $# > 4 )); then
	echo "Invalid arguments!"
	exit
fi

forecast0=0
forecast2015=0
forecast2016=0
hourly0=0
hourly2015=0
hourly2016=0

for i in $*
	do 
		if [[ $i != -f && $i != -f2015 && $i != -f2016 && $i != -h && $i != -h2015 && $i != -h2016 ]]; 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
			;;
		esac
	done
	
if [[ $forecast0 == 1 ]]; then
	forecast2015=0
	forecast2016=0
fi
if [[ $hourly0 == 1 ]]; then
	hourly2015=0
	hourly2016=0
fi


#Put your Accuweather address here
#address="http://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"
#address="http://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396"
address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"


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 == 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
	}
	
	kill -STOP $(pidof conky)
	
	curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
	wget -o /dev/null -O $HOME/1_accuweather/curr_cond_raw "$curr_addr"
	
	addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	wget -o /dev/null -O $HOME/1_accuweather/first_days_raw "$addr1"
	
	addr2="$addr1"?day=6
	wget -o /dev/null -O $HOME/1_accuweather/last_days_raw "$addr2"
	
	if [[ $forecast2015 == 1 ]]; then
		rm $HOME/1_accuweather/forecast_2015/forecast_*.png
	fi
	if [[ $forecast2016 == 1 ]]; then
		rm $HOME/1_accuweather/forecast_2016/forecast_*.png
	fi
	
	#current conditions
	if [[ -s $HOME/1_accuweather/curr_cond_raw ]]; then
	    sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/1_accuweather/curr_cond_raw
	    egrep -i '"cond"|icon i-|large-temp|small-temp|wind-point|"wind"><strong>|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|Duration|Sunrise:|Sunset:|Moonrise:|Moonset:' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
	    sed -i -e 's/^.*<strong>//g' -e 's/^.*<span>//g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*<\/em> //g' -e 's/^.*"cond">//g' -e 's/^.*wind-point //g' $HOME/1_accuweather/curr_cond
	    sed -i -e 's/">.*$//g' -e 's/&deg.*$//g' -e 's/<\/span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/<\/strong>.*$//g' $HOME/1_accuweather/curr_cond
	    sed -i '1s/-.*$//' $HOME/1_accuweather/curr_cond
	    image=$(sed -n 1p $HOME/1_accuweather/curr_cond)
	    echo $(test_image $image) >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 14p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 15p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 18p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		sunrise_time=$(sed -n 19p $HOME/1_accuweather/curr_cond)
		echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
		wind=$(sed -n 5p $HOME/1_accuweather/curr_cond)
		echo $(test_wind $wind) >> $HOME/1_accuweather/curr_cond
        if (( $(sed -n 14p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '14s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 15p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '15s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 18p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '18s/^/0/' $HOME/1_accuweather/curr_cond
		fi
		if (( $(sed -n 19p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
			sed -i '19s/^/0/' $HOME/1_accuweather/curr_cond
		fi
	    if [[ $forecast2015 == 1 ]]; then
			cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/forecast_0.png
			cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/wind_0.png
		fi
		if [[ $forecast2016 == 1 ]]; then
			cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/forecast_0.png
			cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/wind_0.png
		fi
	fi
	
	#First 5 days
	if [[ -s $HOME/1_accuweather/first_days_raw ]]; then
	
	    sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/first_days_raw
	    egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
	    sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' -e 's/^.*"temp-label tonight selected">//g' $HOME/1_accuweather/first_days
	    sed -i -e 's/&deg.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/first_days
	    sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' -e 's/Today$/TODAY/' -e 's/Tonight$/TONIGHT/' -e 's/Early AM/EARLY AM/' $HOME/1_accuweather/first_days
	    for (( i=2; i<=22; i+=5 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/first_days)
	          echo $(test_image $image) >> $HOME/1_accuweather/first_days
		  done
		if [[ $forecast0 == 0 ]]; then
			j=1
			for (( i=2; i<=22; i+=5 ))
			  do
				if [[ $forecast2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
				fi
				if [[ $forecast2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
				fi
				((j++))
			  done
		fi
	fi
	
	#Next 5 days
	if [[ -s $HOME/1_accuweather/last_days_raw ]]; then
		
		sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/last_days_raw
	    egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
	    sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' $HOME/1_accuweather/last_days
	    sed -i -e 's/&deg.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/last_days
	    sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' $HOME/1_accuweather/last_days
	    for (( i=2; i<=22; i+=5 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/last_days)
	          echo $(test_image $image) >> $HOME/1_accuweather/last_days
		  done
		if [[ $forecast0 == 0 ]]; then
			j=6
			for (( i=2; i<=22; i+=5 ))
			  do
			    if [[ $forecast2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
				fi
				if [[ $forecast2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
				fi
				((j++))
			  done
		fi
	fi

	if [[ $hourly0 != 1 && $hourly2015 != 1 && $hourly2016 != 1 ]]; then
		kill -CONT $(pidof conky)
	fi

fi


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

#Do you want the whole 16 hours (1) or just 8 hours (0)?
h_16hours=1

#Hourly variables to be displayed (0 or 1). Time, image, forecast and temperature are kept as a bare minimum
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

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

	#Hourly: First 8h
	
	if [[ $forecast0 != 1 && $forecast2015 != 1 && $forecast2016 != 1 ]]; then
		kill -STOP $(pidof conky)
	fi
	
	if [[ $hourly2015 == 1 ]]; then
		rm $HOME/1_accuweather/hourly_2015/hourly_*.png
	fi
	if [[ $hourly2016 == 1 ]]; then
		rm $HOME/1_accuweather/hourly_2016/hourly_*.png
	fi	
	
	hourly_addr1="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"
	wget -o /dev/null -O $HOME/1_accuweather/hourly_raw1 "$hourly_addr1"
	
	if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
		sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw1
		egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point|<th>Visibility' $HOME/1_accuweather/hourly_raw1 > $HOME/1_accuweather/hourly1
		sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly1
		sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly1
		echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly1
		for (( i=4; i<=18; i+=2 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/hourly1)
	          echo $(test_image $image) >> $HOME/1_accuweather/hourly1
		  done
		if [[ $hourly0 == 0 ]]; then
			j=1
			for (( i=4; i<=18; i+=2 ))
			  do
		    	if [[ $hourly2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
				fi
				if [[ $hourly2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
				fi	    	
		    	((j++))
			  done
		fi
	fi
	
	#Hourly: Next 8h
	hourly_addr2=$(sed -n 1p $HOME/1_accuweather/hourly1)
	wget -o /dev/null -O $HOME/1_accuweather/hourly_raw2 "$hourly_addr2"
	
	if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
		sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw2
		egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point|<th>Visibility' $HOME/1_accuweather/hourly_raw2 > $HOME/1_accuweather/hourly2
		sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly2
		sed -i 1d $HOME/1_accuweather/hourly2
		sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly2
		echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly2
		for (( i=4; i<=18; i+=2 ))
		  do
	          image=$(sed -n "${i}"p $HOME/1_accuweather/hourly2)
	          echo $(test_image $image) >> $HOME/1_accuweather/hourly2
		  done
		if [[ $hourly0 == 0 ]]; then
			j=9
			for (( i=4; i<=18; i+=2 ))
			  do
		    	if [[ $hourly2015 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
				fi
				if [[ $hourly2016 == 1 ]]; then
					cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
				fi	    	
		    	((j++))
			  done
		fi
	fi
	
	
	# Full info, next 16h - altogether16 file
	rm $HOME/1_accuweather/{altogether16,altogether16_2015,altogether16_2016}
	
	#TIME
	echo "\${color ffe595}TIME\${goto 100}" > $HOME/1_accuweather/altogether16
	sed -i "1s/$/$(sed -n 2p $HOME/1_accuweather/hourly1):$(sed -n 3p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
	jump_to=160
	for (( i=5; i<=17; i+=2 ))
		do
			time=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "1s/$/\${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		sed -i "1s/$/\${goto 580}$(sed -n 2p $HOME/1_accuweather/hourly2):$(sed -n 3p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
		jump_to=640
		for (( i=5; i<=17; i+=2 ))
			do
				time=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "1s/$/\${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	
	sed -i '1s/$/\n\n\n/' $HOME/1_accuweather/altogether16
	
	#FORECAST
	echo "\${color ffe595}FORECAST\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $1}'|cut -c1-8)
			sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=20; i<=27; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $1}'|cut -c1-8)
				sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	sed -i '5s/$/\n/' $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=20; i<=27; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $2}'|cut -c1-8)
			sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=20; i<=27; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $2}'|cut -c1-8)
				sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	
	#TEMPERATURE
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "TEMPER.\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=29; i<=36; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=29; i<=36; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	
	#REAL FEEL
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "REAL FEEL\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=38; i<=45; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done	
	if [[ $h_16hours == 1 ]]; then
		for (( i=38; i<=45; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi	
	
	#WIND
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "WIND\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=47; i<=54; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=47; i<=54; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#RAIN
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "RAIN\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=64; i<=71; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=64; i<=71; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#SNOW
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "SNOW\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=73; i<=80; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=73; i<=80; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	
	#ICE
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "ICE\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100
	for (( i=82; i<=89; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=82; i<=89; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#UV INDEX
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "UV INDEX\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=99; i<=106; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=99; i<=106; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#CLOUD COVER
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "CLOUD COV.\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=108; i<=115; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=108; i<=115; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
	
	#HUMIDITY
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "HUMIDITY\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=117; i<=124; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=117; i<=124; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#DEW POINT
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "DEW POINT\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=126; i<=133; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=126; i<=133; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#VISIBILITY
	echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
	echo "VISIBILITY\${color}" >> $HOME/1_accuweather/altogether16
	jump_to=100	
	for (( i=135; i<=142; i+=1 ))
		do
			messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
			sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
			((jump_to+=60))
		done
	if [[ $h_16hours == 1 ]]; then
		for (( i=135; i<=142; i+=1 ))
			do
				messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
				sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
	fi
		
	#IMAGES
	if [[ $hourly0 == 0 ]]; then
		if [[ $hourly2015 == 1 ]]; then
					jump_to=75
					cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2015
		fi
		if [[ $hourly2016 == 1 ]]; then
					jump_to=85
					cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2016
		fi
		rm $HOME/1_accuweather/altogether16
		hours=$((8+$h_16hours*8))
		for (( i=1; i<=$hours; i+=1 ))
			do
				if [[ $hourly2015 == 1 ]]; then
					sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2015\/hourly_$i.png -s 60x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2015
				fi
				if [[ $hourly2016 == 1 ]]; then
					sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2016\/hourly_$i.png -s 36x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2016
				fi			
				((jump_to+=60))
			done
	fi
	
	#CONKYFONT
	if [[ $hourly0 == 1 ]]; then
		sed -i '4s/$/\${color}\${font conkyweather:size=35}/' $HOME/1_accuweather/altogether16
		jump_to=95
		for (( i=144; i<=151; i+=1 ))
			do
				sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
				((jump_to+=60))
			done
		if [[ $h_16hours == 1 ]]; then
			for (( i=144; i<=151; i+=1 ))
				do
					sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
					((jump_to+=60))
				done
		fi
		sed -i '4s/$/\${font}/' $HOME/1_accuweather/altogether16
		sed -i '2,3d' $HOME/1_accuweather/altogether16
	fi
	
	#DELETE UNWANTED VARIABLES
	if [[ $h_real == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '7,8s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_wind == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '9,10s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_rain == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '11,12s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_snow == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '13,14s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	

	if [[ $h_ice == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '15,16s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi

	
	if [[ $h_uv == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '17,18s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_cloud == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '19,20s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_humid == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '21,22s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi

	if [[ $h_dew == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '23,24s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	if [[ $h_visib == 0 ]]; then
		if [[ $hourly0 == 1 ]]; then
			sed -i '25,26s/^.*$/VOID/' $HOME/1_accuweather/altogether16
		elif [[ $hourly2015 == 1 ]]; then
			sed -i '27,28s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2015
		elif [[ $hourly2016 == 1 ]]; then
			sed -i '27,28s/^.*$/VOID/' $HOME/1_accuweather/altogether16_2016
		fi
	fi
	
	sed -i '/VOID/d' $HOME/1_accuweather/{altogether16,altogether16_2015,altogether16_2016}

	
	kill -CONT $(pidof conky)
fi	

Take notice of the following section:

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

#Do you want the whole 16 hours (1) or just 8 hours (0)?
h_16hours=1

#Hourly variables to be displayed (0 or 1). Time, image, forecast and temperature are kept as a bare minimum
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

If you change the h_16hours variable to anything other than 1, then you can reduce the hourly forecast to only 8 hours.
Furthermore, you can choose which forecast messages you want to display by changing the variables to 0.
As the comment says, I've kept times, images/forecast characters, forecast messages and temperatures as a bare minimum.

If you want to use only 8 hours as your hourly forecast, change the minimum_width variable in the .conkyrc_hourly_weatherfont, .conkyrc_hourly_2016 and .conkyrc_hourly_2015 files to 515.
Also, in the hourly_2015 and hourly_2016 conkyrc files change

${execpi 600 sed -n '1,26p' $HOME/1_accuweather/altogether16_2015}

to

${execpi 600 sed -n '1,28p' $HOME/1_accuweather/altogether16_2015}

The same applies to the altogether16_2016.

The possibilities are endless
mSzhY5Mt.png

I'm eagerly waiting for your feedback before I update the script.

Last edited by TeoBigusGeekus (2017-11-08 12:05:03)


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

#1960 2017-11-08 10:40:23

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

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

Hi Teo,   smile

there's another mistake,

the altogether16_2016 contains the entry

according to terminal, he wants to delete altogether16

visib1.th.jpg

Last edited by unklar (2017-11-08 10:42:04)

Offline

Board footer

Powered by FluxBB