You are not logged in.
KrunchTime wrote:RE: 2 & 3...how would I determine which one gets called last and is the last one called always the last one called?
Well you said:
KrunchTime wrote:I do know that I start them off staggered a few seconds via the Openbox autostart file.
so, that's your answer in a nutshell, you staggered the start in 'autostart' so they will always be in that order.
Yeah, I thought about that later...insert foot in mouth... :8 However, I don't think you can comment out the call to the 1_accuweather script in either of those scripts as they use different options/switches:
1_accuweather -f2016
1_accuweather -h2016
@AL^: Welcome to the forums and distro(?). One of our two resident weather conky gurus should be with you shortly.
Last edited by KrunchTime (2017-08-16 04:04:36)
Offline
However, I don't think you can comment out the call to the 1_accuweather script in either of those scripts as they use different options/switches:
1_accuweather -f2016 1_accuweather -h2016
Sure you can look at my post with the scrot up there, my wife's conky calls the 1_accuweather script with all four options:
${execi 900 bash /media/5/Conky/1_accuweather/1_accuweather -f2015 -f2016 -h2015 -h2016}\
Works like a charm. ]:D
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
KrunchTime wrote:However, I don't think you can comment out the call to the 1_accuweather script in either of those scripts as they use different options/switches:
1_accuweather -f2016 1_accuweather -h2016
Sure you can look at my post with the scrot up there, my wife's conky calls the 1_accuweather script with all four options:
${execi 900 bash /media/5/Conky/1_accuweather/1_accuweather -f2015 -f2016 -h2015 -h2016}\
Works like a charm. ]:D
Yeah, I just read the Read Me file and noted that you can use more than one option/switch. Bottom line, I guess with the kill command (relatively new, right?) each different weather script is no longer designed for running with multiple scripts without some user tweaking. I've ran multiple weather scripts for awhile and the keyboard and mouse freeze only appeared within the last year or so.
Then, there's this gem in the OP...
If you use wget for downloading, these scripts are gonna kill it; you can either remove the command from the scripts or use curl instead.
I never noticed that caveat.
Last edited by KrunchTime (2017-08-16 04:41:08)
Offline
@ AL^
You were very close in the other thread with wc to find the information you are talking about - I played with it and got want you wanted regarding wc at least:
Conditions:
05 ${execi 300 sed -n '5p' /media/5/Conky/1_accuweather/first_days}
Bytes: wc -c ${execi 300 sed -n '5p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '5p' /media/5/Conky/1_accuweather/first_days | wc -w}
10 ${execi 300 sed -n '10p' /media/5/Conky/1_accuweather/first_days}
Bytes: wc -c ${execi 300 sed -n '10p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '10p' /media/5/Conky/1_accuweather/first_days | wc -w}
15 ${execi 300 sed -n '15p' /media/5/Conky/1_accuweather/first_days}
Bytes: wc -c ${execi 300 sed -n '15p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '15p' /media/5/Conky/1_accuweather/first_days | wc -w}
20 ${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days}
Bytes: wc -c ${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | wc -w}
25 ${execi 300 sed -n '25p' /media/5/Conky/1_accuweather/first_days}
Bytes: wc -c ${execi 300 sed -n '25p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '25p' /media/5/Conky/1_accuweather/first_days | wc -w}
--- 20p ---
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days}
-----
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | cut -c -15}
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | cut -c 16-}
-----
Bytes: wc -c ${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | wc -c}
Words: wc -w ${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | wc -w}
The one for 20p shows how you can use "cut" for two lines. cut for 3 lines would be 10|10 and 10, there is a good chance you end up with words cut in the middle like breaks up "clouds" to "cloud" new line "s and sun"
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | cut -c -10}
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | cut -c 11-20}
${execi 300 sed -n '20p' /media/5/Conky/1_accuweather/first_days | cut -c 21-}
at one time I thought of using "fold" that works well IF there is no goto involved, you can fold on a space between words but then the second line ends up on the extreme left
Now looking at that and what you've done maybe you can use cut and/or fold to get it to work.
BTW: wc -c and wc -m seem to always have the same output.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
I've ran multiple weather scripts for awhile and the keyboard and mouse freeze only appeared within the last year or so.
Year or so ... hmmm that doesn't sound at all like it would be a problem from Teo's scripts.
Popped this into StartPage: unix|linux keyboard mouse freezing up
OH WOW! You are not alone.
Then, there's this gem in the OP...
If you use wget for downloading, these scripts are gonna kill it; you can either remove the command from the scripts or use curl instead.
I never noticed that caveat.
Teo has been using the kill commands in his scripts from day one that I started using them. In the beginning I had no problems, I only ever ran one weather script at a time, but then I started experimenting and have stretched and mauled Teo's scripts to death, had merged 3 scripts into one at one time. but along come a change and awww hell, to must work to go through a mega script to "dot an i" So I've done just about everything possible to break em, and I can tell you, they don't break easy. Teo's done some solid stuff here.
It's understandable about the "kill" part breaking things if the situation fits just right. I took the "kill wget" lines out of the scripts a long time ago. And only had the one OOPS with the "kill -STOP|-CONT $(pidof conky)" lines. So you and I share the infamy of being the two people (I know about) that have had that problem.
Night all 02:14 here!! sleep tight!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@Krunchtime
Don't worry buddy, it's easy to get confused if you use more than one conky configurations.
First of all, if you're using the 1_accuweather script for two conky configurations, you only need to call it once with the parameters you need, ie. just call the script once (in the first conkyrc for example) with the parameters
-f2016 -h2016
Secondly, since you're using many conky configurations, comment out the kill commands (the ones that keep pausing and restarting conky).
Thirdly, delete the killall wget command wherever you find it; it was a "better safe than sorry" measure back in the day, there's no need for it now; I delete whenever I update a script (and remember to actually do it )
Alternatively you could just use this script:
#!/bin/bash
#########################################################################################################
#Only for Krunchtime; both 1_accuweather and 3_nws, no killall wget, pausing and resuming conky just once
#########################################################################################################
kill -STOP $(pidof conky)
#function: test_image
test_image () {
case $1 in
1)
echo a
;;
2|3)
echo b
;;
4|5)
echo c
;;
6)
echo d
;;
7)
echo e
;;
8)
echo f
;;
11)
echo 0
;;
12)
echo h
;;
13|14)
echo g
;;
15)
echo m
;;
16|17)
echo k
;;
18)
echo i
;;
19)
echo q
;;
20|21|23)
echo o
;;
22)
echo r
;;
24|31)
echo E
;;
25)
echo v
;;
26)
echo x
;;
29)
echo y
;;
30)
echo 5
;;
32)
echo 6
;;
33)
echo A
;;
34|35)
echo B
;;
36|37)
echo C
;;
38)
echo D
;;
39|40)
echo G
;;
41|42)
echo K
;;
43|44)
echo O
;;
*)
echo -
;;
esac
}
############################
# Check the user arguments #
############################
if (( $# < 1 || $# > 4 )); then
echo "Invalid arguments!"
exit
fi
forecast0=0
forecast2015=0
forecast2016=0
hourly0=0
hourly2015=0
hourly2016=0
for i in $*
do
if [[ $i != -f && $i != -f2015 && $i != -f2016 && $i != -h && $i != -h2015 && $i != -h2016 ]]; then
echo "Invalid arguments!"
exit
fi
case $i in
-f)
forecast0=1
;;
-f2015)
forecast2015=1
;;
-f2016)
forecast2016=1
;;
-h)
hourly0=1
;;
-h2015)
hourly2015=1
;;
-h2016)
hourly2016=1
;;
esac
done
if [[ $forecast0 == 1 ]]; then
forecast2015=0
forecast2016=0
fi
if [[ $hourly0 == 1 ]]; then
hourly2015=0
hourly2016=0
fi
#Put your Accuweather address here
#address="http://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"
#address="http://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396"
address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
last_number=$(echo $address|sed 's/^.*\///')
#############################################################
# NORMAL FORECAST: -f, -f2015 or -f2016 passed as arguments #
#############################################################
if [[ $forecast0 == 1 || $forecast2015 == 1 || $forecast2016 == 1 ]]; then
#function: convert_time
convert_time ()
{
hours=$(echo $1|awk -F ":| " '{print $1}')
minutes=$(echo $1|awk -F ":| " '{print $2}')
am_or_pm=$(echo $1|awk -F ":| " '{print $3}')
if [[ $am_or_pm == AM ]]; then
if (( $hours < 10 )); then
hours_24=0$hours
fi
if (( $hours == 10 || $hours == 11 )); then
hours_24=$hours
fi
if (( $hours == 12 )); then
hours_24=00
fi
elif [[ $am_or_pm == PM ]]; then
if (( $hours != 12 )); then
hours_24=$((hours+12))
fi
if (( $hours == 12 )); then
hours_24=12
fi
fi
time_24=$hours_24:$minutes
echo $time_24
}
#function: test_wind
test_wind () {
case $1 in
CLM)
echo -
;;
S)
echo 1
;;
SSW)
echo 2
;;
SW)
echo 3
;;
WSW)
echo 4
;;
W)
echo 5
;;
WNW)
echo 6
;;
NW)
echo 7
;;
NNW)
echo 8
;;
N)
echo 9
;;
NNE)
echo :
;;
NE)
echo ;
;;
ENE)
echo \<
;;
E)
echo =
;;
ESE)
echo \>
;;
SE)
echo ?
;;
SSE)
echo @
;;
esac
}
curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
wget -O $HOME/1_accuweather/curr_cond_raw "$curr_addr"
addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
wget -O $HOME/1_accuweather/first_days_raw "$addr1"
addr2="$addr1"?day=6
wget -O $HOME/1_accuweather/last_days_raw "$addr2"
if [[ $forecast2015 == 1 ]]; then
rm $HOME/1_accuweather/forecast_2015/forecast_*.png
fi
if [[ $forecast2016 == 1 ]]; then
rm $HOME/1_accuweather/forecast_2016/forecast_*.png
fi
#current conditions
if [[ -s $HOME/1_accuweather/curr_cond_raw ]]; then
sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/1_accuweather/curr_cond_raw
egrep -i '"cond"|icon i-|large-temp|small-temp|wind-point|"wind"><strong>|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|Duration|Sunrise:|Sunset:|Moonrise:|Moonset:' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
sed -i -e 's/^.*<strong>//g' -e 's/^.*<span>//g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*<\/em> //g' -e 's/^.*"cond">//g' -e 's/^.*wind-point //g' $HOME/1_accuweather/curr_cond
sed -i -e 's/">.*$//g' -e 's/°.*$//g' -e 's/<\/span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/<\/strong>.*$//g' $HOME/1_accuweather/curr_cond
sed -i '1s/-.*$//' $HOME/1_accuweather/curr_cond
image=$(sed -n 1p $HOME/1_accuweather/curr_cond)
echo $(test_image $image) >> $HOME/1_accuweather/curr_cond
sunrise_time=$(sed -n 14p $HOME/1_accuweather/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
sunrise_time=$(sed -n 15p $HOME/1_accuweather/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
sunrise_time=$(sed -n 18p $HOME/1_accuweather/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
sunrise_time=$(sed -n 19p $HOME/1_accuweather/curr_cond)
echo $(convert_time "$sunrise_time") >> $HOME/1_accuweather/curr_cond
wind=$(sed -n 5p $HOME/1_accuweather/curr_cond)
echo $(test_wind $wind) >> $HOME/1_accuweather/curr_cond
if (( $(sed -n 14p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
sed -i '14s/^/0/' $HOME/1_accuweather/curr_cond
fi
if (( $(sed -n 15p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
sed -i '15s/^/0/' $HOME/1_accuweather/curr_cond
fi
if (( $(sed -n 18p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
sed -i '18s/^/0/' $HOME/1_accuweather/curr_cond
fi
if (( $(sed -n 19p /$HOME/1_accuweather/curr_cond|wc -c) == 8 )); then
sed -i '19s/^/0/' $HOME/1_accuweather/curr_cond
fi
if [[ $forecast2015 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/forecast_0.png
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2015/wind_0.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/forecast_0.png
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 5p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/forecast_2016/wind_0.png
fi
fi
#First 5 days
if [[ -s $HOME/1_accuweather/first_days_raw ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/first_days_raw
egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' -e 's/^.*"temp-label tonight selected">//g' $HOME/1_accuweather/first_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/first_days
sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' -e 's/Today$/TODAY/' -e 's/Tonight$/TONIGHT/' -e 's/Early AM/EARLY AM/' $HOME/1_accuweather/first_days
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/1_accuweather/first_days)
echo $(test_image $image) >> $HOME/1_accuweather/first_days
done
if [[ $forecast0 == 0 ]]; then
j=1
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
fi
((j++))
done
fi
fi
#Next 5 days
if [[ -s $HOME/1_accuweather/last_days_raw ]]; then
sed -i '/.feed-controls/,/\.feed-tabs/!d' $HOME/1_accuweather/last_days_raw
egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">\///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' $HOME/1_accuweather/last_days
sed -i -e 's/°.*$//g' -e 's/<\/a>.*$//g' -e 's/<\/span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/last_days
sed -i -e 's/Mon$/MONDAY/' -e 's/Tue$/TUESDAY/' -e 's/Wed$/WEDNESDAY/' -e 's/Thu$/THURSDAY/' -e 's/Fri$/FRIDAY/' -e 's/Sat$/SATURDAY/' -e 's/Sun$/SUNDAY/' $HOME/1_accuweather/last_days
for (( i=2; i<=22; i+=5 ))
do
image=$(sed -n "${i}"p $HOME/1_accuweather/last_days)
echo $(test_image $image) >> $HOME/1_accuweather/last_days
done
if [[ $forecast0 == 0 ]]; then
j=6
for (( i=2; i<=22; i+=5 ))
do
if [[ $forecast2015 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2015/forecast_$j.png
fi
if [[ $forecast2016 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/forecast_2016/forecast_$j.png
fi
((j++))
done
fi
fi
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"
wget -O $HOME/1_accuweather/hourly_raw1 "$hourly_addr1"
if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw1
egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw1 > $HOME/1_accuweather/hourly1
sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly1
sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly1
echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly1
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/1_accuweather/hourly1)
echo $(test_image $image) >> $HOME/1_accuweather/hourly1
done
if [[ $hourly0 == 0 ]]; then
j=1
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
#Hourly: Next 8h
hourly_addr2=$(sed -n 1p $HOME/1_accuweather/hourly1)
wget -O $HOME/1_accuweather/hourly_raw2 "$hourly_addr2"
if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
sed -i '/detail-tab-buttons\.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw2
egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm<\/div>|am<\/div>|icon-weather icon i-|<th>Forecast|<span>.*<\/span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw2 > $HOME/1_accuweather/hourly2
sed -i -e 's/^[ \t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/<\/div>.*$//g' -e 's/&#.*$//g' -e 's/<\/span>.*$//g' -e 's/<\/th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly2
sed -i 1d $HOME/1_accuweather/hourly2
sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/\r//g' $HOME/1_accuweather/hourly2
echo "ConkyWeather Font Icons" >> $HOME/1_accuweather/hourly2
for (( i=4; i<=18; i+=2 ))
do
image=$(sed -n "${i}"p $HOME/1_accuweather/hourly2)
echo $(test_image $image) >> $HOME/1_accuweather/hourly2
done
if [[ $hourly0 == 0 ]]; then
j=9
for (( i=4; i<=18; i+=2 ))
do
if [[ $hourly2015 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2015/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2015/hourly_$j.png
fi
if [[ $hourly2016 == 1 ]]; then
cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_2016/hourly_$j.png
fi
((j++))
done
fi
fi
# Full info, next 16h - altogether16 file
rm $HOME/1_accuweather/altogether16 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
sed -i "1s/$/\${goto 580}$(sed -n 2p $HOME/1_accuweather/hourly2):$(sed -n 3p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
jump_to=640
for (( i=5; i<=17; i+=2 ))
do
time=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "1s/$/\${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
sed -i '1s/$/\n\n\n/' $HOME/1_accuweather/altogether16
#FORECAST
echo "\${color ffe595}FORECAST\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $1}'|cut -c1-8)
sed -i "5s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
sed -i '5s/$/\n/' $HOME/1_accuweather/altogether16
jump_to=100
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=20; i<=27; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $2}'|cut -c1-8)
sed -i "6s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#TEMPERATURE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "TEMPER.\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=29; i<=36; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "8s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#REAL FEEL
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "REAL FEEL\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=38; i<=45; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "10s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#WIND
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "WIND\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=47; i<=54; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "12s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#RAIN
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "RAIN\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=64; i<=71; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "14s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#SNOW
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "SNOW\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=73; i<=80; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "16s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#ICE
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "ICE\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=82; i<=89; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "18s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#UV INDEX
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "UV INDEX\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=99; i<=106; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "20s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#CLOUD COVER
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "CLOUD COV.\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=108; i<=115; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "22s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#HUMIDITY
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "HUMIDITY\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=117; i<=124; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "24s/$/\${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#DEW POINT
echo "\${color ffe595}\${goto 100}\${hr 1}" >> $HOME/1_accuweather/altogether16
echo "DEW POINT\${color}" >> $HOME/1_accuweather/altogether16
jump_to=100
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=126; i<=133; i+=1 ))
do
messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
sed -i "26s/$/\${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
#IMAGES
if [[ $hourly0 == 0 ]]; then
if [[ $hourly2015 == 1 ]]; then
jump_to=75
cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2015
fi
if [[ $hourly2016 == 1 ]]; then
jump_to=85
cp $HOME/1_accuweather/altogether16 $HOME/1_accuweather/altogether16_2016
fi
rm $HOME/1_accuweather/altogether16
for (( i=1; i<=16; i+=1 ))
do
if [[ $hourly2015 == 1 ]]; then
sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2015\/hourly_$i.png -s 60x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2015
fi
if [[ $hourly2016 == 1 ]]; then
sed -i "4s/$/\${image \$HOME\/1_accuweather\/hourly_2016\/hourly_$i.png -s 36x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16_2016
fi
((jump_to+=60))
done
fi
#CONKYFONT
if [[ $hourly0 == 1 ]]; then
sed -i '4s/$/\${color}\${font conkyweather:size=35}/' $HOME/1_accuweather/altogether16
jump_to=95
for (( i=135; i<=142; i+=1 ))
do
sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
for (( i=135; i<=142; i+=1 ))
do
sed -i "4s/$/\${goto $jump_to}$(sed -n ${i}p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
((jump_to+=60))
done
sed -i '4s/$/\${font}/' $HOME/1_accuweather/altogether16
sed -i '2,3d' $HOME/1_accuweather/altogether16
fi
fi
###########################
#HERE STARTS THE NWS SCRIPT
###########################
#put your NWS xml address here
address="http://forecast.weather.gov/MapClick.php?lat=38.90164&lon=-77.4587239&unit=0&lg=english&FcstType=dwml"
wget -O $HOME/3_conky_forecast_nws/raw $address
if [ -s $HOME/3_conky_forecast_nws/raw ]; then
sed -i '/start-valid-time period-name=\|value\|weather-conditions weather-summary\|icon-link\|<text>\|layout-key\|time-layout=/!d' $HOME/3_conky_forecast_nws/raw
sed -i '/<moreWeatherInformation/d' $HOME/3_conky_forecast_nws/raw
grep -i period-name $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/period-names_temps
sed -i -e 's/^.*name="//g' -e 's/">.*$//g' -e '14,$d' $HOME/3_conky_forecast_nws/period-names_temps
maximum_line=$(grep -n maximum $HOME/3_conky_forecast_nws/raw|sed 's/:.*$//')
minimum_line=$(grep -n minimum $HOME/3_conky_forecast_nws/raw|sed 's/:.*$//')
if (( $maximum_line < $minimum_line )); then
sed '/maximum/,/minimum/!d' $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/max_temps
sed '/minimum/,/probability-of-precipitation/!d' $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/min_temps
sed -i '/value/!d' $HOME/3_conky_forecast_nws/{max_temps,min_temps}
sed -i -e 's/^.*<value>//g' -e 's/<\/value>.*$//g' $HOME/3_conky_forecast_nws/{max_temps,min_temps}
sed -i '8,$d' $HOME/3_conky_forecast_nws/max_temps
sed -i '7,$d' $HOME/3_conky_forecast_nws/min_temps
j=1
for (( i=1; i<=13; i+=2 ))
do
temp_to_insert=$(sed -n ${j}p $HOME/3_conky_forecast_nws/max_temps)
sed -i "${i}s/$/+++${temp_to_insert}/" $HOME/3_conky_forecast_nws/period-names_temps
((j+=1))
done
j=1
for (( i=2; i<=12; i+=2 ))
do
temp_to_insert=$(sed -n ${j}p $HOME/3_conky_forecast_nws/min_temps)
sed -i "${i}s/$/+++${temp_to_insert}/" $HOME/3_conky_forecast_nws/period-names_temps
((j+=1))
done
sed -i 's/+++/\n/g' $HOME/3_conky_forecast_nws/period-names_temps
rm $HOME/3_conky_forecast_nws/{max_temps,min_temps}
elif (( $maximum_line > $minimum_line )); then
sed '/minimum/,/maximum/!d' $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/min_temps
sed '/maximum/,/probability-of-precipitation/!d' $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/max_temps
sed -i '/value/!d' $HOME/3_conky_forecast_nws/{max_temps,min_temps}
sed -i -e 's/^.*<value>//g' -e 's/<\/value>.*$//g' $HOME/3_conky_forecast_nws/{max_temps,min_temps}
sed -i '8,$d' $HOME/3_conky_forecast_nws/min_temps
sed -i '7,$d' $HOME/3_conky_forecast_nws/max_temps
j=1
for (( i=1; i<=13; i+=2 ))
do
temp_to_insert=$(sed -n ${j}p $HOME/3_conky_forecast_nws/min_temps)
sed -i "${i}s/$/+++${temp_to_insert}/" $HOME/3_conky_forecast_nws/period-names_temps
((j+=1))
done
j=1
for (( i=2; i<=12; i+=2 ))
do
temp_to_insert=$(sed -n ${j}p $HOME/3_conky_forecast_nws/max_temps)
sed -i "${i}s/$/+++${temp_to_insert}/" $HOME/3_conky_forecast_nws/period-names_temps
((j+=1))
done
sed -i 's/+++/\n/g' $HOME/3_conky_forecast_nws/period-names_temps
rm $HOME/3_conky_forecast_nws/{max_temps,min_temps}
fi
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/' $HOME/3_conky_forecast_nws/period-names_temps
for (( i=3; i<=25; i+=2 ))
do
day_characters=$(sed -n ${i}p $HOME/3_conky_forecast_nws/period-names_temps|wc -c)
if (( $day_characters > 10 )); then
shortened_day=$(sed -n ${i}p $HOME/3_conky_forecast_nws/period-names_temps|cut -c1-10)
sed -i "${i}s/.*/${shortened_day}/" $HOME/3_conky_forecast_nws/period-names_temps
fi
done
sed '/<probability-of-precipitation/,/<weather time-layout/!d' $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/precipitation
sed -i '/value/!d' $HOME/3_conky_forecast_nws/precipitation
sed -i -e 's/^.*nil="true">/0/g' -e 's/^.*<value>//g' -e 's/<\/value>.*$//g' $HOME/3_conky_forecast_nws/precipitation
sed -i '14,$d' $HOME/3_conky_forecast_nws/precipitation
grep weather-summary $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/messages
sed -i -e 's/^.*weather-summary="//g' -e 's/"\/>.*$//g' $HOME/3_conky_forecast_nws/messages
sed -i '14,$d' $HOME/3_conky_forecast_nws/messages
grep \<text\> $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/long_messages
sed -i -e 's/^.*<text>//g' -e 's/<\/text>.*$//g' -e 's/ / /g' $HOME/3_conky_forecast_nws/long_messages
grep \<icon-link\> $HOME/3_conky_forecast_nws/raw > $HOME/3_conky_forecast_nws/new_images
sed -i -e 's/^.*<icon-link>//g' -e 's/<\/icon-link>.*$//g' -e 's/\&\;/\&/g' $HOME/3_conky_forecast_nws/new_images
sed -i '14,$d' $HOME/3_conky_forecast_nws/new_images
for (( i=1; i<=13; i++ ))
do
old_image=$(sed -n ${i}p $HOME/3_conky_forecast_nws/old_images)
new_image=$(sed -n ${i}p $HOME/3_conky_forecast_nws/new_images)
if [[ $old_image != $new_image ]]; then
wget -O $HOME/3_conky_forecast_nws/$i.png "$(sed -n "${i}p" $HOME/3_conky_forecast_nws/new_images)"
fi
done
mv $HOME/3_conky_forecast_nws/new_images $HOME/3_conky_forecast_nws/old_images
fi
kill -CONT $(pidof conky)
@AL^
I'm trying to use ${if_match} to see how long the forecast is and then either print the first line, or print a blank line.
Hi Al and welcome to Linux! Can you please explain what you want to do a bit more?
@S11
Very good grasp at what's going on in the scripts; I'm pretty sure you could even eliminate any lag/delay with the proper fusion/merging of the scripts 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
@Krunchtime
Alternatively you could just use this script:#Only for Krunchtime; both 1_accuweather and 3_nws, no killall wget, pausing and resuming conky just once
ONLY for KrunchTime huh! WANNA BET! MWAHAHAHA!! ]:D
Come on Teo, you know me better than that. You make it, and I "at a minimum" have to test it.
@S11
Very good grasp at what's going on in the scripts; I'm pretty sure you could even eliminate any lag/delay with the proper fusion/merging of the scripts you're using.
See, I've been hanging around with you too lo not long enough. I'm learning from you by osmosis.
Yea, I've been thinking along that line myself - again - time to merge the latest scripts.
One super-mega-get-it-all script; wunder-accu-moon (wam for short) script. Suppose to rain this weekend, it'll give me something to do.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
S11,
Thanks, that looks like what I was wanting. I'll play around with it and hopefully post the completed one tomorrow.
Offline
@Krunchtime
Don't worry buddy, it's easy to get confused if you use more than one conky configurations.
First of all, if you're using the 1_accuweather script for two conky configurations, you only need to call it once with the parameters you need, ie. just call the script once (in the first conkyrc for example) with the parameters-f2016 -h2016
Okay, so I just comment out the call in one of the scripts and then use both of the options for the call in the other? No other changes necessary?
Aternatively you could just use this script: ...
Thank you for the effort, but that would be too much work to update whenever a new script comes out. It's bad enough going through and changing the scripts to accommodate my placing the scripts in a shared ~/bin folder.
Offline
It's just the 1_accuweather script, followed by the NWS one, stripped from all their kill/killall commands with just a kill command right at the beginning to pause conky and a kill command right at the end to resume it.
Sorry AL^, I couldn't get what you actually wanted. Glad you've found the answer with S11.
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
Ok, my if_match isn't working... Here's what I have:
${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c}
${if_match "${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c}" < 29}\
#${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
1\
${else}2\
${endif}
#${if_match "${execp sed -n '10p' $HOME/1_accuweather/first_days | wc -c}" > 29}\
#${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|fold -s -w14}
#${else}${endif}
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-5|fold -s -w14}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-5|fold -s -w14}
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f6-|fold -s -w14}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f6-|fold -s -w14}
Edit:: I took off the quotation marks from the if_match since I thought maybe it was trying to compare a string instead of an integer but same results.
The wc is working because it displays 30, but then the if_match isn't working because it's not displaying 1 or 2, but a blank line. It's probably something simple that I'm missing...
Here is my end goal... Most of the time the forecast is only 2 lines so I cut the first line and fold the 2nd but then I have to leave a blank line below in case it's 3 lines. So I want to test and see how long the forecast is... if it's <30 then the first line will be blank, if not the first line of the forecast will be displayed.
Hopefully that made sense...
Thanks.
Last edited by AL^ (2017-08-18 04:04:07)
Offline
wc - c is working with numbers but the the "fold" command is working with a string ... and as I said in an earlier post "fold" will not work well with a "goto" statement.
But you have another OOPS!:
${if_match "${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c}" < 29}\
#${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
1\
${else}2\
${endif}
Nothing past " | wc -c}" < 29}\ " is being seen by conky because you have a # comment at the start of the next "physical" line: #${execpi 600 sed
My quick test:
Now is the time for all good men to come to the aid of their country.
Now is the time for all good \
men to come to the aid of \
their country.
Now is the time for all good \
#men to come to the aid of \
their country.
${execp sed -n '5p' /media/5/Conky/1_accuweather/first_days}
${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days}
===
${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days |fold -s -w14}
=== fold doesn't work
${goto 50}${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days |fold -s -w14}
=== cut ===
${goto 50}${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days |cut -c -14}
${goto 50}${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days |cut -c 15-}
---your stuff -----------------
${execp sed -n '5p' /media/5/Conky/1_accuweather/first_days | wc -c}
${if_match "${execp sed -n '5p' /media/5/Conky/1_accuweather/first_days | wc -c}" < 29}\
${execpi 600 sed -n '5p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f-2}\
1\
${else}2\
${endif}
--------------------
${if_match "${execp sed -n '10p' /media/5/Conky/1_accuweather/first_days | wc -c}" > 29}\
${goto 115}${execpi 600 sed -n '10p' /media/5/Conky/1_accuweather/first_days|fold -s -w14}
${else}${endif}
*****
${goto 115}${execpi 600 sed -n '10p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f-2}
${execpi 600 sed -n '5p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f3-5|fold -s -w14}\
${goto 115}${execpi 600 sed -n '10p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f3-5|fold -s -w14}
*****
${execpi 600 sed -n '5p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f6-|fold -s -w14}\
${goto 115}${execpi 600 sed -n '10p' /media/5/Conky/1_accuweather/first_days|cut -d ' ' -f6-|fold -s -w14}
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Change this
${if_match "${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c}" < 29}
to this
${if_match ${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c} < 29}
ie remove the double quotes.
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'm not fully satisfied, but it's good enough for now. Taking the advise of S11 I stayed away from fold and just cut each line at 2 words.
And here's the code if anyone is interested:
${goto 74}${color6}${time %b %Y}${color}
${goto 32}${if_match "${time %a}" == "Sun"}${color6}Su${color} Mo Tu We Th Fr Sa${else}\
${if_match "${time %a}" == "Mon"}Su ${color6}Mo${color} Tu We Th Fr Sa${else}\
${if_match "${time %a}" == "Tue"}Su Mo ${color6}Tu${color} We Th Fr Sa${else}\
${if_match "${time %a}" == "Wed"}Su Mo Tu ${color6}We${color} Th Fr Sa${else}\
${if_match "${time %a}" == "Thu"}Su Mo Tu We ${color6}Th${color} Fr Sa${else}\
${if_match "${time %a}" == "Fri"}Su Mo Tu We Th ${color6}Fr${color} Sa${else}\
Su Mo Tu We Th Fr ${color6}Sa${color}${endif}${endif}${endif}${endif}${endif}${endif}
${goto 32}${execpi 900 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color6}&${color}/' | sed ':a;N;$!ba;s/\n/\n${goto 32}/g'}${color}
${goto 32}${execpi 900 ncal -bh -m `date +%m` -A1 -B-1 | sed ':a;N;$!ba;s/\n/\n${goto 32}/g'}
${texeci 500 bash $HOME/1_accuweather/1_accuweather -f2016}\
${color ffe595}${font Arial:size=10}CURRENTLY:$color$font ${execpi 600 sed -n '2p' $HOME/1_accuweather/curr_cond}° (${execpi 600 sed -n '3p' $HOME/1_accuweather/curr_cond}°)
${goto 10}${font Arial:size=10}${color ffe595}${execpi 600 sed -n '1p' $HOME/1_accuweather/first_days}\
${goto 122}${execpi 600 sed -n '6p' $HOME/1_accuweather/first_days}$color$font
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 0,270 -s 60x60}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 110,270 -s 60x60}\
${goto 70}${execpi 600 sed -n '3p' $HOME/1_accuweather/first_days}°\
${goto 179}${execpi 600 sed -n '8p' $HOME/1_accuweather/first_days}°
${goto 70}/${execpi 600 sed -n '4p' $HOME/1_accuweather/first_days}°\
${goto 179}/${execpi 600 sed -n '9p' $HOME/1_accuweather/first_days}°
${if_match ${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${else}\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${endif}\
${if_match ${execp sed -n '10' $HOME/1_accuweather/first_days | wc -w} < 5}\
${else}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${endif}
${if_match ${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${else}\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4}\
${endif}\
${if_match ${execp sed -n '10' $HOME/1_accuweather/first_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${else}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4}\
${endif}
${if_match ${execp sed -n '5' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}\
${if_match ${execp sed -n '10' $HOME/1_accuweather/first_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${goto 115}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 0,410 -s 60x60}\
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 110,410 -s 60x60}\
${font Arial:size=10}${color ffe595}${goto 10}${execpi 600 sed -n '11p' $HOME/1_accuweather/first_days}\
${goto 122}${execpi 600 sed -n '16p' $HOME/1_accuweather/first_days}$color$font
${goto 70}${execpi 600 sed -n '13p' $HOME/1_accuweather/first_days}°\
${goto 179}${execpi 600 sed -n '18p' $HOME/1_accuweather/first_days}°
${goto 70}/${execpi 600 sed -n '14p' $HOME/1_accuweather/first_days}°\
${goto 179}/${execpi 600 sed -n '19p' $HOME/1_accuweather/first_days}°
${image $HOME/1_accuweather/forecast_2016/forecast_5.png -p 0,550 -s 60x60}\
${image $HOME/1_accuweather/forecast_2016/forecast_6.png -p 110,550 -s 60x60}\
${if_match ${execp sed -n '15p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${else}\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${endif}\
${if_match ${execp sed -n '20p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${else}\
${goto 115}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${endif}
${if_match ${execp sed -n '15p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${else}\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4}\
${endif}\
${if_match ${execp sed -n '20p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${else}\
${goto 115}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4}\
${endif}
${if_match ${execp sed -n '15p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}\
${if_match ${execp sed -n '20p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${goto 115}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}
${hr 1}
${goto 10}${font Arial:size=10}${color ffe595}${execpi 600 sed -n '21p' $HOME/1_accuweather/first_days}\
${goto 122}${execpi 600 sed -n '1p' $HOME/1_accuweather/last_days}$color$font
${goto 70}${execpi 600 sed -n '23p' $HOME/1_accuweather/first_days}°\
${goto 179}${execpi 600 sed -n '3p' $HOME/1_accuweather/last_days}°
${goto 70}/${execpi 600 sed -n '24p' $HOME/1_accuweather/first_days}°\
${goto 179}/${execpi 600 sed -n '4p' $HOME/1_accuweather/last_days}°
${if_match ${execp sed -n '25p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${else}\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${endif}\
${if_match ${execp sed -n '5p' $HOME/1_accuweather/last_days | wc -w} < 5}\
${else}\
${goto 115}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -d ' ' -f-2}\
${endif}
${if_match ${execp sed -n '25p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -d ' ' -f-2}\
${else}\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4}\
${endif}\
${if_match ${execp sed -n '5p' $HOME/1_accuweather/last_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -d ' ' -f-2}\
${else}\
${goto 115}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -d ' ' -f3-4}\
${endif}
${if_match ${execp sed -n '25p' $HOME/1_accuweather/first_days | wc -w} < 5}\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}\
${if_match ${execp sed -n '5p' $HOME/1_accuweather/last_days | wc -w} < 5}\
${goto 115}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -d ' ' -f3-4|fold -s -w14}\
${else}\
${goto 115}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -d ' ' -f5-|fold -s -w14}\
${endif}
I'm always open to suggestions. Thanks!
Offline
Well, you've done what I could never figure out, how to split it at words properly.
KUDOS! Must study your code.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Offline
Check the data files for the actual condition.
One of my favorite quotes I heard recently was this, "You either win or you learn. The only way to lose is to quit." I'm not gonna quit
Already a winner.
Someone else around here has a sig: I have not failed, I've found 10,000 ways it doesn't work.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
It's just the 1_accuweather script, followed by the NWS one, stripped from all their kill/killall commands with just a kill command right at the beginning to pause conky and a kill command right at the end to resume it.
Oh...that's easy then.
One of my favorite quotes I heard recently was this, "You either win or you learn. The only way to lose is to quit." I'm not gonna quit
Love the quote. Who is it attributed to?
Last edited by KrunchTime (2017-08-19 22:42:33)
Offline
KrunchTime - an article I read on freeCodeCamp
Offline
Couldn't get the side/side working... too many variables... so here's what I came up with:
And here's the code in case anyone is interested:
${texeci 500 bash $HOME/1_accuweather/1_accuweather -f2016}\
${color ffe595}${font Arial:size=10}CURRENTLY:$color$font ${execpi 600 sed -n '2p' $HOME/1_accuweather/curr_cond}° (${execpi 600 sed -n '3p' $HOME/1_accuweather/curr_cond}°)
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '1p' $HOME/1_accuweather/first_days}${font}${color}\
${execpi 600 sed -n '3p' $HOME/1_accuweather/first_days}°\
/${execpi 600 sed -n '4p' $HOME/1_accuweather/first_days}°\
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|fold -s -w16}\
${if_match ${execp sed -n '5p' $HOME/1_accuweather/first_days | wc -c} < 31}\
${else}
${endif}\
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 135,253 -s 60x60}\
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '6p' $HOME/1_accuweather/first_days}$color$font\
${execpi 600 sed -n '8p' $HOME/1_accuweather/first_days}°\
/${execpi 600 sed -n '9p' $HOME/1_accuweather/first_days}°\
${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|fold -s -w16}\
${if_match ${execp sed -n '10p' $HOME/1_accuweather/first_days | wc -c} < 31}\
${else}
${endif}\
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 135,324 -s 60x60}\
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '11p' $HOME/1_accuweather/first_days}$color$font\
${execpi 600 sed -n '13p' $HOME/1_accuweather/first_days}°\
/${execpi 600 sed -n '14p' $HOME/1_accuweather/first_days}°\
${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|fold -s -w16}\
${if_match ${execp sed -n '15p' $HOME/1_accuweather/first_days | wc -c} < 31}\
${else}
${endif}\
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 135,395 -s 60x60}\
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '16p' $HOME/1_accuweather/first_days}$color$font\
${execpi 600 sed -n '18p' $HOME/1_accuweather/first_days}°\
/${execpi 600 sed -n '19p' $HOME/1_accuweather/first_days}°\
${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|fold -s -w16}\
${if_match ${execp sed -n '20p' $HOME/1_accuweather/first_days | wc -c} < 31}\
${else}
${endif}\
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 135,466 -s 60x60}\
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '21p' $HOME/1_accuweather/first_days}$color$font\
${execpi 600 sed -n '23p' $HOME/1_accuweather/first_days}°\
/${execpi 600 sed -n '24p' $HOME/1_accuweather/first_days}°\
${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|fold -s -w16}\
${if_match ${execp sed -n '25p' $HOME/1_accuweather/first_days | wc -c} < 31}\
${else}
${endif}\
${hr 1}
${image $HOME/1_accuweather/forecast_2016/forecast_5.png -p 135,537 -s 60x60}\
${font Arial:size=10}${color ffe595}${execpi 600 sed -n '1p' $HOME/1_accuweather/last_days}$color$font\
${execpi 600 sed -n '3p' $HOME/1_accuweather/last_days}°\
/${execpi 600 sed -n '4p' $HOME/1_accuweather/last_days}°\
${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|fold -s -w16}\
${if_match ${execp sed -n '5p' $HOME/1_accuweather/last_days | wc -c} < 31}\
${else}
${endif}\
${image $HOME/1_accuweather/forecast_2016/forecast_6.png -p 135,608 -s 60x60}
Thanks.
Offline