From d7f787f40aa195104f9803992c9132f31b19d77a Mon Sep 17 00:00:00 2001 From: John Mertic Date: Wed, 29 Nov 2023 08:13:09 -0500 Subject: [PATCH] Saving progress Signed-off-by: John Mertic --- buildimages.sh | 26 +++++++++++++++++++++----- maketextimages.sh | 11 ++++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/buildimages.sh b/buildimages.sh index f7d88c7..e012351 100755 --- a/buildimages.sh +++ b/buildimages.sh @@ -1,22 +1,38 @@ #!/bin/bash # -while getopts c:l: flag +updateall="n" + +while getopts c:l:a flag do case "${flag}" in c) crunchbase=${OPTARG};; l) baselogo=${OPTARG};; + a) updateall="y" esac done IFS=$'\n' items=( $(yq '.landscape[] | select(.name != "LF Energy Member") | .subcategories[].items[] | select(.crunchbase == "*/'${crunchbase}'*") .name' landscape.yml) ) -#items=("makani" "transitfeed" "Carbon free energy for Google Cloud regions" "Analysis-Ready, Cloud Optimized ERA5" "weather-tools") -#baselogo="https://landscape.lfenergy.org/logos/google-llc.svg" for item in "${!items[@]}" do echo -n "Getting logo for ${items[$item]}..." - eval echo $(curl --no-progress-meter -X POST -H "Content-Type: application/json" -d "{\"url\": \"${baselogo}\", \"caption\": \"${items[$item]}\", \"title\": \"\", \"captionWidth\": \"80\"}" https://autocrop.cncf.io/autocrop | jq ".result") > "hosted_logos/${items[$item]}.svg" - echo "DONE" + if [ "$updateall" = "n" ] && [ -f "hosted_logos/${items[$item]}.svg" ] + then + echo "SKIP - FILE EXISTS - hosted_logos/${items[$item]}.svg" + elif ! [ -z "$baselogo" ] + then + eval echo $(curl --no-progress-meter -X POST -H "Content-Type: application/json" -d "{\"url\": \"${baselogo}\", \"caption\": \"${items[$item]}\", \"title\": \"\", \"captionWidth\": \"80\"}" https://autocrop.cncf.io/autocrop | jq ".result") > "hosted_logos/${items[$item]}.svg" + echo "DONE" + else + echo "${items[$item]}" > text.svg + if ! command -v inkscape &> /dev/null + then + echo "SKIP - INKSCAPE NOT FOUND" + else + inkscape text.svg --export-text-to-path --export-plain-svg --export-filename=${items[$item]} --export-area-drawing + echo "DONE - TEXT LOGO" + fi + fi done diff --git a/maketextimages.sh b/maketextimages.sh index 270c48f..b2ae3b9 100755 --- a/maketextimages.sh +++ b/maketextimages.sh @@ -1,16 +1,19 @@ #!/bin/bash # -while getopts c:l: flag +newonly="n" + +while getopts c:l:n flag do case "${flag}" in c) crunchbase=${OPTARG};; - l) baselogo=${OPTARG};; + n) newonly="y" esac done IFS=$'\n' -items=( $(ls -ag hosted_logos | grep "9406 Apr 11 16:48") ) +items=( $(yq '.landscape[] | select(.name != "LF Energy Member") | .subcategories[].items[] | select(.crunchbase == "*/'${crunchbase}'*") .name' landscape.yml) ) +IFS=$'\n' for item in "${!items[@]}" do @@ -23,5 +26,7 @@ do echo -n "Making logo for $logoname..." echo "$logoname" > text.svg inkscape text.svg --export-text-to-path --export-plain-svg --export-filename=$logofile --export-area-drawing + echo "$logoname" > text.svg + inkscape text.svg --export-text-to-path --export-plain-svg --export-filename=$logofile --export-area-drawing echo "DONE" done