You are not logged in.
Offline
Ah, ok then, glad you've sorted it out.
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
For my old script, may-be it's because jq count icons since zero (0,1,2,3, etc...) and not since one (1,2,3, etc...)
Offline
I update my script (and cleaner)
I think that is all good:
https://sd-1.archive-host.com/membres/u … rk_sky.zip
Offline
Nice job chepioq, I still believe it deserves its own thread.
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
May be it deserves its own thread, but I prefer to leave it on this thread because it is the one for "Conky weather".
For me it's a training until the arrival of the new wunderground API.
https://apicommunity.wunderground.com/w … reply-list page 4
We'd like to remind our PWS owners/contributors:
Your past data will always be available to you for viewing and download in a web browser on wunderground.com, just like it always has.
If you are in the small minority of people who use the WU API and a corresponding WU API key to obtain data in .json format, here's what's happening:
- We'll open a registration page for you to get a new API key to get your data in .json format
- You'll sign up and get a new API key for the new API
- Once the registration page is open, we'll keep the old API and your old API key active for 2 weeks to allow transition time to your new keyWe'll announce in the forum when the registration page opens.
Or, email victoria.gardner@ibm.com to receive an email notification once it's ready.The new API will provide access to
Current observations from the PWS network
5 day daily forecast
PWS historical data
PWS lookup by geocode, zip code and location
Call volume: 1500/day, 30/minute
Last edited by chepioq (2019-02-01 12:22:20)
Offline
I've been using your scripts for a few years now Teo and yet again, we have ran into a wall with accuweather. Recently (not sure exactly when), accuweather stopped displaying in my conky. When I manually run the script I get
MainFrame weather $ ./1_accuweather -f
rm: cannot remove '/home/thomas/Conky/weather/*.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/'$'\r''.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images/.png': No such file or directory
From experience, something isn't getting written correctly to the *_raw and other files. So I looked at the curr_cond file and found this output
<div class="wind
NE
<div>Humidity: 88%</div>
<div>Pressure: 30.56 in </div>
<div>UV Index: 0</div>
<div>Cloud Cover: 100%</div>
<div>Ceiling: 2745 ft</div>
<div>Dew Point: 30° F</div>
<div>Visibility: 10 mi</div>
<div class="label
<div class="label
<th scope="row
Unfortunately, I don't have an old curr_cond file so I can compare things to it.
This is what displays now though
screen shot
Last edited by seatommyboy (2019-02-09 14:27:52)
Offline
What's your location seatommyboy?
For Kastoria I get
$ ./1_accuweather -f
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
and the curr_cond file is
1
9
9
Sunny
N
8 km/h
41%
1018.40 mb
0
9%
3840 m
-3
16 km
07:37 AM
06:02 PM
10:25 hr
1-m
10:03 AM
10:23 PM
12:20 hr
33-m
a
07:37
18:02
10:03
22:23
9
ie. everything's normal.
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
What's your location seatommyboy?
For Kastoria I get$ ./1_accuweather -f kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Hutto TX
I downloaded a little more up-to-date script and now when I run it, I get no output...
Last edited by seatommyboy (2019-02-09 17:50:00)
Offline
Wait, you weren't using the latest script?
Can you post the script you're using?
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
Wait, you weren't using the latest script?
Can you post the script you're using?
Offline
I can't read it right now, but do you get a proper conky when you run the latest script?
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
I can't read it right now, but do you get a proper conky when you run the latest script?
No... displays the same as the screenshot I linked
Also, apologies for being a script or 2 behind. I also adjusted my file paths to be the same as the new script I posted.
Last edited by seatommyboy (2019-02-09 19:14:44)
Offline
It seems ok, do you get any error messages when you run the script?
Are the files (curr_cond, etc.) populated?
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
It seems ok, do you get any error messages when you run the script?
Are the files (curr_cond, etc.) populated?
They are all poputlated. I'm restoring my computer back to an earlier time to see if it was something with the upgrade I did a few weeks ago. Like I stated earlier, I'm not exactly sure when this happened, so I'm trying to narrow it down. Being that it is working for you, I'm pretty sure it's something on my end. I'll update in a bit...
Shifting back to an earlier time did not change anything...
As for the errors, the only ones I get are due to the fact that the files are not being populated:
rm: cannot remove '/home/thomas/Conky/weather/forecast_2016/forecast_*.png': No such file or directory
cp: cannot stat '/home/thomas/Conky/weather/Forecast_Images_2016/'$'\r''.png': No such file or directory
cp: target '/home/thomas/Conky/weather/forecast_2016/wind_0.png' is not a directory
conky: Unable to load image '/home/thomas/Conky/weather/0.png'
Oddly enough, when tested with another url for somewhere overseas like kastoria, buenos-aires, and tokyo, the images still don't load, but the weather does. However, if I use a us city like new york, albuquerque, or even hutto, the output is the same as the pic I linked above.
Last edited by seatommyboy (2019-02-10 03:21:11)
Offline
Yet another update...
I cleaned out all the file (curr_cond, etc) and deleted my .xsession.errors file. After a reboot, I checked the .xsession.errors file and here is what I found for conky:
conky: desktop window (3200028) is subwindow of root window (6c2)
conky: window type - normal
conky: drawing to created window (0x3a00002)
conky: drawing to double buffer
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/curr_cond: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/curr_cond: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/curr_cond: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
Looking up www.accuweather.com
Unable to locate remote host www.accuweather.com.
Alert!: Unable to connect to remote host.
lynx: Can't access startfile https://www.accuweather.com/en/us/hutto-tx/78634/current-weather/2110192
Looking up www.accuweather.com
Unable to locate remote host www.accuweather.com.
Alert!: Unable to connect to remote host.
lynx: Can't access startfile https://www.accuweather.com/en/us/hutto-tx/78634/daily-weather-forecast/2110192
Looking up www.accuweather.com
Unable to locate remote host www.accuweather.com.
Alert!: Unable to connect to remote host.
lynx: Can't access startfile https://www.accuweather.com/en/us/hutto-tx/78634/daily-weather-forecast/2110192?day=6
rm: cannot remove '/home/thomas/Conky/weather/forecast_2016/forecast_*.png': No such file or directory
sed: can't read /home/thomas/Conky/weather/first_days: No such file or directory
conky: Unable to load image '/home/thomas/Conky/weather/0.png'
I opened a terminal and ran:
lynx https://www.accuweather.com/en/us/hutto-tx/78634/weather-forecast/2110192
And lynx connected with no problem. I was able to see my current weather.
Last edited by seatommyboy (2019-02-10 04:05:20)
Offline
I apologize seatommyboy, when calling accuweather for a us location the source page is completely different from when calling it for an international location.
I'll investigate asap.
How long has this been going on? Why hasn't anyone complained?
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
Hello
i have probleme with chepioq's conky
here terminal
romuald@Strix:~$ conky -c ~/conky-meteo-dark_sky/conky-meteo2
conky: desktop window (a00008) is subwindow of root window (28a)
conky: window type - dock
conky: drawing to created window (0x4e00002)
conky: drawing to double buffer
--2019-02-10 17:31:32-- https://api.darksky.net/forecast/fxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/49.1095,7.0709?lang=fr&units=si
Résolution de api.darksky.net (api.darksky.net)… 35.174.96.85, 34.193.12.42, 52.204.198.249
Connexion à api.darksky.net (api.darksky.net)|35.174.96.85|:443… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 28964 (28K) [application/json]
Enregistre : «/home/romuald/conky-meteo-dark_sky/weather.json»
/home/romuald/conky-mete 100%[==================================>] 28,29K --.-KB/s ds 0,002s
2019-02-10 17:31:32 (14,2 MB/s) - «/home/romuald/conky-meteo-dark_sky/weather.json» enregistré [28964/28964]
/home/romuald/conky-meteo-dark_sky/3b1: 52: /home/romuald/conky-meteo-dark_sky/3b1: Syntax error: Bad for loop variable
conky: Unable to load image '/home/romuald/conky-meteo-dark_sky/d1.png'
conky: Unable to load image '/home/romuald/conky-meteo-dark_sky/d1.png'
conky: Unable to load image '/home/romuald/conky-meteo-dark_sky/d1.png'
here 3b1
#!/bin/bash
wget -O $HOME/conky-meteo-dark_sky/weather.json https://api.darksky.net/forecast/fxxxxxxxxxxxxxxxfd/'49.1095,7.0709'?'lang=fr&units=si'
Dark_Sky_icons () {
case $1 in
clear-day)
echo 1
;;
clear-night)
echo 2
;;
cloudy)
echo 3
;;
fog)
echo 4
;;
partly-cloudy-day)
echo 5
;;
partly-cloudy-night)
echo 6
;;
rain)
echo 7
;;
sleet)
echo 8
;;
snow)
echo 9
;;
wind)
echo 10
;;
esac
}
rm $HOME/conky-meteo-dark_sky/*.png
#Forecast feature: Forecast
jq --raw-output '.currently[]' $HOME/conky-meteo-dark_sky/weather.json > Conditions
cp $HOME/conky-meteo-dark_sky/Dark_Sky_icons/$(Dark_Sky_icons $(sed -n 3p $HOME/conky-meteo-dark_sky/Conditions)).png $HOME/conky-meteo-dark_sky/Now.png
jq --raw-output '.daily.data[].icon' $HOME/conky-meteo-dark_sky/weather.json > daily-icons
cat $HOME/conky-meteo-dark_sky/weather.json | jq '.daily.data' | sed 's/[",:,},{]//g' | awk '{$1=""}1' | sed 's/^[ \t]*//' | sed '/./!d' > Forecasts
for (( i=1; i<=8; i+=1 ))
do
cp $HOME/conky-meteo-dark_sky/Dark_Sky_icons/$(Dark_Sky_icons $(sed -n ${i}p $HOME/conky-meteo-dark_sky/daily-icons)).png $HOME/conky-meteo-dark_sky/d$(( i )).png
done
#Hourly feature, commented out by default, uncomment if you wish so
#for (( j=1; j<=24; j+=1 ))
# do
# cp $HOME/conky-meteo-dark_sky/Dark_Sky_icons/$(Dark_Sky_icons $(sed -n ${j}p $HOME/conky-meteo-dark_sky/hourly-icons)).png $HOME/conky-meteo-dark_sky/h$(( j )).png
# done
# icone direction vent
wind_direction=$(cat $HOME/conky-meteo-dark_sky/weather.json | jq --raw-output '.currently.windBearing')
if [[ $wind_direction > 0 ]] && [[ $wind_direction < 12 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"01.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 34 ]] && [[ $wind_direction < 56 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"03.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 56 ]] && [[ $wind_direction < 78 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"04.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 78 ]] && [[ $wind_direction < 101 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"05.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 101 ]] && [[ $wind_direction < 124 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"06.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 124 ]] && [[ $wind_direction < 146 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"07.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 146 ]] && [[ $wind_direction < 169 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"08.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 169 ]] && [[ $wind_direction < 192 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"09.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 192 ]] && [[ $wind_direction < 214 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"10.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 214 ]] && [[ $wind_direction < 236 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"11.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 236 ]] && [[ $wind_direction < 259 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"12.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 259 ]] && [[ $wind_direction < 281 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"13.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 281 ]] && [[ $wind_direction < 304 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"14.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 304 ]] && [[ $wind_direction < 326 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"15.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 326 ]] && [[ $wind_direction < 349 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"16.png" $HOME/conky-meteo-dark_sky/Wind.png
elif [[ $wind_direction > 349 ]] && [[ $wind_direction < 360 ]]; then
cp $HOME/conky-meteo-dark_sky/vent/"01.png" $HOME/conky-meteo-dark_sky/Wind.png
fi
line 52 in 3b1
for (( i=1; i<=8; i+=1 ))
daylis icons
rain
partly-cloudy-day
partly-cloudy-day
partly-cloudy-day
clear-day
clear-day
clear-day
clear-day
@+
Last edited by loutch (2019-02-10 16:45:59)
multi-boot 7-Mageia5 kde -linuxmint Sarah xfce & linuxmint Serena cinnamoon on hp pavilion g7
Xubuntu 18.10 xfce on ASUS Rog STRIX
tanks to http://www.stci.qc.ca/affiche_smilies.php for the smileys
Offline
It never rains but it pours...
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
I don't know what happen for you, that work for me.
For daily-icons I have that :
partly-cloudy-day
clear-day
partly-cloudy-night
clear-day
clear-day
clear-day
clear-day
clear-day
Offline
I apologize seatommyboy, when calling accuweather for a us location the source page is completely different from when calling it for an international location.
I'll investigate asap.
How long has this been going on? Why hasn't anyone complained?
I want to say that it started happening about 3 weeks ago. But it at first, it appeared to be that sed was reading to many spaces and there would be extra characters appearing. But it fully stopped displaying any weather about a week or so ago, after I manually removed the curr_cond, etc files, and others see the weather and think it is current when it's actually residual information???
None-the-less, thanks for your help Teo!
Offline
Use the following script temporarily. Current conditions, first 5 days and last 5 days have been fixed. Only the hourly forecast remains to be tackled...
Don't forget to change the folder paths.
Thanks for the feedback and hold on until the final version is out!
#!/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
}
kill -STOP $(pidof conky)
curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
lynx --source -accept_all_cookies "$curr_addr" > $HOME/Desktop/1_test/curr_cond_raw
addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
lynx --source -accept_all_cookies "$addr1" > $HOME/Desktop/1_test/first_days_raw
addr2="$addr1"?day=6
lynx --source -accept_all_cookies "$addr2" > $HOME/Desktop/1_test/last_days_raw
if [[ $forecast2015 == 1 ]]; then
rm $HOME/Desktop/1_test/forecast_2015/forecast_*.png
fi
if [[ $forecast2016 == 1 ]]; then
rm $HOME/Desktop/1_test/forecast_2016/forecast_*.png
fi
#current conditions
if [[ -s $HOME/Desktop/1_test/curr_cond_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/Desktop/1_test/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/Desktop/1_test/curr_cond_raw > $HOME/Desktop/1_test/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/Desktop/1_test/curr_cond
sed -i -e 's/">.*$//g' -e 's/°.*$//g' -e 's/<\/span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/<\/strong>.*$//g' $HOME/Desktop/1_test/curr_cond
sed -i '1s/-.*$//' $HOME/Desktop/1_test/curr_cond
elif [[ $is_us == 1 ]]; then
sed -i '/detail-now/,/TEMPERATURE SUMMARY/!d' $HOME/Desktop/1_test/curr_cond_raw
egrep -i '°|svg|phrase|wind-point|speed|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|</time>' $HOME/Desktop/1_test/curr_cond_raw > $HOME/Desktop/1_test/curr_cond
sed -i -e '/<img class="icon/d' -e '/TEMPERATURE SUMMARY/d' $HOME/Desktop/1_test/curr_cond
sed -i -e 's/^.*\/icons\///g' -e 's/\.svg.*$//g' -e 's/°.*$//g' -e 's/^.*"hi">//g' -e 's/^.*RealFeel® //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/Desktop/1_test/curr_cond
fi
image=$(sed -n 1p $HOME/Desktop/1_test/curr_cond)
echo $(test_image $image) >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 14p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 15p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 18p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 19p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
wind=$(sed -n 5p $HOME/Desktop/1_test/curr_cond)
echo $(test_wind $wind) >> $HOME/Desktop/1_test/curr_cond
if (( $(sed -n 14p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '14s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 15p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '15s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 18p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '18s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 19p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '19s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n 1p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2015/forecast_0.png
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n 5p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2015/wind_0.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n 1p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2016/forecast_0.png
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n 5p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2016/wind_0.png
fi
fi
#First 5 days
if [[ -s $HOME/Desktop/1_test/first_days_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/Desktop/1_test/first_days_raw
egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/Desktop/1_test/first_days_raw > $HOME/Desktop/1_test/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/Desktop/1_test/first_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/Desktop/1_test/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/Desktop/1_test/first_days
elif [[ $is_us == 1 ]]; then
sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/Desktop/1_test/first_days_raw
egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/Desktop/1_test/first_days_raw > $HOME/Desktop/1_test/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/°.*$//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/Desktop/1_test/first_days
for (( i=2; i<=22; i+=5 ))
do
sed -i ${i}s/^0// $HOME/Desktop/1_test/first_days
done
fi
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/first_days)
echo $(test_image $image) >> $HOME/Desktop/1_test/first_days
done
if [[ $forecast0 == 0 ]]; then
j=1
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/first_days).png $HOME/Desktop/1_test/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/first_days).png $HOME/Desktop/1_test/forecast_2016/forecast_$j.png
fi
((j++))
done
fi
fi
#Next 5 days
if [[ -s $HOME/Desktop/1_test/last_days_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/Desktop/1_test/last_days_raw
egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/Desktop/1_test/last_days_raw > $HOME/Desktop/1_test/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/Desktop/1_test/last_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/Desktop/1_test/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/Desktop/1_test/last_days
elif [[ $is_us == 1 ]]; then
sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/Desktop/1_test/last_days_raw
egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/Desktop/1_test/last_days_raw > $HOME/Desktop/1_test/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/°.*$//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/Desktop/1_test/last_days
for (( i=2; i<=22; i+=5 ))
do
sed -i ${i}s/^0// $HOME/Desktop/1_test/last_days
done
fi
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/last_days)
echo $(test_image $image) >> $HOME/Desktop/1_test/last_days
done
if [[ $forecast0 == 0 ]]; then
j=6
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/last_days).png $HOME/Desktop/1_test/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/last_days).png $HOME/Desktop/1_test/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 [[ $forecast0 != 1 && $forecast2015 != 1 && $forecast2016 != 1 ]]; then
kill -STOP $(pidof conky)
fi
if [[ $hourly2015 == 1 ]]; then
rm $HOME/Desktop/1_test/hourly_2015/hourly_*.png
fi
if [[ $hourly2016 == 1 ]]; then
rm $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw1
if [[ -s $HOME/Desktop/1_test/hourly_raw1 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw1 > $HOME/Desktop/1_test/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/Desktop/1_test/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/\&/\&/g' $HOME/Desktop/1_test/hourly1
echo "ConkyWeather Font Icons" >> $HOME/Desktop/1_test/hourly1
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/hourly1)
echo $(test_image $image) >> $HOME/Desktop/1_test/hourly1
done
if [[ $hourly0 == 0 ]]; then
j=1
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/hourly1).png $HOME/Desktop/1_test/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/hourly1).png $HOME/Desktop/1_test/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
#Hourly: Next 8h
hourly_addr2=$(sed -n 1p $HOME/Desktop/1_test/hourly1)
lynx --source -accept_all_cookies "$hourly_addr2" > $HOME/Desktop/1_test/hourly_raw2
if [[ -s $HOME/Desktop/1_test/hourly_raw2 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw2 > $HOME/Desktop/1_test/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/Desktop/1_test/hourly2
sed -i 1d $HOME/Desktop/1_test/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/\&/\&/g' $HOME/Desktop/1_test/hourly2
echo "ConkyWeather Font Icons" >> $HOME/Desktop/1_test/hourly2
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/hourly2)
echo $(test_image $image) >> $HOME/Desktop/1_test/hourly2
done
if [[ $hourly0 == 0 ]]; then
j=9
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/hourly2).png $HOME/Desktop/1_test/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/hourly2).png $HOME/Desktop/1_test/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
# Full info, next 16h - altogether16 file
rm $HOME/Desktop/1_test/{altogether16,altogether16_2015,altogether16_2016}
#TIME
echo "\${color ffe595}TIME\${goto 100}" > $HOME/Desktop/1_test/altogether16
sed -i "1s/$/$(sed -n 2p $HOME/Desktop/1_test/hourly1):$(sed -n 3p $HOME/Desktop/1_test/hourly1)/" $HOME/Desktop/1_test/altogether16
jump_to=160
for (( i=5; i<=17; i+=2 ))
do
time=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "1s/$/\${goto $jump_to}$time/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
sed -i "1s/$/\${goto 580}$(sed -n 2p $HOME/Desktop/1_test/hourly2):$(sed -n 3p $HOME/Desktop/1_test/hourly2)/" $HOME/Desktop/1_test/altogether16
jump_to=640
for (( i=5; i<=17; i+=2 ))
do
time=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "1s/$/\${goto $jump_to}$time/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '1s/$/\n\n\n/' $HOME/Desktop/1_test/altogether16
#FORECAST
echo "\${color ffe595}FORECAST\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '5s/$/\n/' $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#TEMPERATURE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "TEMPER.\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#REAL FEEL
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "REAL FEEL\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#WIND
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "WIND\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#RAIN
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "RAIN\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#SNOW
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "SNOW\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#ICE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "ICE\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#UV INDEX
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "UV INDEX\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#CLOUD COVER
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "CLOUD COV.\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#HUMIDITY
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "HUMIDITY\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#DEW POINT
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "DEW POINT\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#VISIBILITY
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "VISIBILITY\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=135; i<=142; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=135; i<=142; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#IMAGES
if [[ $hourly0 == 0 ]]; then
if [[ $hourly2015 == 1 ]]; then
jump_to=75
cp $HOME/Desktop/1_test/altogether16 $HOME/Desktop/1_test/altogether16_2015
fi
if [[ $hourly2016 == 1 ]]; then
jump_to=85
cp $HOME/Desktop/1_test/altogether16 $HOME/Desktop/1_test/altogether16_2016
fi
rm $HOME/Desktop/1_test/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/Desktop/1_test/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/Desktop/1_test/altogether16_2016
fi
((jump_to+=60))
done
fi
#CONKYFONT
if [[ $hourly0 == 1 ]]; then
sed -i '4s/$/\${color}\${font conkyweather:size=35}/' $HOME/Desktop/1_test/altogether16
jump_to=95
for (( i=144; i<=151; i+=1 ))
do
sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)/" $HOME/Desktop/1_test/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/Desktop/1_test/hourly2)/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '4s/$/\${font}/' $HOME/Desktop/1_test/altogether16
sed -i '2,3d' $HOME/Desktop/1_test/altogether16
fi
#DELETE UNWANTED VARIABLES
if [[ $h_real == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '7,8s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_wind == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_rain == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_snow == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_ice == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_uv == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_cloud == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_humid == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_dew == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_visib == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '27,28s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '27,28s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
sed -i '/VOID/d' $HOME/Desktop/1_test/{altogether16,altogether16_2015,altogether16_2016}
kill -CONT $(pidof conky)
fi
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
Use the following script temporarily. Current conditions, first 5 days and last 5 days have been fixed. Only the hourly forecast remains to be tackled...
Don't forget to change the folder paths.
Thanks for the feedback and hold on until the final version is out!
I tested what you posted above. It works ish... When I tried to restart conky, it stops. But I ran the script manually and everything looks correct now. I commented out the line in my .conkyrc than executes the script
#${execi 600 bash $HOME/Conky/weather/1_accuweather -f}
and the weather appears correctly. Still no icons either, but I'm more worried about getting the script to run correctly first. Thanks again!
Offline
Icons appear perfectly for Hutto, both the 2015 and the 2016 ones.
Perhaps your folder paths?
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
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.
#!/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
}
kill -STOP $(pidof conky)
curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
lynx --source -accept_all_cookies "$curr_addr" > $HOME/Desktop/1_test/curr_cond_raw
addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
lynx --source -accept_all_cookies "$addr1" > $HOME/Desktop/1_test/first_days_raw
addr2="$addr1"?day=6
lynx --source -accept_all_cookies "$addr2" > $HOME/Desktop/1_test/last_days_raw
if [[ $forecast2015 == 1 ]]; then
rm $HOME/Desktop/1_test/forecast_2015/forecast_*.png
fi
if [[ $forecast2016 == 1 ]]; then
rm $HOME/Desktop/1_test/forecast_2016/forecast_*.png
fi
#current conditions
if [[ -s $HOME/Desktop/1_test/curr_cond_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/Desktop/1_test/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/Desktop/1_test/curr_cond_raw > $HOME/Desktop/1_test/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/Desktop/1_test/curr_cond
sed -i -e 's/">.*$//g' -e 's/°.*$//g' -e 's/<\/span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/<\/strong>.*$//g' $HOME/Desktop/1_test/curr_cond
sed -i '1s/-.*$//' $HOME/Desktop/1_test/curr_cond
elif [[ $is_us == 1 ]]; then
sed -i '/detail-now/,/TEMPERATURE SUMMARY/!d' $HOME/Desktop/1_test/curr_cond_raw
egrep -i '°|svg|phrase|wind-point|speed|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|</time>' $HOME/Desktop/1_test/curr_cond_raw > $HOME/Desktop/1_test/curr_cond
sed -i -e '/<img class="icon/d' -e '/TEMPERATURE SUMMARY/d' $HOME/Desktop/1_test/curr_cond
sed -i -e 's/^.*\/icons\///g' -e 's/\.svg.*$//g' -e 's/°.*$//g' -e 's/^.*"hi">//g' -e 's/^.*RealFeel® //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/Desktop/1_test/curr_cond
sed -i '1s/^0//' $HOME/Desktop/1_test/curr_cond
fi
image=$(sed -n 1p $HOME/Desktop/1_test/curr_cond)
echo $(test_image $image) >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 14p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 15p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 18p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
sunrise_time=$(sed -n 19p $HOME/Desktop/1_test/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/Desktop/1_test/curr_cond
wind=$(sed -n 5p $HOME/Desktop/1_test/curr_cond)
echo $(test_wind $wind) >> $HOME/Desktop/1_test/curr_cond
if (( $(sed -n 14p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '14s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 15p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '15s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 18p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '18s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if (( $(sed -n 19p /$HOME/Desktop/1_test/curr_cond|wc -c) == 8 )); then
sed -i '19s/^/0/' $HOME/Desktop/1_test/curr_cond
fi
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n 1p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2015/forecast_0.png
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n 5p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2015/wind_0.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n 1p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2016/forecast_0.png
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n 5p $HOME/Desktop/1_test/curr_cond).png $HOME/Desktop/1_test/forecast_2016/wind_0.png
fi
fi
#First 5 days
if [[ -s $HOME/Desktop/1_test/first_days_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/Desktop/1_test/first_days_raw
egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/Desktop/1_test/first_days_raw > $HOME/Desktop/1_test/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/Desktop/1_test/first_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/Desktop/1_test/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/Desktop/1_test/first_days
elif [[ $is_us == 1 ]]; then
sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/Desktop/1_test/first_days_raw
egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/Desktop/1_test/first_days_raw > $HOME/Desktop/1_test/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/°.*$//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/Desktop/1_test/first_days
for (( i=2; i<=22; i+=5 ))
do
sed -i ${i}s/^0// $HOME/Desktop/1_test/first_days
done
fi
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/first_days)
echo $(test_image $image) >> $HOME/Desktop/1_test/first_days
done
if [[ $forecast0 == 0 ]]; then
j=1
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/first_days).png $HOME/Desktop/1_test/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/first_days).png $HOME/Desktop/1_test/forecast_2016/forecast_$j.png
fi
((j++))
done
fi
fi
#Next 5 days
if [[ -s $HOME/Desktop/1_test/last_days_raw ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/Desktop/1_test/last_days_raw
egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/Desktop/1_test/last_days_raw > $HOME/Desktop/1_test/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/Desktop/1_test/last_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/Desktop/1_test/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/Desktop/1_test/last_days
elif [[ $is_us == 1 ]]; then
sed -i '/<div class="five-day">/,/<ul id="detail-tab-buttons" class="block-tabs">/!d' $HOME/Desktop/1_test/last_days_raw
egrep -i 'href="#"|svg|"hi"|"lo"|details' $HOME/Desktop/1_test/last_days_raw > $HOME/Desktop/1_test/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/°.*$//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/Desktop/1_test/last_days
for (( i=2; i<=22; i+=5 ))
do
sed -i ${i}s/^0// $HOME/Desktop/1_test/last_days
done
fi
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/last_days)
echo $(test_image $image) >> $HOME/Desktop/1_test/last_days
done
if [[ $forecast0 == 0 ]]; then
j=6
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/last_days).png $HOME/Desktop/1_test/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/last_days).png $HOME/Desktop/1_test/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 [[ $forecast0 != 1 && $forecast2015 != 1 && $forecast2016 != 1 ]]; then
kill -STOP $(pidof conky)
fi
if [[ $hourly2015 == 1 ]]; then
rm $HOME/Desktop/1_test/hourly_2015/hourly_*.png
fi
if [[ $hourly2016 == 1 ]]; then
rm $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw1
if [[ -s $HOME/Desktop/1_test/hourly_raw1 ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw1 > $HOME/Desktop/1_test/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/Desktop/1_test/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/\&/\&/g' $HOME/Desktop/1_test/hourly1
elif [[ $is_us == 1 ]]; then
sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw1 > $HOME/Desktop/1_test/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' $HOME/Desktop/1_test/hourly1
touch $HOME/Desktop/1_test/temp_file
for (( i=12; i<=26; i+=2 ))
do
sed -n ${i}p $HOME/Desktop/1_test/hourly1 >> $HOME/Desktop/1_test/temp_file
done
for (( i=26; i>=12; i-=2 ))
do
sed -i ${i}d $HOME/Desktop/1_test/hourly1
done
counter=1
for (( i=10; i>=3; i-=1 ))
do
h_img=$(sed -n ${counter}p $HOME/Desktop/1_test/temp_file)
sed -i "$i a $h_img" $HOME/Desktop/1_test/hourly1
((counter++))
done
rm $HOME/Desktop/1_test/temp_file
fi
echo "ConkyWeather Font Icons" >> $HOME/Desktop/1_test/hourly1
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/hourly1)
echo $(test_image $image) >> $HOME/Desktop/1_test/hourly1
done
if [[ $hourly0 == 0 ]]; then
j=1
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/hourly1).png $HOME/Desktop/1_test/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/hourly1).png $HOME/Desktop/1_test/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
#Hourly: Next 8h
hourly_addr2=$(sed -n 1p $HOME/Desktop/1_test/hourly1)
lynx --source -accept_all_cookies "$hourly_addr2" > $HOME/Desktop/1_test/hourly_raw2
if [[ -s $HOME/Desktop/1_test/hourly_raw2 ]]; then
if [[ $is_us == 0 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw2 > $HOME/Desktop/1_test/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/Desktop/1_test/hourly2
sed -i 1d $HOME/Desktop/1_test/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/\&/\&/g' $HOME/Desktop/1_test/hourly2
elif [[ $is_us == 1 ]]; then
sed -i '/detail-hourly" class="detail-tab-panel/,/block hourly-graph/!d' $HOME/Desktop/1_test/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/Desktop/1_test/hourly_raw2 > $HOME/Desktop/1_test/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' $HOME/Desktop/1_test/hourly2
touch $HOME/Desktop/1_test/temp_file
for (( i=12; i<=26; i+=2 ))
do
sed -n ${i}p $HOME/Desktop/1_test/hourly2 >> $HOME/Desktop/1_test/temp_file
done
for (( i=26; i>=12; i-=2 ))
do
sed -i ${i}d $HOME/Desktop/1_test/hourly2
done
counter=1
for (( i=10; i>=3; i-=1 ))
do
h_img=$(sed -n ${counter}p $HOME/Desktop/1_test/temp_file)
sed -i "$i a $h_img" $HOME/Desktop/1_test/hourly2
((counter++))
done
rm $HOME/Desktop/1_test/temp_file
fi
echo "ConkyWeather Font Icons" >> $HOME/Desktop/1_test/hourly2
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/Desktop/1_test/hourly2)
echo $(test_image $image) >> $HOME/Desktop/1_test/hourly2
done
if [[ $hourly0 == 0 ]]; then
j=9
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2015/$(sed -n ${i}p $HOME/Desktop/1_test/hourly2).png $HOME/Desktop/1_test/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/Desktop/1_test/Forecast_Images_2016/$(sed -n ${i}p $HOME/Desktop/1_test/hourly2).png $HOME/Desktop/1_test/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
# Full info, next 16h - altogether16 file
rm $HOME/Desktop/1_test/{altogether16,altogether16_2015,altogether16_2016}
#TIME
echo "\${color ffe595}TIME\${goto 100}" > $HOME/Desktop/1_test/altogether16
sed -i "1s/$/$(sed -n 2p $HOME/Desktop/1_test/hourly1):$(sed -n 3p $HOME/Desktop/1_test/hourly1)/" $HOME/Desktop/1_test/altogether16
jump_to=160
for (( i=5; i<=17; i+=2 ))
do
time=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "1s/$/\${goto $jump_to}$time/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
sed -i "1s/$/\${goto 580}$(sed -n 2p $HOME/Desktop/1_test/hourly2):$(sed -n 3p $HOME/Desktop/1_test/hourly2)/" $HOME/Desktop/1_test/altogether16
jump_to=640
for (( i=5; i<=17; i+=2 ))
do
time=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "1s/$/\${goto $jump_to}$time/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '1s/$/\n\n\n/' $HOME/Desktop/1_test/altogether16
#FORECAST
echo "\${color ffe595}FORECAST\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '5s/$/\n/' $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#TEMPERATURE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "TEMPER.\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#REAL FEEL
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "REAL FEEL\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#WIND
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "WIND\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#RAIN
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "RAIN\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#SNOW
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "SNOW\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#ICE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "ICE\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#UV INDEX
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "UV INDEX\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#CLOUD COVER
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "CLOUD COV.\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#HUMIDITY
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "HUMIDITY\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#DEW POINT
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "DEW POINT\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#VISIBILITY
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/Desktop/1_test/altogether16
echo "VISIBILITY\${color}" >> $HOME/Desktop/1_test/altogether16
jump_to=100
for (( i=135; i<=142; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)
sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
if [[ $h_16hours == 1 ]]; then
for (( i=135; i<=142; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/Desktop/1_test/hourly2)
sed -i "28s/$/\${goto $jump_to}$messg/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
#IMAGES
if [[ $hourly0 == 0 ]]; then
if [[ $hourly2015 == 1 ]]; then
jump_to=75
cp $HOME/Desktop/1_test/altogether16 $HOME/Desktop/1_test/altogether16_2015
fi
if [[ $hourly2016 == 1 ]]; then
jump_to=85
cp $HOME/Desktop/1_test/altogether16 $HOME/Desktop/1_test/altogether16_2016
fi
rm $HOME/Desktop/1_test/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/Desktop/1_test/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/Desktop/1_test/altogether16_2016
fi
((jump_to+=60))
done
fi
#CONKYFONT
if [[ $hourly0 == 1 ]]; then
sed -i '4s/$/\${color}\${font conkyweather:size=35}/' $HOME/Desktop/1_test/altogether16
jump_to=95
for (( i=144; i<=151; i+=1 ))
do
sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/Desktop/1_test/hourly1)/" $HOME/Desktop/1_test/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/Desktop/1_test/hourly2)/" $HOME/Desktop/1_test/altogether16
((jump_to+=60))
done
fi
sed -i '4s/$/\${font}/' $HOME/Desktop/1_test/altogether16
sed -i '2,3d' $HOME/Desktop/1_test/altogether16
fi
#DELETE UNWANTED VARIABLES
if [[ $h_real == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '7,8s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_wind == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '9,10s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_rain == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '11,12s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_snow == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '13,14s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_ice == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '15,16s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_uv == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '17,18s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_cloud == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '19,20s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_humid == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '21,22s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_dew == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '23,24s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
if [[ $h_visib == 0 ]]; then
if [[ $hourly0 == 1 ]]; then
sed -i '25,26s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16
elif [[ $hourly2015 == 1 ]]; then
sed -i '27,28s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2015
elif [[ $hourly2016 == 1 ]]; then
sed -i '27,28s/^.*$/VOID/' $HOME/Desktop/1_test/altogether16_2016
fi
fi
sed -i '/VOID/d' $HOME/Desktop/1_test/{altogether16,altogether16_2015,altogether16_2016}
kill -CONT $(pidof conky)
fi
Last edited by TeoBigusGeekus (2019-02-11 22:20:02)
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