You are not logged in.

#4441 2024-02-16 14:17:40

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

^ I don't use the openweather script, but I'll try to explain it to you.

You need a command in the terminal that gives the current wind direction.
You will have to find it yourself.

For example (Accuweather conky script):

$ cat ~/Accuweather_conky_script/curr_cond_raw | grep -A 1 "<div>Wind</div>" | grep km/h | awk '{print $1}' | awk '{gsub(/^.{5}/,"");}1'
ESE

Now that we know that the command works, we can create the wind.sh script (same folder):

#!/bin/bash

rm ~/Accuweather_conky_script/wind_0.png

wind=$(cat ~/Accuweather_conky_script/curr_cond_raw | grep -A 1 "<div>Wind</div>" | grep km/h | awk '{print $1}' | awk '{gsub(/^.{5}/,"");}1')

if [[ "$wind" == "0" ]]; then
  
   cp ~/Accuweather_conky_script/Forecast_Images_2015/CLM.png ~/Accuweather_conky_script/wind_0.png
   
   else

cp ~/Accuweather_conky_script/Forecast_Images_2015/"$wind".png ~/Accuweather_conky_script/wind_0.png

    fi

Make the script executable.

Then run the script once in the terminal:

$ bash $HOME/Accuweather_conky_script/wind.sh

You will get wind_0.png image in ~/Accuweather_conky_script folder.   

Add to conky after accuweather script (first line):

${texeci 500 bash $HOME/Accuweather_conky_script/wind.sh}

Done.

Restart conky.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4442 2024-02-17 08:17:21

asqwerth
Member
Registered: 2015-10-08
Posts: 24

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

Thanks for the tips @marens.  Looks like the openweather script from that github link is not one where you run the whole script from conky; but one where you specify (from conky) which of the functions in the script you want to run to display info.  So I adjusted the openweather script so that when you specify the wind_deg function inside your conky, the function not only displays the direction of the wind (where it's coming from) using compass point terminology, it also generates a text file with the said wind direction in it. 

I'm sure the tweak doesn't follow best practices since I'm a novice at scripting, but hey, it works. :-P

I didn't need to use the function that generates the opposite wind direction (ie, where it's going to), because Accuweather's wind direction images are already labelled the opposite direction.

#!/bin/bash
#
# Fetches weather data from openweathermap.com

# TODO
# - support templates and populate it in one big call
# - support wind directions http://snowfence.umn.edu/Components/winddirectionanddegreeswithouttable3.htm
# - after sunset, use the night fonts instead of the day fonts
# - finish WEATHER_CONDITIONS (http://bluejamesbond.github.io/CharacterMap/)

OPENWEATHERMAP_BASE_URL="http://api.openweathermap.org/data/2.5/"

# tools required
CURL=`which curl`
JQ=`which jq`

if [[ -z "${CURL}" ]]; then
  echo "ERROR: curl is not installed."
  exit -1
fi

if [[ -z "${JQ}" ]]; then
  echo "ERROR: jq is not installed."
  exit -1
fi

while getopts ":d:c:q:u:a:q:l:t:i:f:" opt; do
  case $opt in
    a) API_KEY="${OPTARG}" ;;
    c) CACHE_DIR="${OPTARG}" ;;
    d) DATATYPE="${OPTARG}" ;;
    f) CONFIG="${OPTARG}" ;;
    i) CITY_ID="${OPTARG}" ;;
    l) LANGUAGE="${OPTARG}" ;;
    q) LOCATION="${OPTARG}" ;;
    t) TYPE="${OPTARG}" ;;
    u) UNITS="${OPTARG}" ;;
    \?) echo "Invalid option -${OPTARG}" >&2 ;;
  esac
done

if [[ -z "${CONFIG}" ]]; then
  CONFIG="config.json"
fi


API_KEY=${API_KEY:-$(cat ${CONFIG} | jq '.api_key' -r)}
CACHE_DIR=${CACHE_DIR:-$(cat ${CONFIG} | jq '.cache_dir' -r)}
CITY_ID=${CITY_ID:-$(cat ${CONFIG} | jq '.city_id' -r)}
LANGUAGE=${LANGUAGE:-$(cat ${CONFIG} | jq '.language' -r)} # valid values are: see languages.txt
LOCATION=${LOCATION:-$(cat ${CONFIG} | jq '.location' -r)}
TYPE=${TYPE:-$(cat ${CONFIG} | jq '.type' -r)}  # valid values are [current, forecast]
UNITS=${UNITS:-$(cat ${CONFIG} | jq '.units' -r)}

function lock() {

 lockdir="${CACHE_DIR}/refresh.lock"
 if mkdir "$lockdir"
 then
     echo >&2 "successfully acquired lock"
     trap 'rm -rf "$lockdir"' 0    # remove directory when script finishes
 else
     echo >&2 "cannot acquire lock, giving up on $lockdir"
     sleep 0.5
 fi

}


function get_weather_url() {
  url=${OPENWEATHERMAP_BASE_URL}
  case $1 in
  current)
    url+="weather"
  ;;
  forecast)
    url+="forecast"
  ;;
  esac

  # location
  if [[ ! -z "${LOCATION}" ]]; then
    url+="?q=${LOCATION}"
  fi

  # city_id
  if [[ ! -z "${CITY_ID}" ]]; then
    url+="?id=${CITY_ID}"
  fi

  # application id
  url+="&APPID=${API_KEY}"

  # units
  url+="&units=${UNITS}"

  # lang
  url+="&lang=${LANGUAGE}"

  # accurate
  url+="&type=accurate"

  echo $url
}

function get_cache_path() {
  case $TYPE in
  current)
    cache_name="current_weather.cache"
  ;;
  forecast)
    cache_name="forecast_weather.cache"
  ;;
  esac

  echo ${CACHE_DIR}/${cache_name}
}

#######################################
# Check the cache file and determine
# if it needs to be updated or not
# Globals:
#   None
# Arguments:
#   None
# Returns:
#   0 or 1
#######################################
function cache_needs_refresh() {
  cache_path=$(get_cache_path)
  now=$(date +%s)

  # if the cache does not exist, refresh it
  if [[ ! -f "${cache_path}" ]]; then
    return 1
  fi

  last_modification_date=$(stat -c %Y ${cache_path})
  seconds=$(expr ${now} - ${last_modification_date})

  if [[ "${seconds}" -gt 120 ]]; then
    return 1
  else
    return 0
  fi
}

function fetch_weather() {
  cache_needs_refresh
  refresh=$?
  url=$(get_weather_url ${TYPE})
  # echo ${url}
  cache_path=$(get_cache_path)
  if [[ ! -f "${cache_path}" ]] || [[ "${refresh}" -eq 1 ]]; then
    ${CURL} -s ${url} > ${cache_path}.$$
    # only update the file if we successfully retrieved the JSON
    num_of_lines=$(cat "${cache_path}.$$" | wc -c)
    if [[ "${num_of_lines}" -gt 200 ]]; then
      mv "${cache_path}.$$" ${cache_path}
    else
      rm -f ${cache_path}.$$
    fi
  fi
}


function create_cache() {
  if [[ ! -d "${CACHE_DIR}" ]]; then
    mkdir -p ${CACHE_DIR}
  fi
}

function return_field() {

  if [[ -z "${DATATYPE}" ]]; then
    echo "ERROR: missing datatype. Please provide it via the -p option."
  fi

  cache_path=$(get_cache_path)

  case ${TYPE} in
    current)
      case ${DATATYPE} in
        condition)
          data=$(cat ${cache_path} | ${JQ} '.weather[] | .main' -r | paste -sd ',' -)
          ;;
        summary)
          data=$(cat ${cache_path} | ${JQ} '.weather[0].description' -r)
          ;;
        temp|pressure|humidity|temp_min|temp_max)
          data=$(cat ${cache_path} | ${JQ} ".main.${DATATYPE}" -r |  xargs printf "%.f" $p)
          ;;
        clouds)
          data=$(cat ${cache_path} | ${JQ} ".clouds.all" -r)"%"
          ;;
        visibility)
          data=$(cat ${cache_path} | ${JQ} ".visibility" -r)
          ;;
        wind_speed)
          data=$(cat ${cache_path} | ${JQ} ".wind.speed" -r)
          ;;
        wind_deg)
          data=$(cat ${cache_path} | ${JQ} ".wind.deg" -r | xargs printf "%.f" $p)
          data=$(wind_deg_to_text ${data})
          
          data= echo ${data} >| $HOME/conkystuff/conkySimpleForecast-openw-newsyntax/wind
          ;;
        wind_deg_opp)
          data=$(cat ${cache_path} | ${JQ} ".wind.deg" -r | xargs printf "%.f" $p)
          data=$(wind_deg_to_textopp ${data})
          
          ;;
        wind_deg_font)
            tmp_data=$(cat ${cache_path} | ${JQ} ".wind.deg" -r | xargs printf "%.f" $p)
            data=$(wind_deg_to_font ${tmp_data})
          ;;
        sunrise|sunset)
          tmp_data=$(cat ${cache_path} | ${JQ} ".sys.${DATATYPE}" -r)
          data=$(date -d @"${tmp_data}" "+%H:%M")
          ;;
        city)
          data=$(cat ${cache_path} | ${JQ} ".name" -r)
          ;;
        font)
          # ${offset 15}${color EAEAEA}${font ConkyWeather:size=46}${execi 120 conkySimpleForecast -d font}${font}${voffset -30}
          tmp_data=$(cat ${cache_path} | ${JQ} '.weather[0].id' -r)
          data=$(cat ./fonts.json | ${JQ} .[\""$tmp_data"\"] -r)
          ;;
        fonticon)
          # ${offset 15}${color EAEAEA}${font ConkyWeather:size=46}${execi 120 conkySimpleForecast -d font}${font}${voffset -30}
          tmp_data=$(cat ${cache_path} | ${JQ} '.weather[0].icon' -r)
          data=$(cat ./fonts.json | ${JQ} .[\""$tmp_data"\"] -r)
          ;;
        dt)
          data=$(cat ${cache_path} | ${JQ} '.dt')
          data=$(date -d @${data})
          ;;
        *)
          data="N/A"
          ;;
        esac
      ;;
    forecast)
      data=$(cat ${cache_path} | ${JQ} '.city.name')
      ;;
    *) echo "Unknown type" ;;
  esac

  echo $data
}

function wind_deg_to_text() {
  local deg=$1
  # N 348.75 - 11.25
  if [[ "${deg}" -ge 348 ]] || [[ "${deg}" -le 11 ]];  then
    echo "N"
  # NNE 11.25 - 33.75
  elif [[ "${deg}" -gt 11 ]] && [[ "${deg}" -lt 34 ]];  then
    echo "NNE"
  # NE 33.75 - 56.25
  elif [[ "${deg}" -ge 34 ]] && [[ "${deg}" -lt 56 ]]; then
    echo "NE"
  # ENE 56.25 - 78.75
  elif [[ "${deg}" -ge 56 ]] && [[ "${deg}" -lt 78 ]]; then
    echo "ENE"
  # E 78.75 - 101.25
  elif [[ "${deg}" -ge 78 ]] && [[ "${deg}" -lt 101 ]]; then
    echo "E"
  # ESE 101.25 - 123.75
  elif [[ "${deg}" -ge 101 ]] && [[ "${deg}" -lt 123 ]]; then
    echo "ESE"
  # SE 123.75 - 146.25
  elif [[ "${deg}" -ge 123 ]] && [[ "${deg}" -lt 146 ]]; then
    echo "SE"
  # SSE 146.25 - 168.75
  elif [[ "${deg}" -ge 146 ]] && [[ "${deg}" -lt 168 ]]; then
    echo "SSE"
  # S 168.75 - 191.25
  elif [[ "${deg}" -ge 168 ]] && [[ "${deg}" -lt 191 ]]; then
    echo "S"
  # SSW 191.25 - 213.75
  elif [[ "${deg}" -ge 191 ]] && [[ "${deg}" -lt 213 ]]; then
    echo "SSW"
  # SW 213.75 - 236.25
  elif [[ "${deg}" -ge 213 ]] && [[ "${deg}" -lt 236 ]]; then
    echo "SW"  
  # WSW 236.25 - 258.75
  elif [[ "${deg}" -ge 236 ]] && [[ "${deg}" -lt 258 ]]; then
    echo "WSW" 
  # W 258.75 - 281.25
  elif [[ "${deg}" -ge 258 ]] && [[ "${deg}" -lt 281 ]]; then
    echo "W" 
  # WNW 281.25 - 303.75
  elif [[ "${deg}" -ge 281 ]] && [[ "${deg}" -lt 303 ]]; then
    echo "WNW" 
  # NW 303.75 - 326.25
  elif [[ "${deg}" -ge 303 ]] && [[ "${deg}" -lt 326 ]]; then
    echo "NW" 
  # NNW 326.25 - 348.75
  elif [[ "${deg}" -ge 326 ]] && [[ "${deg}" -lt 348 ]]; then
    echo "NNW" 
  else
    echo "N/A"
  fi
}

function wind_deg_to_textopp() {
  local deg=$1
  # N 348.75 - 11.25
  if [[ "${deg}" -ge 348 ]] || [[ "${deg}" -le 11 ]];  then
    echo "S"
  # NNE 11.25 - 33.75
  elif [[ "${deg}" -gt 11 ]] && [[ "${deg}" -lt 34 ]];  then
    echo "SSW"
  # NE 33.75 - 56.25
  elif [[ "${deg}" -ge 34 ]] && [[ "${deg}" -lt 56 ]]; then
    echo "SW"
  # ENE 56.25 - 78.75
  elif [[ "${deg}" -ge 56 ]] && [[ "${deg}" -lt 78 ]]; then
    echo "WSW"
  # E 78.75 - 101.25
  elif [[ "${deg}" -ge 78 ]] && [[ "${deg}" -lt 101 ]]; then
    echo "W"
  # ESE 101.25 - 123.75
  elif [[ "${deg}" -ge 101 ]] && [[ "${deg}" -lt 123 ]]; then
    echo "WNW"
  # SE 123.75 - 146.25
  elif [[ "${deg}" -ge 123 ]] && [[ "${deg}" -lt 146 ]]; then
    echo "NW"
  # SSE 146.25 - 168.75
  elif [[ "${deg}" -ge 146 ]] && [[ "${deg}" -lt 168 ]]; then
    echo "NNW"
  # S 168.75 - 191.25
  elif [[ "${deg}" -ge 168 ]] && [[ "${deg}" -lt 191 ]]; then
    echo "N"
  # SSW 191.25 - 213.75
  elif [[ "${deg}" -ge 191 ]] && [[ "${deg}" -lt 213 ]]; then
    echo "NNE"
  # SW 213.75 - 236.25
  elif [[ "${deg}" -ge 213 ]] && [[ "${deg}" -lt 236 ]]; then
    echo "NE"  
  # WSW 236.25 - 258.75
  elif [[ "${deg}" -ge 236 ]] && [[ "${deg}" -lt 258 ]]; then
    echo "ENE" 
  # W 258.75 - 281.25
  elif [[ "${deg}" -ge 258 ]] && [[ "${deg}" -lt 281 ]]; then
    echo "E" 
  # WNW 281.25 - 303.75
  elif [[ "${deg}" -ge 281 ]] && [[ "${deg}" -lt 303 ]]; then
    echo "ESE" 
  # NW 303.75 - 326.25
  elif [[ "${deg}" -ge 303 ]] && [[ "${deg}" -lt 326 ]]; then
    echo "SE" 
  # NNW 326.25 - 348.75
  elif [[ "${deg}" -ge 326 ]] && [[ "${deg}" -lt 348 ]]; then
    echo "SSE" 
  else
    echo "N/A"
  fi
}

    
function wind_deg_to_font() {
  local deg=$1
  text=$(wind_deg_to_textopp "${deg}")
  data=$(cat ./wind_direction.json | ${JQ} ".${text}" -r)
  echo $data

}

if [[ -z "${API_KEY}" ]]; then
  echo "ERROR: missing api_key. Please provide it via -a myapikey option"
  echo "ERROR: Get a free api_key from https://home.openweathermap.org/api_keys"
  exit -1
fi

if [[ -z "${LOCATION}" ]] && [[ -z "${CITY_ID}" ]]; then
  echo "ERROR: location (-l) or city id (-i) should must be given."  
fi

create_cache
fetch_weather
return_field

Then I modified your wind.sh to extract the one-letter text from the text file instead of from Accuweather conky script's curr_cond_raw file.  I always assume that the Accuweather conky script may one day not work (fingers crossed this never happens!), so any alternatives I use should not depend on Accuweather's output.

Example:
XeGtxWam.png

Offline

#4443 2024-02-17 14:15:41

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

I'm glad you made it.

Don't forget that the work is not done yet.
You have to wait for Calm and replace '0' with the output given by openweather (maybe N/A):

if [[ "$wind" == "0" ]]; then

Another aesthetic tip:
Replace the images and size of the moon and wind.

If you want the moon in conky to look the same as it does in the sky, look here:
https://forums.bunsenlabs.org/viewtopic … 46#p128546

You just need to substitute the latitude and longitude for your location at the beginning of my moongiant script plugin.

As I said:

marens wrote:

For me, the best conky is the one you make yourself.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4444 2024-02-20 16:42:21

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Gis Weather - Accu2015 theme

Accu2015.png

Download here:
https://workupload.com/file/uKqvYMcmmRk

How to install:
https://forums.bunsenlabs.org/viewtopic … 63#p131063

Of course, it is always necessary to test.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4445 2024-02-27 15:50:19

weatherman
Member
Registered: 2023-01-09
Posts: 6

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

is it just me or is accuweather's "curr_cond" partially messed up?

Offline

#4446 2024-02-27 17:26:44

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

^ I can confirm.
To fix my moon script for Gis Weather I had to modify the accuweather script.

gis.png

Accuweather developers have completely changed that part and moonduration is no longer visible.
I was able to fix most of it, but I will have to create a new script that calculates the duration of the moon.
I don't know when I will do it.

* Be sure to make a copy of the accuweather script before making any changes.

First check if you have done this:
https://forums.bunsenlabs.org/viewtopic … 88#p130188

Then:

               sed '/sunrise-sunset content-module /,/temp-history content-module/!d' $HOME/Accuweather_conky_script/curr_cond_raw > $HOME/Accuweather_conky_script/curr_cond_temp1
               
## 26.02.2024		sed -i -e 's/.*"text-value">//g' -e 's/<\/span>$//g' -e '/</d' $HOME/Accuweather_conky_script/curr_cond_temp1

## 26.02.2024		sed -i -e '1d;4d' -e 's/^[\t]*//g' -e 's/ AM/:AM/g' -e 's/ PM/:PM/g' -e 's/ .*$//g' -e '/^$/d' -e 's/:AM/ AM/g' -e 's/:PM/ PM/g' $HOME/Accuweather_conky_script/curr_cond_temp1

## 26.02.2024		sed -i -e '1N;s/\n/:/' $HOME/Accuweather_conky_script/curr_cond_temp1

#### SM*Settings - Fix 26.02.2024
		
	       sed -i -e '/div/g' -e '/img/g' -e '/times-label/g' -e '/title\|Sun \|h2/g' -e 's/^[\t]*//g' -e '/^$/d' $HOME/Accuweather_conky_script/curr_cond_temp1

               sed -i 's/<span class="sunrise-sunset__times-value">//g' $HOME/Accuweather_conky_script/curr_cond_temp1

               sed -i 's/<span class="sunrise-sunset__phrase">//g' $HOME/Accuweather_conky_script/curr_cond_temp1

               sed -i 's/<\/span>//g' $HOME/Accuweather_conky_script/curr_cond_temp1
               
               sed -i 's/ hrs /:/g' $HOME/Accuweather_conky_script/curr_cond_temp1

               sed -i 's/ mins//g' $HOME/Accuweather_conky_script/curr_cond_temp1


## 07.11.2023		if [[ $(sed -n 4p $HOME/Accuweather_conky_script/curr_cond_temp1) != "N/A" && $(sed -n 5p $HOME/Accuweather_conky_script/curr_cond_temp1) != "N/A" && $(sed -n 6p $HOME/Accuweather_conky_script/curr_cond_temp1) != "N/A" && $(sed -n 7p $HOME/Accuweather_conky_script/curr_cond_temp1) != "N/A" ]]; then
		
#### SM*Settings - 07.11.2023 Accuweater change 'N/A' with '--' 
## 26.02.2024		if [[ $(sed -n 4p $HOME/Accuweather_conky_script/curr_cond_temp1) != "--" && $(sed -n 5p $HOME/Accuweather_conky_script/curr_cond_temp1) != "--" && $(sed -n 6p $HOME/Accuweather_conky_script/curr_cond_temp1) != "--" && $(sed -n 7p $HOME/Accuweather_conky_script/curr_cond_temp1) != "--" ]]; then
		

## 26.02.2024			sed -i '4N;s/\n/:/' $HOME/Accuweather_conky_script/curr_cond_temp1
## 26.02.2024		fi

Currently it shows Moon Phase instead of moonduration.
You can easily change that to conky.
Everything else works (for now).

We will see what happens when the moon is 'not available'.

conky.png

Last edited by marens (2024-02-27 18:03:55)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4447 2024-02-27 17:34:11

weatherman
Member
Registered: 2023-01-09
Posts: 6

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

@marens
works fine, thanks smile

Offline

#4448 2024-02-28 17:13:09

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

I finished the script that calculates moonduration.
You can test.

gis.png


Open accuweather script.

Find line:

sed -i 's/--/N\/A/g' $HOME/Accuweather_conky_script/curr_cond

Add below:

#### SM*Settings 28.02.2024 - Moon Duration Script

moonrise=$(sed -n '25p' $HOME/Accuweather_conky_script/curr_cond)
moonset=$(sed -n '26p' $HOME/Accuweather_conky_script/curr_cond)

  if [[ "$moonrise" == "N/A"  || "$moonset" == "N/A" ]]; then

     printf "N/A" > $HOME/Accuweather_conky_script/moon_duration
     
  else  

## moonrise
moonrise_hour=$(sed -n '25p' $HOME/Accuweather_conky_script/curr_cond | awk -F':' '{print $1}')
moonrise_min=$(sed -n '25p' $HOME/Accuweather_conky_script/curr_cond | awk -F':' '{print $2}')

## moonset
moonset_hour=$(sed -n '26p' $HOME/Accuweather_conky_script/curr_cond | awk -F':' '{print $1}')
moonset_min=$(sed -n '26p' $HOME/Accuweather_conky_script/curr_cond | awk -F':' '{print $2}')

## convert to minutes
convert_moonrise=$(echo $moonrise_hour*60+$moonrise_min | bc)
convert_moonset=$(echo $moonset_hour*60+$moonset_min | bc)

## time2 - time1
diff=$(echo $convert_moonset-$convert_moonrise | bc)

if [[ $diff -ge 0 ]]; then
  diff1=$(echo $diff)
else 
  diff1=$(echo 1440-${diff#-} | bc)
fi

## back to hours
hours=$(echo $diff1 / 60 | bc)
hours1=$(echo $diff1 / 60 | bc -l)

## back to minutes
diff_min=$(echo $hours1-$hours | bc -l)

minutes1=$(echo $diff_min*60 | bc)
minutes=$(echo $minutes1 | awk '{print int($1)}')

#### Print Moon Duration   
   
  if [[ $hours -ge 10 && $minutes -ge 10 ]]; then

     printf "$hours:$minutes" > $HOME/Accuweather_conky_script/moon_duration   
   
  fi

  if [[ $hours -lt 10 && $minutes -lt 10 ]]; then

     printf "$hours:0$minutes" > $HOME/Accuweather_conky_script/moon_duration
   
  fi

  if [[ $hours -ge 10 && $minutes -lt 10 ]]; then

     printf "$hours:0$minutes" > $HOME/Accuweather_conky_script/moon_duration
   
  fi

  if [[ $hours -lt 10 && $minutes -ge 10 ]]; then

     printf "$hours:$minutes" > $HOME/Accuweather_conky_script/moon_duration
   
  fi

 fi
 
#### END SM*Settings 28.02.2024 - Moon Duration Script

Conky:

MOON DURAT.: ${texeci 600 sed -n '1p' $HOME/Accuweather_conky_script/moon_duration}

conky.png

Everything works as expected (for now).
We will see what happens when the moon is 'not available'.

EDIT
Fixed a syntax error in the code.

EDIT 2
Fixed moonduration output.
Instead of (example) '9:2' > '9:02'.

EDIT 3
When the moon  rises/sets on the same day.

EDIT 4
The bug was found and fixed.

Last edited by marens (2024-10-26 00:04:31)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4449 2024-03-02 00:34:47

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

I didn't have to wait long to test the script when the moon 'not available'.
This happened just now ( for my location ).

The edited script (above) works.

Gis Weather:
gis.png

Conky:
conky.png

Accuweather site (my location):
accuweather.png

Last edited by marens (2024-03-02 01:11:21)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4450 2024-03-04 04:50:13

asqwerth
Member
Registered: 2015-10-08
Posts: 24

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

For some reason, the Accuweather Conky Script ("ACS") is no longer writing the weatherfont and windfont conversion letters/numbers in the curr_cond file (lines 22 onwards in the file are missing).  The weather font conversion still takes place in the hourly and daily_forecast files. 

So now the current weather and wind condition is missing for conkyweatherfont conkies, but the daily forecast fonts still show up.

I think this missing weather/wind font thing only just started happening about 1-2 weeks ago.  But perhaps it has been like that for some time and I just didn't notice as I have been testing the Accuw RSS script.

I can of course use other conkies that rely on images and not the font, but it is annoying and puzzling.

Offline

#4451 2024-03-04 08:30:35

ceeslans
Member
Registered: 2015-09-30
Posts: 195

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

Yep, it's annoying for all of us conkyweatherfont users.  Hopefully one of the weatherscript gurus here (like @il.harun and @marens ) could dive into this and come up with code correction....
Meantime, I'm calling the accuweather-RSS script code to display the 'current' weatherfont icon in the ACS weather conkies smile

Last edited by ceeslans (2024-03-04 08:32:57)

Offline

#4452 2024-03-04 13:35:44

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

@asqwerth and @ceeslans

I'm sorry, but I've never used conky with weatherfont except when I tried the accuweather-RSS script.
Similar to @il.harun I have discontinued support for the Accuweather Conky Script.
The exception is the sun(moon) rise/set part due to users using moon in Gis Weather.

This is what my curr_cond file looks like now (lines 20-27):

Waning Crescent
6100 m
b
06:13
17:33
02:10
10:08
?

Try updating the accuweather script with all my changes to the sun/moon part.
They directly affect the curr_cond file.

Look here:
https://forums.bunsenlabs.org/viewtopic … 71#p132471


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4453 2024-03-04 15:05:21

asqwerth
Member
Registered: 2015-10-08
Posts: 24

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

@marens

Thank you, your Feb 2024 script amendments solved the problem.

I had not been paying attention to your gisweather sun/moon posts, because I didn't think they were applicable to me.  I stand corrected.

Offline

#4454 2024-03-04 15:31:05

ceeslans
Member
Registered: 2015-09-30
Posts: 195

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

marens wrote:

@asqwerth and @ceeslans
<snip>
Try updating the accuweather script with all my changes to the sun/moon part.
They directly affect the curr_cond file.

Look here:
https://forums.bunsenlabs.org/viewtopic … 71#p132471

That solved it for me (and I guess it will for @asqwerth too) ==> EDIT: as just confirmed by @asqwerth some minutes earlier smile

The curr_cond file now includes the needed value for line 22 --> which is correctly read for setting the conkyweather font icon

Thanks a lot for your help

Last edited by ceeslans (2024-03-04 15:33:33)

Offline

#4455 2024-03-09 13:33:53

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Moongiant conky script - Illumination Angle and Visibility in Real Time

I made a " fix " that determines the visibility of the moon a bit better (simpler).
Now it just checks if the " - " (minus sign) is at the beginning of the output (altitude1).
Find in my moongiant script plugin and set that part like this:

#Visibility
altitude1=$(cat $HOME/Moongiant_conky_script/illumination_angle | grep -oP '(?<=altitude = )[^ ]*' | sed 's/.//2g')
#if [[ $altitude -ge 0 ]]; then
if [[ "$altitude1" != "-" ]]; then
  echo 'Visible' > $HOME/Moongiant_conky_script/visibility
else
  echo 'Under Horizon' > $HOME/Moongiant_conky_script/visibility
fi

Done.

P.S.
I updated the moongiant script plugin today:
https://forums.bunsenlabs.org/viewtopic … 46#p128546


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4456 2024-03-11 13:42:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Gis Weather

Weather Description - Italic Font

gis-italic.png

If someone likes it, they can try it.

Find line:

                    text_now_attr['y']+y+106, font+text_now_attr['font_weight'], text_now_attr['font_size'], 140,

Replace with:

                    text_now_attr['y']+y+106, font+' Italic', text_now_attr['font_size'], 140,

If people would know how little brain is ruling the world, they would die of fear.

Offline

#4457 2024-03-11 14:21:14

shortarcflyer
Banned
Registered: 2022-04-27
Posts: 408

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


Nice!


I use Arch BTW!  If it is not rolling, it is stagnant!
RebornOS, EndeavourOS, Archbang, Artix,
Linuxhub Prime, Manjaro, Void, PCLinuxOS

Offline

#4458 2024-03-31 23:00:41

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Gis Weather / AccuWeather conky script

I finished testing a MoonDuration script that calculates the duration of the moon in the sky:
https://forums.bunsenlabs.org/viewtopic … 83#p132483

Two special cases are possible when the moon is not available.
The first when the moon does not rise and the second when the moon does not set that day.
In those cases the script must show the duration of moon N/A.
In all other cases, the duration of the moon in the sky is calculated.

Meanwhile (after more than a month) both cases happened and everything works as expected.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4459 2024-04-01 00:08:38

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

Gis Weather / AccuWeather conky script

If you use my latest changes to the accuweather script you will see that the curr_cond file in line 20 now shows the phase of the moon instead of the moon duration.
https://forums.bunsenlabs.org/viewtopic … 71#p132471

marens wrote:

Currently it shows Moon Phase instead of moonduration.

Now the curr_cond file looks something like this (lines 20-22):

Waning Gibbous
7900 m
D

I think it's good to have a moon phase and that's why I set it that way.
Maybe someone will use it in conky.

If you don't like it and want everything to look like before, you can easily do that.
Open the accuweather script and find the line:

#### END SM*Settings 28.02.2024 - MoonDuration Script

Add above (it should look like this):

# Moon Duration instead of Moon Phase in curr_cond file
replacement=$(sed -n 1p $HOME/Accuweather_conky_script/moon_duration)

sed -i '20d' $HOME/Accuweather_conky_script/curr_cond

sed -i "20s%^%$replacement\n%" $HOME/Accuweather_conky_script/curr_cond
 
#### END SM*Settings 28.02.2024 - MoonDuration Script

Just wait for the next conky update and you will get this:

7:50
7900 m
D

Line 20 again shows the duration of the moon in the sky.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#4460 2024-04-01 00:36:03

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

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

MoonGiant conky script

Most European countries (and some others) use DST again.
The hands of the clock have moved forward one hour.

It didn't affect my MoonGiant script plugin.
https://forums.bunsenlabs.org/viewtopic … 46#p128546

The latest plugin update (2024-03-09 13:15:45) is working properly.


If people would know how little brain is ruling the world, they would die of fear.

Offline

Board footer

Powered by FluxBB