You are not logged in.
KrunchTime - an article I read on freeCodeCamp
Link if you have it, please. I want to add the quote to my quotes database and I like to attribute a quote to the person who was responsible for it, when possible.
Last edited by KrunchTime (2017-08-20 22:09:32)
Offline
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)
I finally made time earlier this evening to review the combined code. What benefit does the combination provide; only killing conky once? Also, you can't just combine those two bash scripts and call it a done deal because the original bash scripts sat in separate folders. You have to combine all of the folders and files from the separate folders into one folder and modify the folder references in the bash and conky scripts.
I'm now thinking it might be beneficial to combine the Accuweather conky script and the NWS conky script (.conky_nws_Long_Messages_Wide in my case).
Last edited by KrunchTime (2017-08-30 01:10:57)
Offline
No not at all ...
~/1_accuweather
~/2b_Wunderground_API
~/4_Moon
Create ~/1_2b_4 and make a combined script there ~/1_2b_4/1-2b-4(.sh) and let each part pf the script use the original paths for it own images and database.
It does not matter where the script resides, it matters where it puts the data once collected.
The conky will still call the data from the proper directory like this; accuweather and moon:
TEXT
${lua conky_draw_bg 0 0 0 0 0 0x000000 0.20}\
${lua conky_draw_bg 25 15 570 50 50 0x000000 0.50}\
${lua conky_draw_bg 25 218 570 50 50 0x000000 0.50}\
${lua conky_draw_bg 25 15 630 50 50 0x000000 0.50}\
${lua conky_draw_bg 25 218 630 50 50 0x000000 0.50}\
${image /media/5/Conky/images/stycil_tux_icon_black_damo_BLFlame.png -p 0,25 -s 100x100}\
${alignc}${color0}Boot${color} ${pre_exec who -b | cut -c23-} ${color0}Up:${color} ${exec w | awk '/ up /{gsub(/,$/,"",$3);print $3}'}
${goto 110}${color}SU MO ${color6}${time %b %Y}${color} FR SA
${goto 110}${color}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color6}&${color}/' | sed ':a;N;$!ba;s/\n/\n${goto 110}/g'}${color}
cpu1 %${goto 78}${if_match ${cpu cpu1} < 10} ${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100} ${cpu cpu1}\
${else}${color9}${cpu cpu1}${color}${endif}${endif}${goto 190}${platform f71882fg.2560 temp 1}°${alignr}CPU
cpu2 %${goto 64}${if_match ${cpu cpu2} < 10} ${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100} ${cpu cpu2}\
${else}${color9}${cpu cpu2}${color}${endif}${endif}${goto 205}${nvidia temp}°${alignr}GPU
cpu3 %${goto 64}${if_match ${cpu cpu3} < 10} ${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100} ${cpu cpu3}\
${else}${color9}${cpu cpu3}${color}${endif}${endif}${goto 205}${platform f71882fg.2560 temp 2}°${alignr}MB
cpu0 %${goto 78}${if_match ${cpu cpu0} < 10} ${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100} ${cpu cpu0}\
${else}${color9}${cpu cpu0}${color}${endif}${endif}${goto 190}${hddtemp /dev/sda}°${alignr}HDD
Fan ${platform f71882fg.2560 fan 1} rpm${alignr}${freq} mhz Freq
${swapbar 0}
${image $HOME/1_accuweather/forecast_2016/forecast_0.png -p 10,290 -s 250x250}\
S.T.${goto 118}Currently:${alignr}Temp\
${font Fira Mono:size=30}±${execi 300 sed -n '3p' ~/1_accuweather/curr_cond}\
${alignr}${execi 300 sed -n '2p' ~/1_accuweather/curr_cond}${font}
UVI: ${execi 300 sed -n '9p' ~/1_accuweather/curr_cond}/11\
${alignr}${execi 300 sed -n '8p' ~/1_accuweather/curr_cond}:Bar
Wind: ${execi 300 sed -n '5p' ~/1_accuweather/curr_cond} ${execi 300 sed -n '6p' ~/1_accuweather/curr_cond}\
${alignr}${execi 300 sed -n '7p' ~/1_accuweather/curr_cond} :Hum
Cld: ${execi 300 sed -n '10p' ~/1_accuweather/curr_cond}\
${alignr}${execi 300 sed -n '13p' ~/1_accuweather/curr_cond} :Vis
${image /media/5/Conky/4_Moon/0.png -p 90,560}
${alignc}${swapbar 0,50} Current Moon & Forecast ${swapbar 0,50}
${color5}${execi 3600 echo `date --date="0 day" | awk '{print $1" "$3" "$2}'`}\
${alignr}${execi 3600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}${color}
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 11,565 -s 45x45}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 215,565 -s 45x45}\
${if_match "${execpi 300 sed -n '4p' /home/sector11/1_accuweather/first_days}" == "Lo"} \
${else}${execpi 300 sed -n '3p' /home/sector11/1_accuweather/first_days}${endif}\
${alignr 55}${execi 300 sed -n '8p' ~/1_accuweather/first_days}
${goto 60}${if_match "${execpi 300 sed -n '4p' /home/sector11/1_accuweather/first_days}" == "Lo"}\
${execpi 300 sed -n '3p' /home/sector11/1_accuweather/first_days}${endif}\
${alignr}${execi 300 sed -n '9p' ~/1_accuweather/first_days}
${color5}${execi 3600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}\
${alignr}${execi 3600 echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}${color}
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 11,625 -s 45x45}\
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 215,625 -s 45x45}\
${execi 300 sed -n '13p' ~/1_accuweather/first_days}\
${alignr 55}${execi 300 sed -n '18p' ~/1_accuweather/first_days}
${goto 60}${execi 300 sed -n '14p' ~/1_accuweather/first_days}\
${alignr}${execi 300 sed -n '24p' ~/1_accuweather/first_days}
${alignc}${execi 300 sed -n '7p' /media/5/Conky/4_Moon/raw}
${swapbar 0}
Last edited by Sector11 (2017-08-30 01:55:37)
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
No not at all ...
~/1_accuweather
~/2b_Wunderground_API
~/4_Moon
Create ~/1_2b_4 and make a combined script there ~/1_2b_4/1-2b-4(.sh) and let each part pf the script use the original paths for it own images and database.
It does not matter where the script resides, it matters where it puts the data once collected.
Exactly. Leave the folders be, conky will collect the data from both places (Accuweather and the NWS folders) but the script will run just once, populating them.
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 tweaked a weather conky that used a now defunct 1b1_accuweather script to use the current 1_accuweather and of course 4_moon.
# pkill -xf "conky -c /media/5/Conky/The_Clock_2.conky" &
# edited 2017-08-31
### Begin Window Settings
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager,undecorated,below #,sticky
own_window_colour 000000
own_window_class Conky
own_window_title The Clock 2
minimum_size 200 200
maximum_width 200
gap_x 10 ## l|r
gap_y 10 ## u|d
alignment tr
### End Window Settings
### Font Settings
use_xft yes
xftfont Fantasque Sans Mono:bold:size=11
xftalpha 1.0
override_utf8_locale yes
### End Font Settings
### Color Settings
draw_shades yes
default_shade_color 000000
draw_outline no
default_outline_color 000000
default_color f5fffa ## MintCream
color1 778899 ## LightSlateGray
color2 FFA07A ## LightSalmon
color3 87CEFA ## LightSkyBlue
color4 48D1CC ## MediumTurquoise
color5 FFDEAD ## NavajoWhite
color6 00BFFF ## DeepSkyBlue
color7 B0E0E6 ## PowderBlue
color8 FFD700 ## Gold
color9 CD5C5C ## IndianRed
### End Color Settings
### Begin Borders Section
draw_borders no
stippled_borders 5
border_inner_margin 5
border_outer_margin 0
border_width 2
draw_graph_borders yes
### End Borders Secton
### Begin Miscellaneous Section
background no
use_spacer none
no_buffers yes
double_buffer yes
### End Miscellaneous Section
### LUA Settings
#-- CLOCK LUA
lua_load /media/5/Conky/LUA/12-24_DOTS_TC_2.lua
lua_draw_hook_pre main
#--- End LUA Settings
update_interval 1
#TEXT
#${execi 900 bash /media/5/Conky/4_Moon/moon}\
#${execi 900 bash /media/5/Conky/1_accuweather/1_accuweather -f2015 -f2016 -h2015 -h2016}\
TEXT
${image /media/5/Conky/images/bk_20.png -p -5,-5 -s 220x420}\
${image /media/5/Conky/4_Moon/0.png -p 27,60 -s 60x60}\
${image /media/5/Conky/1_accuweather/forecast_2016/forecast_0.png -p 45,80 -s 120x120}\
${image /media/5/Conky/images/24_ds.png -p 7,40}\
${alignc}${time %A}
${alignc}the ${if_match ${time %d} == 01}${time %dst} ${else}\
${if_match ${time %d} == 21}${time %dst} ${else}\
${if_match ${time %d} == 31}${time %dst} ${else}\
${if_match ${time %d} == 02}${time %dnd} ${else}\
${if_match ${time %d} == 22}${time %dnd} ${else}\
${if_match ${time %d} == 03}${time %drd} ${else}\
${if_match ${time %d} == 23}${time %drd} ${else}${time %dth} \
${endif}${endif}${endif}${endif}${endif}${endif}${endif}\
${time day of %b %Y}
${font monofur:bold:size=16}${color8}±${execi 300 sed -n '3p' /media/5/Conky/1_accuweather/curr_cond}°\
${alignr}${color}${execi 300 sed -n '2p' /media/5/Conky/1_accuweather/curr_cond}°${font}
${font monofur:bold:size=16}${color9}↑${execi 300 sed -n '3p' /media/5/Conky/1_accuweather/first_days}°\
${alignr}${color6}↓${execi 300 sed -n '4p' /media/5/Conky/1_accuweather/first_days}°${color}
${alignc}${color5}${execi 300 sed -n '4p' /media/5/Conky/1_accuweather/curr_cond}${color}${font}
${alignc}${if_match ${time %H}<12}Good Morning${else}\
${if_match ${time %H}<18}Good Afternoon${else}Good Evening${endif}${endif}
UVI ${execi 300 sed -n '9p' /media/5/Conky/1_accuweather/curr_cond} /11\
${alignr}Hum ${execi 300 sed -n '7p' /media/5/Conky/1_accuweather/curr_cond}
${alignc}Pressure: ${execi 300 sed -n '8p' /media/5/Conky/1_accuweather/curr_cond}
${color5}${alignc}Buenos Aires Sun
Rise ${color7}${execi 300 sed -n '23p' /media/5/Conky/1_accuweather/curr_cond}\
${alignr}${color5}Set ${color7}${execi 300 sed -n '24p' /media/5/Conky/1_accuweather/curr_cond}${color}
${color5}${alignc}The Southern Moon
Rise${color7} ${execi 300 sed -n '25p' /media/5/Conky/1_accuweather/curr_cond}${color}\
${alignr}${color5}Set ${color7}${execi 300 sed -n '26p' /media/5/Conky/1_accuweather/curr_cond}${color}
${alignc}${execpi 600 sed -n '7p' /media/5/Conky/4_Moon/raw}
${alignc}${execpi 600 sed -n '1p' /media/5/Conky/4_Moon/raw} visible @ ${execi 600 sed -n '6p' /media/5/Conky/4_Moon/raw}°
${alignc}and ${execi 600 sed -n '5p' /media/5/Conky/4_Moon/raw} day(s) old${font}
The LUA script:
--[[drawing a clock in conkyrc
by mrpeachy - 12 March 2010
Edited by Sector11 for TheClock-2 - 30 Jan 2016
lua_load /path/clock.lua
lua_draw_hook_pre main
TEXT
]]
require 'cairo'
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--##############################################################################
-- SETTINGS AREA
--##############################################################################
-- image
-- how do I add images.
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image /media/5/Conky/images/red_1.png -p 0,0 -s 35x35}")
--12 OR 24
local clock_type=24
--CLOCK SETTINGS
-- for the DOTS around the clock
local clock_radius=100 --100
local clock_centerx=106 --106
local clock_centery=140 --142 --106
-- SET MARKS
--how many marks around edge
local number_marks=0 --24
--set mark length
local m_length=0.5
--set mark line width
local m_width=1.0
--set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
--set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1 --opaque white
--SET BORDER OPTIONS
local clock_border_width=0 --2
--set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1 --full opaque white
--gap from clock border to hour marks
local b_to_m=5
--SECONDS HAND SETUP
--set length of seconds hand
local sh_length=75 --110
--set hand width
local sh_width=1 --1
--set hand line cap
local sh_cap=CAIRO_LINE_CAP_ROUND
--set seconds hand color
local shr,shg,shb,sha=1,0,0,1 --fully opaque red
--MINUTE HAND SETUP
--set length of minutes hand
local mh_length=80 --90
--set hand width
local mh_width=1.5 --1.5
--set hand line cap
local mh_cap=CAIRO_LINE_CAP_ROUND
--set minute hand color
local mhr,mhg,mhb,mha=0.1,0.8,0.9,1,1 --fully opaque blue
--HOUR HAND SETUP
--set length of hour hand
local hh_length=55 --60
--set hand width
local hh_width=4.0 --2
--set hand line cap
local hh_cap=CAIRO_LINE_CAP_ROUND
--set hour hand color
local hhr,hhg,hhb,hha=0.1,0.6,0.9,1,1 --fully opaque blue
--##############################################################################
-- END SETTINGS AREA
--##############################################################################
--DRAWING CODE
--draw border
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
--DRAW MARKS
--stuff that can be moved outside of the loop, needs only be set once
--calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length
--set line cap type
cairo_set_line_cap (cr, m_cap)
--set line width
cairo_set_line_width (cr,m_width)
--set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
--start for loop
for i=1,number_marks do
--drawing code using the value of i to calculate degrees
--calculate start point for 12 oclock mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
--calculate end point for 12 oclock mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--draw the line
cairo_stroke (cr)
end--of for loop
--TIME CALCULATIONS ###########################
if clock_type==12 then
hours=tonumber(os.date("%I")) --12 hour clock
--convert hours to seconds
h_to_s=hours*60*60
elseif clock_type==24 then
hours=tonumber(os.date("%H")) --24 hour clock
--convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
--convert minutes to seconds
m_to_s=minutes*60
--get current seconds
seconds=tonumber(os.date("%S"))
--DRAW HOUR HAND ############################
--convert hours, minutes & seconds to seconds
hsecs=h_to_s+m_to_s+seconds
--calculate number of degrees for each hand per second
hsec_degs=hsecs*(360/(60*60*clock_type)) -- USING AN EQUATION INSTEAD OF TYPING THE CALCULATION IN BECAUSE THE RESULT OF 360/43200 HAS DECIMAL PLACES
--set radius we will use to calculate hand points
radius=hh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of minutes hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,hh_width)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
--DRAW MINUTES HAND ############################
--convert minutes & seconds to seconds
msecs=m_to_s+seconds
--calculate degrees for the hand each second
msec_degs=msecs*0.1
--set radius we will use to calculate hand points
radius=mh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of minutes hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,mh_width)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
--DRAW SECOND HAND #############################
--calculate degrees for each second the hand moves
sec_degs=seconds*6
--set radius we will use to calculate hand points
radius=sh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of second hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,sh_width)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
--##############################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Nice one.
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
Nice one.
Thanks boss, buddy, friend, amigo, φίλος.
Πείτε στους Σπαρτιάτες να βάζουν τα δόρατά τους. Έρχομαι ειρηνικά.
Blame "G"
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Anytime buddy!!!
Who's "G"?
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
G - you know: Google, G doesn't normally do translations well. Sometimes to the point of not understanding.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Ah right, G, our God and savior...
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
Good Google NO! That's reason to become an atheist or become a librarian and index everything "G" knows.
OH MY ... that would be a job for the next dozen or so lifetimes.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Yep, I agree, it's become some sort of Big Brother...
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
Yes, bigger than Orwell, in a different way.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
All,
Can I get some help with the 1_accuweather script? For some reason, I can't seem to position it like I'd like. For example, using alignment='top_right', here is the script with gap_y = 0:.
Now I want it at the bottom of the screen and my screen is 1920x1200, so I'll try 500:
Hmm. A bit more, let's try 800:
Huh. If you look really closely, you'll see that it did not move from gap 500 to 800. In fact gap 1000 is the same as gap 500. Obviously, I've done something stupid.
Now, I will say that I *can* get the meter to move lower if I set "own_window_type='desktop'", but there is a drawback with that. On my MATE desktop, at least, the meter disappears the second I click the desktop...which isn't ideal.
Note, it does seem to only be this one conky script for me, others do okay (two from this very forum thread!):
Every script is using roughly the same "template" for the conkyrc:
own_window = true,
-- own_window_type = 'desktop',
own_window_transparent = true,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
own_window_argb_visual = true,
own_window_argb_value = 255,
I'm no conky expert (even less so with *lua* conky), but it worked once, so I keep using it.
Any ideas from the gurus?
Offline
@ Fortran <<--- name sounds familiar.
leave gaps alone.
gap_x = 200, -- ?? what ever you have to keep it clear of the moon conky
gap_y = 10,
alignment = 'bottom_right', -- change this
Also TRY:
own_window_type = 'normal',
On my MATE desktop
Mint? No worries, you are welcome here, but it helps to know.
IF none of this works could you please post the complete conky.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@ Fortran <<--- name sounds familiar.
leave gaps alone.
gap_x = 200, -- ?? what ever you have to keep it clear of the moon conky gap_y = 10, alignment = 'bottom_right', -- change this
Also TRY:
own_window_type = 'normal',
Fortran wrote:On my MATE desktop
Mint? No worries, you are welcome here, but it helps to know.
IF none of this works could you please post the complete conky.
Here is what I get with normal, bottom_right, gap_y = 10:
It does not like me. Now, when I run the conky I get this in the terminal:
...
2017-09-20 12:06:35 (3.22 MB/s) - ‘/home/mathomp4/1_accuweather/last_days_raw’ saved [120745/120745]
find: ‘/media/WesternDigital/MARY - DEMI/’: No such file or directory
cp: cannot stat ‘’: No such file or directory
(standard_in) 2: syntax error
(standard_in) 2: syntax error
Could that be it? I guess I usually run conky via a script launched with Alt-F2, so all the errors go off to /dev/null or wherever. It seems to refer to:
###############################################################
######## Bouboudes photos - to be removed on an update ########
###############################################################
photo=$(find "/media/WesternDigital/MARY - DEMI/" -iname "*.jpg"|shuf -n 1)
#photo=$(find "/home/teo/Pictures/" -maxdepth 1 -iname "*.jpg" -o -iname "*.png"|shuf -n 1)
cp "$photo" $HOME/conky_photo.jpg
x_res=$(file "$photo"|sed 's/^.*precision//'|awk '{print $2}'|sed 's/\,//'|sed 's/x/ /'|awk '{print $1}')
y_res=$(file "$photo"|sed 's/^.*precision//'|awk '{print $2}'|sed 's/\,//'|sed 's/x/ /'|awk '{print $2}')
ratio=$(echo "$x_res / $y_res"|bc -l)
output_y=$(echo "300 / $ratio"|bc -l|sed 's/\..*$//')
echo \${image $HOME/conky_photo.jpg -p 0,570 -s 300x$output_y} > $HOME/conky_photo_command
###############################################################
in the 1_accuweather script.
No matter what, here is the conkyrc (sort of close to what is in the 1_accuweather/.conkyrc_1_weatherfont file. Main change was moving to Roboto and the preamble):
conky.config = {
background = true,
-- Create own window instead of using desktop (required in nautilus)
own_window = true,
own_window_type = 'normal',
own_window_transparent = true,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
own_window_argb_visual = true,
own_window_argb_value = 255,
-- Use double buffering (reduces flicker, may not work for everyone)
double_buffer = true,
-- fiddle with window
use_spacer = 'right',
use_xft = true,
-- Update interval in seconds
update_interval = 3,
-- Minimum size of text area
minimum_width = 360, minimum_height = 300,
maximum_width = 360,
override_utf8_locale = true,
-- Draw shades?
draw_shades = false,
-- Text stuff
draw_outline = false,-- amplifies text if yes
draw_borders = false,
font = 'Roboto:size=9',
uppercase = false,-- set to yes if you want all text to be in uppercase
-- Stippled borders?
stippled_borders = 0,
-- border margins
border_inner_margin = 9,
-- border width
border_width = 10,
-- Default colors and also border colors, grey90 == #e5e5e5
default_color = 'white',
-- Text alignment, other possible values are commented
--alignment = top_left,
--alignment = 'top_right',
--alignment = bottom_left,
alignment = 'bottom_right',
-- Gap between borders of screen and text
gap_x = -1470,
gap_y = 10,
imlib_cache_size = 0,
-- stuff after 'TEXT' will be formatted on screen
};
conky.text = [[
${font Roboto:size=12}${color ffe595}WEATHER ${font}${hr 2}$color${texeci 500 bash $HOME/1_accuweather/1_accuweather -f}
${font Roboto:size=10}${execpi 600 sed -n '4p' $HOME/1_accuweather/curr_cond}
${font conkyweather:size=130}${execi 600 sed -n '22p' $HOME/1_accuweather/curr_cond}${font}
${voffset -170}${font}${goto 200}${color ffe595}TEMPERATURE: $color${alignr}${execpi 600 sed -n '2p' $HOME/1_accuweather/curr_cond}° (${execpi 600 sed -n '3p' $HOME/1_accuweather/curr_cond}°)
${goto 200}${color ffe595}WIND SPEED: $color${alignr}${execpi 600 sed -n '5p' $HOME/1_accuweather/curr_cond} ${execpi 600 sed -n '6p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}HUMIDITY: $color${alignr}${execpi 600 sed -n '7p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}PRESSURE: $color${alignr}${execpi 600 sed -n '8p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}UV INDEX: $color${alignr}${execpi 600 sed -n '9p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}CLOUD COVER: $color${alignr}${execpi 600 sed -n '10p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}CEILING: $color${alignr}${execpi 600 sed -n '11p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}DEW POINT: $color${alignr}${execpi 600 sed -n '12p' $HOME/1_accuweather/curr_cond}°
${goto 200}${color ffe595}VISIBILITY: $color${alignr}${execpi 600 sed -n '13p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}SUN R/S: $color${alignr}${execpi 600 sed -n '14p' $HOME/1_accuweather/curr_cond}/${execpi 600 sed -n '15p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}SUN DUR: $color${alignr}${execpi 600 sed -n '16p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}MOON R/S: $color${alignr}${execpi 600 sed -n '18p' $HOME/1_accuweather/curr_cond}/${execpi 600 sed -n '19p' $HOME/1_accuweather/curr_cond}
${goto 200}${color ffe595}MOON DUR: $color${alignr}${execpi 600 sed -n '20p' $HOME/1_accuweather/curr_cond}
${hr 1}
${goto 40}${font Roboto:size=10}${color ffe595}${execpi 600 sed -n '1p' $HOME/1_accuweather/first_days}${goto 145}${execpi 600 sed -n '6p' $HOME/1_accuweather/first_days}${goto 270}${execpi 600 sed -n '11p' $HOME/1_accuweather/first_days}$color$font
${font conkyweather:size=50}${execi 600 sed -n '26p' $HOME/1_accuweather/first_days}${goto 135}${execi 600 sed -n '27p' $HOME/1_accuweather/first_days}${goto 255}${execi 600 sed -n '28p' $HOME/1_accuweather/first_days}${font}
${voffset -45}${goto 100}${execpi 600 sed -n '3p' $HOME/1_accuweather/first_days}°${goto 210}${execpi 600 sed -n '8p' $HOME/1_accuweather/first_days}°${goto 330}${execpi 600 sed -n '13p' $HOME/1_accuweather/first_days}°
${goto 100}/${execpi 600 sed -n '4p' $HOME/1_accuweather/first_days}°${goto 210}/${execpi 600 sed -n '9p' $HOME/1_accuweather/first_days}°${goto 330}/${execpi 600 sed -n '14p' $HOME/1_accuweather/first_days}°
${font Roboto:size=8}${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -c1-20}${goto 135}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -c1-20}${goto 255}${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -c1-20}
${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -c21-40}${goto 135}${execpi 600 sed -n '10p' $HOME/1_accuweather/first_days|cut -c21-40}${goto 255}${execpi 600 sed -n '15p' $HOME/1_accuweather/first_days|cut -c21-40}$font
${hr 1}
${goto 40}${font Roboto:size=10}${color ffe595}${execpi 600 sed -n '16p' $HOME/1_accuweather/first_days}${goto 145}${execpi 600 sed -n '21p' $HOME/1_accuweather/first_days}${goto 270}${execpi 600 sed -n '1p' $HOME/1_accuweather/last_days}$color$font
${font conkyweather:size=50}${execi 600 sed -n '29p' $HOME/1_accuweather/first_days}${goto 135}${execi 600 sed -n '30p' $HOME/1_accuweather/first_days}${goto 255}${execi 600 sed -n '26p' $HOME/1_accuweather/last_days}${font}
${voffset -45}${goto 100}${execpi 600 sed -n '18p' $HOME/1_accuweather/first_days}°${goto 210}${execpi 600 sed -n '23p' $HOME/1_accuweather/first_days}°${goto 330}${execpi 600 sed -n '3p' $HOME/1_accuweather/last_days}°
${goto 100}/${execpi 600 sed -n '19p' $HOME/1_accuweather/first_days}°${goto 210}/${execpi 600 sed -n '24p' $HOME/1_accuweather/first_days}°${goto 330}/${execpi 600 sed -n '4p' $HOME/1_accuweather/last_days}°
${font Roboto:size=8}${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -c1-20}${goto 135}${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -c1-20}${goto 255}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -c1-20}
${execpi 600 sed -n '20p' $HOME/1_accuweather/first_days|cut -c21-40}${goto 135}${execpi 600 sed -n '25p' $HOME/1_accuweather/first_days|cut -c21-40}${goto 255}${execpi 600 sed -n '5p' $HOME/1_accuweather/last_days|cut -c21-40}$font
${hr 1}
${goto 40}${font Roboto:size=10}${color ffe595}${execpi 600 sed -n '6p' $HOME/1_accuweather/last_days}${goto 145}${execpi 600 sed -n '11p' $HOME/1_accuweather/last_days}${goto 270}${execpi 600 sed -n '16p' $HOME/1_accuweather/last_days}$color$font
${font conkyweather:size=50}${execi 600 sed -n '27p' $HOME/1_accuweather/last_days}${goto 135}${execi 600 sed -n '28p' $HOME/1_accuweather/last_days}${goto 255}${execi 600 sed -n '29p' $HOME/1_accuweather/last_days}${font}
${voffset -45}${goto 100}${execpi 600 sed -n '8p' $HOME/1_accuweather/last_days}°${goto 210}${execpi 600 sed -n '13p' $HOME/1_accuweather/last_days}°${goto 330}${execpi 600 sed -n '18p' $HOME/1_accuweather/last_days}°
${goto 100}/${execpi 600 sed -n '9p' $HOME/1_accuweather/last_days}°${goto 210}/${execpi 600 sed -n '14p' $HOME/1_accuweather/last_days}°${goto 330}/${execpi 600 sed -n '19p' $HOME/1_accuweather/last_days}°
${font Roboto:size=8}${execpi 600 sed -n '10p' $HOME/1_accuweather/last_days|cut -c1-20}${goto 135}${execpi 600 sed -n '15p' $HOME/1_accuweather/last_days|cut -c1-20}${goto 255}${execpi 600 sed -n '20p' $HOME/1_accuweather/last_days|cut -c1-20}
${execpi 600 sed -n '10p' $HOME/1_accuweather/last_days|cut -c21-40}${goto 135}${execpi 600 sed -n '15p' $HOME/1_accuweather/last_days|cut -c21-40}${goto 255}${execpi 600 sed -n '20p' $HOME/1_accuweather/last_days|cut -c21-40}$font
]];
Offline
^ lets start with - it loves you - it is doing exactly what you said for it to do
Because you are using weatherfonts that require a ${voffset xxx} you are moving things like explained here.
So the last line of your conky add something like this:
$font${voffset -150}
]];
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Oooh! Thanks! That fixed it!
I guess I'm still learning things as my conky ability is a bit low. Usually take what others do and hack it.
Of course, I just scanned the forum and saw your world time date forecast conky and, well, I might just have to nuke some of these things because...so cool! (ETA: Hmm. Looks like that might take a while. That thing depends on many scripts I don't have.)
Last edited by Fortran (2017-09-20 16:52:43)
Offline
Exactly how I started, copied one and tweaked it. And it was U·G·L·Y to the bone!
I've been at conky for 10 years now, if you need help with one of Teos scripts this is where you'll find me and a lot of other great people.
If it's a general conky question pop it into it's own thread in Index » GUI & Applications
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello guys,
Since 2 days i don't have any Moon_phase.png with wunderground is ther a problem with the site ?
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline