edited zradylko.sh
This commit is contained in:
parent
604b682f17
commit
eb0d67e118
36
zradylko.sh
36
zradylko.sh
|
@ -4,6 +4,8 @@ output=""
|
||||||
|
|
||||||
get_zradylko() {
|
get_zradylko() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
|
local commonName="$2"
|
||||||
|
local icon="$3"
|
||||||
local html_snippet=$(curl -s "$url")
|
local html_snippet=$(curl -s "$url")
|
||||||
local day_of_week=$(date '+%u')
|
local day_of_week=$(date '+%u')
|
||||||
|
|
||||||
|
@ -42,34 +44,40 @@ get_zradylko() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Create a JSON object with the desired fields
|
# Create a JSON object with the desired fields
|
||||||
output+="{
|
# shellcheck disable=SC2016
|
||||||
\"title\": \"**$restaurant_name**\",
|
output=''${output}'
|
||||||
\"fields\": [
|
{
|
||||||
|
"title": "**'"$commonName"'**",
|
||||||
|
"author": {
|
||||||
|
"name": "'"$restaurant_name"'",
|
||||||
|
"icon_url": "'"${icon}"'"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
{
|
{
|
||||||
\"name\": \"Polevka\",
|
"name": "Polevka",
|
||||||
\"value\": \"$soup\"
|
"value": "'"$soup"'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\"name\": \"Hlavni chod\",
|
"name": "Hlavni chod",
|
||||||
\"value\": \"$main_course\"
|
"value": "'"$main_course"'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\"name\": \"Tydenni nabidka\",
|
"name": "Tydenni nabidka",
|
||||||
\"value\": \"$weekly_course\"
|
"value": "'"$weekly_course"'"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},"
|
},'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example usage:
|
# Example usage:
|
||||||
urlGarage="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/"
|
urlGarage="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/"
|
||||||
get_zradylko "$urlGarage"
|
get_zradylko "$urlGarage" "Salieriho bar" "https://png.pngtree.com/png-vector/20240211/ourlarge/pngtree-italy-round-flag-peeling-sticker-transparent-background-vector-png-image_11738118.png"
|
||||||
|
|
||||||
urlSladovnicka="https://sladovnicka.unasplzenchutna.cz/cz/denni-nabidka/"
|
urlSladovnicka="https://sladovnicka.unasplzenchutna.cz/cz/denni-nabidka/"
|
||||||
get_zradylko "$urlSladovnicka"
|
get_zradylko "$urlSladovnicka" "V. pavilón" "https://i0.wp.com/life4you.cz/wp-content/uploads/2022/09/Pilsner-Urquell.png?fit=480%2C480&ssl=1"
|
||||||
|
|
||||||
# Remove the trailing comma from the menu_data
|
# Remove the trailing comma from the menu_data
|
||||||
output="${output%,}"
|
#output="${output%,}"
|
||||||
|
|
||||||
# Print the complete menu data
|
# Print the complete menu data
|
||||||
echo "[$output]" | jq .
|
echo "$output" #| jq .
|
Loading…
Reference in New Issue