-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: John Mertic <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "<svg><text>${items[$item]}</text></svg>" > 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters