diff --git a/README.md b/README.md
index 284c147..73671b3 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,4 @@
-# obedy
-
-Óda na pracovní oběd
+#Óda na pracovní oběd
V pracovním dni, kdy slunce vysoko stoupá, Když hlad nás k sobě volá, ať jsme kdekoli, Na stole se objeví ten sladký okamžik, Kdy se setkáme s obědem, co nám sílu dodá.
diff --git a/osteria.sh b/osteria.sh
deleted file mode 100755
index 3807d71..0000000
--- a/osteria.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-url="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/"
-html_snippet=$(curl -s "$url")
-
-day_of_week=$(date '+%u')
-
-case "$day_of_week" in
- 1)
- soup=$(echo "$html_snippet" | grep -oP '(?<=
Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
- ;;
- 2)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
- ;;
- 3)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
- ;;
- 4)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
- ;;
- 4)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
- ;;
- *)
- echo "Spatnej den v tydnu brasko"
- exit 1
- ;;
-esac
-
-echo "Polévka:"
-echo "$soup"
-echo
-echo "Hlavní chod:"
-echo "$main_course"
\ No newline at end of file
diff --git a/sladovnicka.sh b/sladovnicka.sh
deleted file mode 100755
index 118636f..0000000
--- a/sladovnicka.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-url="https://sladovnicka.unasplzenchutna.cz/cz/denni-nabidka/"
-html_snippet=$(curl -s "$url")
-
-day_of_week=$(date '+%u')
-
-case "$day_of_week" in
- 1)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
- ;;
- 2)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
- ;;
- 3)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
- ;;
- 4)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
- ;;
- 4)
- soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
- main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
- ;;
- *)
- echo "Spatnej den v tydnu brasko"
- exit 1
- ;;
-esac
-
-echo "Polévka:"
-echo "$soup"
-echo
-echo "Hlavní chod:"
-echo "$main_course"
\ No newline at end of file
diff --git a/zradylko.sh b/zradylko.sh
index 5be49a8..fa9b80b 100755
--- a/zradylko.sh
+++ b/zradylko.sh
@@ -1,30 +1,39 @@
#!/bin/bash
+output=""
+
get_zradylko() {
local url="$1"
local html_snippet=$(curl -s "$url")
local day_of_week=$(date '+%u')
+ restaurant_name=$(echo "$html_snippet" | grep -oP '(?<=).*?(?=)')
+
case "$day_of_week" in
1)
soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==1')
+ weekly_course=$(echo "$html_snippet" | grep -oP '(?<=Celý týden nabízíme
).*?(?=<\/table>)' | sed 's/<[^>]*>//g')
;;
2)
soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==2')
+ weekly_course=$(echo "$html_snippet" | grep -oP '(?<=Celý týden nabízíme
).*?(?=<\/table>)' | sed 's/<[^>]*>//g')
;;
3)
soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==3')
+ weekly_course=$(echo "$html_snippet" | grep -oP '(?<=Celý týden nabízíme
).*?(?=<\/table>)' | sed 's/<[^>]*>//g')
;;
4)
soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==4')
+ weekly_course=$(echo "$html_snippet" | grep -oP '(?<=Celý týden nabízíme
).*?(?=<\/table>)' | sed 's/<[^>]*>//g')
;;
5)
soup=$(echo "$html_snippet" | grep -oP '(?<=Polévka<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
main_course=$(echo "$html_snippet" | grep -oP '(?<=Hlavní jídlo<\/h2>).*?(?=<\/table>)' | sed 's/<[^>]*>//g' | awk 'NR==5')
+ weekly_course=$(echo "$html_snippet" | grep -oP '(?<=Celý týden nabízíme
).*?(?=<\/table>)' | sed 's/<[^>]*>//g')
;;
*)
echo "Spatnej den v tydnu brasko"
@@ -32,29 +41,35 @@ get_zradylko() {
;;
esac
- echo "Polévka:"
- echo "$soup"
- echo
- echo "Hlavní chod:"
- echo "$main_course"
+ # Create a JSON object with the desired fields
+ output+="{
+ \"title\": \"**$restaurant_name**\",
+ \"fields\": [
+ {
+ \"name\": \"Polevka\",
+ \"value\": \"$soup\"
+ },
+ {
+ \"name\": \"Hlavni chod\",
+ \"value\": \"$main_course\"
+ },
+ {
+ \"name\": \"Tydenni nabidka\",
+ \"value\": \"$weekly_course\"
+ }
+ ]
+ },"
}
-get_restaurant_name() {
- local url="$1"
- local html_snippet=$(curl -s "$url")
-
- restaurant_name=$(echo "$html_snippet" | grep -oP '(?<=).*?(?=)')
-
- echo "$restaurant_name"
-}
-
-
-urlOsteria="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/"
-get_restaurant_name "$urlOsteria"
-get_zradylko "$urlOsteria"
-
-echo ""
+# Example usage:
+urlGarage="https://www.unasplzenchutna.cz/garage/cz/denni-nabidka/"
+get_zradylko "$urlGarage"
urlSladovnicka="https://sladovnicka.unasplzenchutna.cz/cz/denni-nabidka/"
-get_restaurant_name "$urlSladovnicka"
-get_zradylko "$urlSladovnicka"
\ No newline at end of file
+get_zradylko "$urlSladovnicka"
+
+# Remove the trailing comma from the menu_data
+output="${output%,}"
+
+# Print the complete menu data
+echo "[$output]" | jq .
\ No newline at end of file