Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1aab0d7a4f | |||
| ff80a109e8 | |||
| 09ed5c108e | |||
| a37ef637ce | |||
| a270bf12ff |
@@ -54,7 +54,7 @@ func refresh(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
restaurants = append(restaurants, r.NewFreshRestaurant("http://www.fresh-menu.cz/", "Fresh", 1))
|
//restaurants = append(restaurants, r.NewFreshRestaurant("http://www.fresh-menu.cz/", "Fresh", 1))
|
||||||
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/2752-u-drevaka-beergrill.html", "U Dřeváka", 2))
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/2752-u-drevaka-beergrill.html", "U Dřeváka", 2))
|
||||||
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/4116-padagali.html", "Padagali", 3))
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/4116-padagali.html", "Padagali", 3))
|
||||||
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/5448-light-of-india.html", "Light of India", 4))
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/5448-light-of-india.html", "Light of India", 4))
|
||||||
@@ -65,6 +65,7 @@ func main() {
|
|||||||
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/7470-the-immigrant-.html", "The Immigrant", 9))
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/7470-the-immigrant-.html", "The Immigrant", 9))
|
||||||
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/2721-selepka.html", "Šelepka", 10))
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/2721-selepka.html", "Šelepka", 10))
|
||||||
restaurants = append(restaurants, r.NewTaoRestaurant("https://www.taorestaurant.cz/tydenni_menu/nabidka/", "Tao", 11))
|
restaurants = append(restaurants, r.NewTaoRestaurant("https://www.taorestaurant.cz/tydenni_menu/nabidka/", "Tao", 11))
|
||||||
|
restaurants = append(restaurants, r.NewMenickaRestaurant("https://www.menicka.cz/3854-na-ruzku.html", "Na Růžku", 12))
|
||||||
|
|
||||||
refreshInternal()
|
refreshInternal()
|
||||||
fmt.Println("Initial parsing finished")
|
fmt.Println("Initial parsing finished")
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ func (restaurant *FreshRestaurant) Parse() {
|
|||||||
meals[curIndex] = append(meals[curIndex], line[10:])
|
meals[curIndex] = append(meals[curIndex], line[10:])
|
||||||
prices[curIndex] = append(prices[curIndex], -1)
|
prices[curIndex] = append(prices[curIndex], -1)
|
||||||
}
|
}
|
||||||
|
if curIndex < 0 {
|
||||||
|
curIndex++
|
||||||
|
}
|
||||||
if !pricesSection && line[1] == '.' && len(line) > 2 {
|
if !pricesSection && line[1] == '.' && len(line) > 2 {
|
||||||
meals[curIndex] = append(meals[curIndex], line[3:])
|
meals[curIndex] = append(meals[curIndex], line[3:])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ func (restaurant *Restaurant) clearMenus() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (restaurant *Restaurant) clearPermanentMenus() {
|
||||||
|
restaurant.permanent = []Meal{}
|
||||||
|
}
|
||||||
|
|
||||||
func (restaurant *Restaurant) MarshalJSON() ([]byte, error) {
|
func (restaurant *Restaurant) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(&RestaurantJSON{
|
return json.Marshal(&RestaurantJSON{
|
||||||
Id: restaurant.id,
|
Id: restaurant.id,
|
||||||
@@ -66,6 +70,7 @@ func (restaurant *Restaurant) MarshalJSON() ([]byte, error) {
|
|||||||
|
|
||||||
func (restaurant *Restaurant) GetSpecificDayObject(days []int) RestaurantJSON {
|
func (restaurant *Restaurant) GetSpecificDayObject(days []int) RestaurantJSON {
|
||||||
obj := RestaurantJSON{
|
obj := RestaurantJSON{
|
||||||
|
Id: restaurant.id,
|
||||||
Restaurant: restaurant.name,
|
Restaurant: restaurant.name,
|
||||||
PermanentMeals: restaurant.permanent,
|
PermanentMeals: restaurant.permanent,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ func NewTaoRestaurant(url string, name string, id int) *TaoRestaurant {
|
|||||||
|
|
||||||
func (restaurant *TaoRestaurant) Parse() {
|
func (restaurant *TaoRestaurant) Parse() {
|
||||||
restaurant.clearMenus()
|
restaurant.clearMenus()
|
||||||
|
restaurant.clearPermanentMenus()
|
||||||
resp, err := http.Get(restaurant.url)
|
resp, err := http.Get(restaurant.url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user