You are not logged in.

#2251 2019-02-12 03:34:01

seatommyboy
Member
Registered: 2016-09-12
Posts: 21

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

TeoBigusGeekus wrote:

Icons appear perfectly for Hutto, both the 2015 and the 2016 ones.
Perhaps your folder paths?

Yes. I didn't realize it wrote the icons to another folder. Fixed it, but the name format of the icons are different as well, but I'll get those sorted out...

Offline

#2252 2019-02-12 03:36:57

seatommyboy
Member
Registered: 2016-09-12
Posts: 21

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

TeoBigusGeekus wrote:

ATTENTION TO US USERS OF THE 1_ACCUWEATHER SCRIPT
Accuweather have changed their page layout for US locations.
I've changed the script so that the latter detects whether it's an international forecast or a US one and acts accordingly.
The output files have remained the same so that none of your conkyrc files needs correction.
Remember to change the folder paths throughout the script and, as always with new scripts, any feedback is welcome

Just a small note. When I run the script, my conky stops. I had to comment out the script inmy .conkyrc to get my conky to reappear.
Going thru the script, line 305 contains:

kill -STOP $(pidof conky)

Which was causing my conky to stop before it even got started. I commented it out and all is working again.

Thanks again for all your hard work!

Last edited by seatommyboy (2019-02-12 03:37:33)

Offline

#2253 2019-02-12 04:19:33

seatommyboy
Member
Registered: 2016-09-12
Posts: 21

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

seatommyboy wrote:
TeoBigusGeekus wrote:

ATTENTION TO US USERS OF THE 1_ACCUWEATHER SCRIPT
Accuweather have changed their page layout for US locations.
I've changed the script so that the latter detects whether it's an international forecast or a US one and acts accordingly.
The output files have remained the same so that none of your conkyrc files needs correction.
Remember to change the folder paths throughout the script and, as always with new scripts, any feedback is welcome

Just a small note. When I run the script, my conky stops. I had to comment out the script inmy .conkyrc to get my conky to reappear.
Going thru the script, line 305 contains:

kill -STOP $(pidof conky)

Which was causing my conky to stop before it even got started. I commented it out and all is working again.

Thanks again for all your hard work!

Another thing I found, when I run the script with -f2016 I get:

cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images_2016/52.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images_2016/59.png': No such file or directory

But this does not seem to affect the operation. Also, I found if, after I ran teh -f2016 flag, I use just the -f flag, then the icons are not written.

Offline

#2254 2019-02-12 07:54:07

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

seatommyboy wrote:

Just a small note. When I run the script, my conky stops. I had to comment out the script inmy .conkyrc to get my conky to reappear.
Going thru the script, line 305 contains:

kill -STOP $(pidof conky)

Which was causing my conky to stop before it even got started.

The two lines

kill -STOP $(pidof conky)

and

kill -CONT $(pidof conky)

are meant to pause conky so that the script has the necessary time to populate all files and then resume it. If you're running more than one conky configuration files problems can arise with this tactic, so it's best to comment out the kill -STOP command, as you already did.

seatommyboy wrote:

Another thing I found, when I run the script with -f2016 I get:

cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images_2016/52.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images_2016/59.png': No such file or directory

Where in your forecast did you get a 52 or 59 icon? Accuweather don't have these icons, they stop at 44.

seatommyboy wrote:

Also, I found if, after I ran teh -f2016 flag, I use just the -f flag, then the icons are not written.

Read the 1_README.pdf file:

The usage of -f cancels out the -f2015 and -f2016 parameters.


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

#2255 2019-02-12 09:24:56

unklar
Member
Registered: 2015-10-31
Posts: 914

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

Teo, you still have your test paths in the script.   wink

/home/unklar/1_accuweather/1_accuweather_us: Zeile 308: /home/unklar/Desktop/1_test/curr_cond_raw: Datei oder Verzeichnis nicht gefunden
/home/unklar/1_accuweather/1_accuweather_us: Zeile 311: /home/unklar/Desktop/1_test/first_days_raw: Datei oder Verzeichnis nicht gefunden
/home/unklar/1_accuweather/1_accuweather_us: Zeile 314: /home/unklar/Desktop/1_test/last_days_raw: Datei oder Verzeichnis nicht gefunden
rm: das Entfernen von '/home/unklar/Desktop/1_test/forecast_2015/forecast_*.png' ist nicht möglich: Datei oder Verzeichnis nicht gefunden

Or, is this intention of you?   devil

Offline

#2256 2019-02-12 10:44:58

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Yep, it's not final, it'll be corrected in the final version.

Last edited by TeoBigusGeekus (2019-02-12 10:45:06)


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

#2257 2019-02-12 13:58:12

seatommyboy
Member
Registered: 2016-09-12
Posts: 21

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

TeoBigusGeekus wrote:
kill -STOP $(pidof conky)

and

kill -CONT $(pidof conky)

are meant to pause conky so that the script has the necessary time to populate all files and then resume it. If you're running more than one conky configuration files problems can arise with this tactic, so it's best to comment out the kill -STOP command, as you already did.

I do have multiple conky configs.

TeoBigusGeekus wrote:

Where in your forecast did you get a 52 or 59 icon? Accuweather don't have these icons, they stop at 44.

I have NO clue, but after it booted up this morning, everything is fine and on point.

TeoBigusGeekus wrote:

Read the 1_README.pdf file:

The usage of -f cancels out the -f2015 and -f2016 parameters.

Completely misread that last night.

All is good now though and working like a dream! Thanks!!!!!!!!!!!!!!!!!!!!!!!

Offline

#2258 2019-02-12 16:14:28

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Thank you for the feedback seatommyboy!
Here's what's supposed to become the final version of the script (paths corrected):

#!/usr/bin/env 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 || $# > 15 )); then
	echo "Invalid arguments!"
	exit
fi

forecast0=0
forecast2015=0
forecast2016=0
hourly0=0
hourly2015=0
hourly2016=0
h_16hours=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_8h && $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_8h)
				h_16hours=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


#Put your Accuweather address here
#address="http://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="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
#address="http://www.accuweather.com/en/de/lichtenstein/09350/weather-forecast/171261"


#########################
# Test for USA location #
#########################
if [[ $(echo $address|awk 'BEGIN { FS = "/" } ; { print $5 }') == us ]]; then
	is_us=1
else
	is_us=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 == 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"
	lynx --source -accept_all_cookies "$curr_addr" > $HOME/1_accuweather/curr_cond_raw 
	
	addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	lynx --source -accept_all_cookies "$addr1" > $HOME/1_accuweather/first_days_raw 
	
	addr2="$addr1"?day=6
	lynx --source -accept_all_cookies "$addr2" > $HOME/1_accuweather/last_days_raw 
	
	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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-now/,/TEMPERATURE SUMMARY/!d' $HOME/1_accuweather/curr_cond_raw
			egrep -i '&deg|svg|phrase|wind-point|speed|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|</time>' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
			sed -i -e '/<img class="icon/d' -e '/TEMPERATURE SUMMARY/d' $HOME/1_accuweather/curr_cond
			sed -i -e 's/^.*\/icons\///g' -e 's/\.svg.*$//g' -e 's/&deg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*RealFeel&#174; //g' -e 's/^.*phrase">//g' -e 's/<\/div>//g' -e 's/^.*wind-point //g' -e '5s/">//' -e 's/^.*">//g' -e 's/<\/time>//g' -e 's/^.*: //g' -e '8s/ &darr.*$//' -e '8s/ &uarr.*$//' -e '12s/°&.*$//' -e '17i EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT' -e 's/\r//g' $HOME/1_accuweather/curr_cond
			sed -i '1s/^0//' $HOME/1_accuweather/curr_cond
		fi
	    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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/first_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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
		          sed -i ${i}s/^0// $HOME/1_accuweather/first_days
			  done
		fi
	    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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/last_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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/last_days
			for (( i=2; i<=22; i+=5 ))
			  do
		          sed -i ${i}s/^0// $HOME/1_accuweather/last_days
			  done
		fi
	    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
fi


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

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

	#Hourly: First 8h
	
	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"
	lynx --source -accept_all_cookies "$hourly_addr1" > $HOME/1_accuweather/hourly_raw1 
	
	if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly1
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw1
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly1
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly1	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly1
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly1
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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)
	lynx --source -accept_all_cookies "$hourly_addr2" > $HOME/1_accuweather/hourly_raw2 
	
	if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly2
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw2
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly2
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly2	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly2
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly2
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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}
	
fi	

Being in an experimental mood, I've completely removed all the kill commands that have caused much trouble up until now. We'll see how it goes without them. I'll personally run the script with Hutto as my location for the next days to observe its behavior.

As always, the script is brand new, any feedback from US users is welcome. I'll test it for a few days and then rebundle the whole thing.

EDIT: Minor correction in the code.

Last edited by TeoBigusGeekus (2019-02-12 20:55:27)


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

#2259 2019-02-13 00:46:24

ipdeman
New Member
Registered: 2019-02-13
Posts: 4

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

Is not the following missing after line 444. Without it, conky never restarts.

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

Offline

#2260 2019-02-13 06:50:31

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

It's not supposed to restart because it never pauses, doesn't it?
All kill commands have been erased, including the ones that used to pause conky

kill -STOP $(pidof conky)

Unless you run other instances of the script (or other scripts) that do it...

Last edited by TeoBigusGeekus (2019-02-13 06:50:47)


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

#2261 2019-02-13 08:40:20

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Not good at all sad
NVjx86tt.jpg
This reminds me of the reason I introduced the kill commands in the first place: the first_days file is properly populated but conky doesn't have the time to read it in time.
Pausing and resuming conky have to be reinstated imho...

EDIT: Nevermind, ignore this post; the code needs corrections.

Last edited by TeoBigusGeekus (2019-02-13 09:20:10)


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

#2262 2019-02-13 10:06:18

unklar
Member
Registered: 2015-10-31
Posts: 914

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

Teo, I can't stand to see you fight your way through this alone...  smile

Yesterday I just couldn't get the us_code to work. Today I killed everything that means conky and now it works. big_smile

I can report to you
- .conkyrc_1_hourly_2015
- .conkyrc_1_hourly_2016
- .conkyrc_1_hourly_weatherfont

run correctly. I couldn't see any errors in the quick test now.

- .conkyrc_1_images_2015
- .conkyrc_1_images_2016

begin with the error (as with you)

...
cp: der Aufruf von stat für '/home/unklar/1_accuweather/Forecast_Images_2016/10.png' ist nicht möglich: Datei oder Verzeichnis nicht gefunden
conky: Unable to load image '/home/unklar/1_accuweather/forecast_2016/forecast_2.png'
conky: Unable to load image '/home/unklar/1_accuweather/forecast_2016/forecast_2.png'
...

Offline

#2263 2019-02-13 11:38:44

unklar
Member
Registered: 2015-10-31
Posts: 914

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

The rest
- .conkyrc_1_weatherfont
- .conkyrc_1_weatherfont_simple
- .conkyrc_1_weatherfont_simpler
- .conkyrc_1_weatherfont_wind

runs without errors, but it is missing in the curr_cond p27, like here on S11's wonderful summary.
accu_us.th.png

Offline

#2264 2019-02-13 16:47:38

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Thanks for the support and the feedback unklar, I've found the mistake.
I would also like to propose a compromise for the pausing/resuming conky by using the pkill command:

NEW VERSION

#!/usr/bin/env bash

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

#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_16hours=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_8h && $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_8h)
				h_16hours=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


#Put your Accuweather address here
#address="http://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="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
#address="http://www.accuweather.com/en/de/lichtenstein/09350/weather-forecast/171261"


#########################
# Test for USA location #
#########################
if [[ $(echo $address|awk 'BEGIN { FS = "/" } ; { print $5 }') == us ]]; then
	is_us=1
else
	is_us=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 == 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"
	lynx --source -accept_all_cookies "$curr_addr" > $HOME/1_accuweather/curr_cond_raw 
	
	addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	lynx --source -accept_all_cookies "$addr1" > $HOME/1_accuweather/first_days_raw 
	
	addr2="$addr1"?day=6
	lynx --source -accept_all_cookies "$addr2" > $HOME/1_accuweather/last_days_raw 
	
	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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-now/,/TEMPERATURE SUMMARY/!d' $HOME/1_accuweather/curr_cond_raw
			egrep -i '&deg|svg|phrase|wind-point|speed|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|</time>' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
			sed -i -e '/<img class="icon/d' -e '/TEMPERATURE SUMMARY/d' $HOME/1_accuweather/curr_cond
			sed -i -e 's/^.*\/icons\///g' -e 's/\.svg.*$//g' -e 's/&deg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*RealFeel&#174; //g' -e 's/^.*phrase">//g' -e 's/<\/div>//g' -e 's/^.*wind-point //g' -e '5s/">//' -e 's/^.*">//g' -e 's/<\/time>//g' -e 's/^.*: //g' -e '8s/ &darr.*$//' -e '8s/ &uarr.*$//' -e '12s/°&.*$//' -e '17i EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT' -e 's/\r//g' $HOME/1_accuweather/curr_cond
			sed -i '1s/^0//' $HOME/1_accuweather/curr_cond
		fi
	    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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/first_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details|"hi tonight"|"lo tonight "' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/^.*"hi tonight">//g' -e 's/^.*"lo tonight ">//g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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/' -e 's/<\/span>//g' $HOME/1_accuweather/first_days
			for (( i=2; i<=22; i+=5 ))
			  do
		          sed -i ${i}s/^0// $HOME/1_accuweather/first_days
			  done
		fi
	    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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/last_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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/last_days
			for (( i=2; i<=22; i+=5 ))
			  do
		          sed -i ${i}s/^0// $HOME/1_accuweather/last_days
			  done
		fi
	    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
fi


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

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

	#Hourly: First 8h
	
	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"
	lynx --source -accept_all_cookies "$hourly_addr1" > $HOME/1_accuweather/hourly_raw1 
	
	if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly1
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw1
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly1
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly1	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly1
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly1
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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)
	lynx --source -accept_all_cookies "$hourly_addr2" > $HOME/1_accuweather/hourly_raw2 
	
	if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly2
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw2
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly2
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly2	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly2
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly2
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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}
	
fi	

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

Notice the weather_conky_launch_command variable at the beginning of the script.
You have a conky configuration file that uses the weather script, lets say myspecialconky, which is on your Desktop folder for example.
You have used a command to launch that conky configuration, maybe by autostarting it when booting your pc, let's say

conky -c /home/yourusername/Desktop/myspecialconky

This exact command needs to be put inside the quotes of the weather_conky_launch_command, so that the script only pauses the conky instance that has to do with the weather forecast and no other instance at all, as it has been the constant complain of many people who run multiple conkys.

Let's see how this one goes, your feedback people is worth gold.

Last edited by TeoBigusGeekus (2019-02-13 16:48:35)


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

#2265 2019-02-13 19:13:55

unklar
Member
Registered: 2015-10-31
Posts: 914

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

It's nice and warm in Texas.  smile

Teo, this is what my "conkyspecial" big_smile  looks like after the start of the PC and the 2nd update:
us_neu.th.jpg

and this is
.conkyrc_1_weatherfont_wind
after the 2nd update
us_neu1.th.jpg
the curr_cond for this

1
14
15
Sunny
S
15 km/h
42%
1018.80 mb
4
0%
7652 m
1
16 km
07:13 AM
06:17 PM
11:04 hr
EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT
12:30 PM
02:27 AM
13:57 hr
a
07:13
18:17
12:30
02:27
1
 

there are no errors in the terminal  cool

Offline

#2266 2019-02-13 19:32:22

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

It looks nice, but what's that anomaly in the first pic?


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

#2267 2019-02-13 19:34:59

unklar
Member
Registered: 2015-10-31
Posts: 914

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

I still have to investigate   smile

Offline

#2268 2019-02-13 19:36:56

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Maybe two conky configs that show upon each other?


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

#2269 2019-02-13 19:44:53

unklar
Member
Registered: 2015-10-31
Posts: 914

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

No, it's just this
The relevant part is the

conky.text = [[
${image $HOME/eadwine/fond/ed.png -p 0,10 -s 260x260}\

${texeci 600 bash $HOME/1_accuweather/1_accuweather_us -f}\
${voffset 5}${goto 20}${color6}${font conkyweather:size=60}${execi 90  sed -n '22p' $HOME/1_accuweather/curr_cond}${font monofur:size=45}${goto 150}${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond}°
${voffset -33}${goto 16}${color5}${font monofur:size=10}CURRENTLY: ${color6}${alignc}${execi 90  sed -n '4p' $HOME/1_accuweather/curr_cond} 
${goto 16}${color5}WIND: ${color6}${alignc}${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond}  ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}${goto 195}${voffset -15}${font ConkyWindNESW:size=40}${execi 90 sed -n '27p' $HOME/1_accuweather/curr_cond}
${voffset -45}${goto 16}${color5}${font monofur:size=10}PRESSURE: ${color6}${alignc}${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond}
${voffset 7}${goto 25}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}${goto 100}${execi 90  sed -n '13p' $HOME/1_accuweather/first_days}${goto 170}${execi 90  sed -n '18p' $HOME/1_accuweather/first_days}
${goto 30}${font conkyweather:size=22}${execi 90  sed -n '27p' $HOME/1_accuweather/first_days}${goto 100}${execi 90  sed -n '28p' $HOME/1_accuweather/first_days}${goto 170}${execi 90  sed -n '29p' $HOME/1_accuweather/first_days}
${voffset -15}${goto 45}${font monofur:size=10}${execi 90  sed -n '9p' $HOME/1_accuweather/first_days}${goto 120}${execi 90  sed -n '14p' $HOME/1_accuweather/first_days}${goto 190}${execi 90  sed -n '19p' $HOME/1_accuweather/first_days}

${goto 20}${color5}${font monofur:size=14}${execi 90 sed -n '6p' $HOME/1_accuweather/first_days|cut -c1-3}${goto 100}${color6}${execi 90 sed -n '11p' $HOME/1_accuweather/first_days|cut -c1-3}${goto 180}${execi 90 sed -n '16p' $HOME/1_accuweather/first_days|cut -c1-3}

]];

But the second picture also has this error...

Offline

#2270 2019-02-13 20:02:35

unklar
Member
Registered: 2015-10-31
Posts: 914

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

Teo, in the curr_cond the 22p is now the 21 !

This is the error also in the second picture.   wink
it comes through the extra line, which the script sets to line17  ?
and, the line 27p for the wind is not written at all.

Last edited by unklar (2019-02-13 20:10:04)

Offline

#2271 2019-02-13 20:17:59

unklar
Member
Registered: 2015-10-31
Posts: 914

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

with the correction 21p
fertig.th.jpg

Offline

#2272 2019-02-13 20:52:04

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Spot on my dear friend, the curr_cond file needed another extra line:

NEW NEW VERSION

#!/usr/bin/env bash

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

#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_16hours=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_8h && $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_8h)
				h_16hours=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


#Put your Accuweather address here
#address="http://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="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
#address="http://www.accuweather.com/en/de/lichtenstein/09350/weather-forecast/171261"


#########################
# Test for USA location #
#########################
if [[ $(echo $address|awk 'BEGIN { FS = "/" } ; { print $5 }') == us ]]; then
	is_us=1
else
	is_us=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 == 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"
	lynx --source -accept_all_cookies "$curr_addr" > $HOME/1_accuweather/curr_cond_raw 
	
	addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
	lynx --source -accept_all_cookies "$addr1" > $HOME/1_accuweather/first_days_raw 
	
	addr2="$addr1"?day=6
	lynx --source -accept_all_cookies "$addr2" > $HOME/1_accuweather/last_days_raw 
	
	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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-now/,/TEMPERATURE SUMMARY/!d' $HOME/1_accuweather/curr_cond_raw
			egrep -i '&deg|svg|phrase|wind-point|speed|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|</time>' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
			sed -i -e '/<img class="icon/d' -e '/TEMPERATURE SUMMARY/d' $HOME/1_accuweather/curr_cond
			sed -i -e 's/^.*\/icons\///g' -e 's/\.svg.*$//g' -e 's/&deg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*RealFeel&#174; //g' -e 's/^.*phrase">//g' -e 's/<\/div>//g' -e 's/^.*wind-point //g' -e '5s/">//' -e 's/^.*">//g' -e 's/<\/time>//g' -e 's/^.*: //g' -e '8s/ &darr.*$//' -e '8s/ &uarr.*$//' -e '12s/°&.*$//' -e '17i EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT' -e 's/\r//g' $HOME/1_accuweather/curr_cond
			sed -i '1s/^0//' $HOME/1_accuweather/curr_cond
		fi
	    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
        
        # For reasons unknown this has to be done here; if it's moved to its proper position (close to the previous insert to the 17th line of the curr_cond file - see line 341 of the script) it fails miserably. If anyone knows why, please explain it to me.
        if [[ $is_us == 1 ]]; then
			sed -i '21i ANOTHER EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT' $HOME/1_accuweather/curr_cond
		fi
		
	fi
	
	#First 5 days
	if [[ -s $HOME/1_accuweather/first_days_raw ]]; then
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/first_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details|"hi tonight"|"lo tonight "' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/^.*"hi tonight">//g' -e 's/^.*"lo tonight ">//g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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/' -e 's/<\/span>//g' $HOME/1_accuweather/first_days
			for (( i=2; i<=22; i+=5 ))
			  do
		          sed -i ${i}s/^0// $HOME/1_accuweather/first_days
			  done
		fi
	    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
		if [[ $is_us == 0 ]]; 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
		elif [[ $is_us == 1 ]]; then
			sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/1_accuweather/last_days_raw
			egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
			sed -i -e 's/^.*href="#">//g' -e 's/^.*icons\///g' -e 's/\.svg.*$//g' -e 's/^.*"hi">//g' -e 's/^.*"lo">\///g' -e 's/&deg;.*$//g' -e 's/^.*"details">//g' -e '/svg/d' -e 's/<\/a>.*$//g' -e 's/<\/div>.*$//g' -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/last_days
			for (( i=2; i<=22; i+=5 ))
			  do
		          sed -i ${i}s/^0// $HOME/1_accuweather/last_days
			  done
		fi
	    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
fi


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

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

	#Hourly: First 8h
	
	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"
	lynx --source -accept_all_cookies "$hourly_addr1" > $HOME/1_accuweather/hourly_raw1 
	
	if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly1
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw1
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly1
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly1	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly1
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly1
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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)
	lynx --source -accept_all_cookies "$hourly_addr2" > $HOME/1_accuweather/hourly_raw2 
	
	if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
		if [[ $is_us == 0 ]]; 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' -e 's/\&amp;/\&/g' $HOME/1_accuweather/hourly2
		elif [[ $is_us == 1 ]]; then
			sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/1_accuweather/hourly_raw2
			egrep -i 'class="next"|hour day|hour night|icon-weather|<div>.*<\/div>|<span>.*<\/span>|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|<th>Forecast|<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 '1s/^.*https/https/' -e '1s/".*$//' -e 's/^\t*//g' -e 's/<\/th>//g' -e 's/<th class=".*>//g' -e 's/^<th>//g' -e 's/^<div>//g' -e 's/<div class="icon-weather icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>//g' -e 's/<span>//g' -e 's/<\/span>//g' -e 's/&#.*$//g' -e 's/\r//g' $HOME/1_accuweather/hourly2
			touch $HOME/1_accuweather/temp_file
			for (( i=12; i<=26; i+=2 ))
			  do
				  sed -n ${i}p $HOME/1_accuweather/hourly2	>> $HOME/1_accuweather/temp_file

			  done
			for (( i=26; i>=12; i-=2 ))
			  do
				  sed -i ${i}d $HOME/1_accuweather/hourly2
			  done
			counter=1
			for (( i=10; i>=3; i-=1 ))
			  do
		          h_img=$(sed -n ${counter}p $HOME/1_accuweather/temp_file)
		          sed -i "$i a $h_img" $HOME/1_accuweather/hourly2
				  ((counter++))
			  done
			rm $HOME/1_accuweather/temp_file
		fi
		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}
	
fi	

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

If someone could explain to me lines 377 to 380 I'd be much obliged...

PS: Many thanks for your support unklar, I really appreciate it.
PS2: (with a Borat accent) Where are the Americans? It's their script anyway...

Last edited by TeoBigusGeekus (2019-02-13 20:59: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

#2273 2019-02-13 21:07:16

unklar
Member
Registered: 2015-10-31
Posts: 914

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

Teo, this fits perfectly!
It is the 22p again and the 27p for the wind is also there

2
17
17
Mostly sunny
S
19 km/h
35%
1018.20 mb
3
20%
8843 m
1
16 km
07:13 AM
06:17 PM
11:04 hr
EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT
12:30 PM
02:27 AM
13:57 hr
ANOTHER EXTRA LINE FOR COMPATIBILITY WITH THE INT SCRIPT
b
07:13
18:17
12:30
02:27
1

You're a true master.  good2.gif

Edit:  and, the lines 377 to 380 I can't explain to you   big_smile

Last edited by unklar (2019-02-13 21:11:05)

Offline

#2274 2019-02-13 21:13:11

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 968

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

Thanks for your sharp eyes unklar!

Any opinion on the usage of the pkill command? Is it convenient for you?
I had an argument in the past with S11 about it: I believed that it was too complicated for the average user, but it seems to me now that it's the only answer to the problems that arose with the kill commands and their habit of randomly shooting and killing conky processes.


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

#2275 2019-02-13 21:25:47

unklar
Member
Registered: 2015-10-31
Posts: 914

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

TeoBigusGeekus wrote:

Any opinion on the usage of the pkill command? Is it convenient for you?

I can't answer that easily right now. I think it takes more time to judge.
What's not clear to me at the moment is that I often have to start conkies automatically on different workspaces with your script. Hm, but now there can only be one path in the script...   hmm

In any case, I will accept what you'rs and Sector11 say.   cool

Last edited by unklar (2019-02-13 21:30:55)

Offline

Board footer

Powered by FluxBB