Esempio n. 1
0
func (r *RecipeBook) GetByIngredient(ingredient string) []Recipe {
	desired_recipes := make([]Recipe, 0)
	for _, j := range r.recipes {
		sortutil.Asc(j.ingredients)
		if filterutils.StringInSortedSlice(j.ingredients, ingredient) {
			desired_recipes = append(desired_recipes, j)
		}
	}
	return desired_recipes
}
Esempio n. 2
0
// NextAirDate returns the next air date for the given `Show`
func (c Client) NextAirDate(show Show) (time.Time, error) {
	var ret time.Time
	episodes, err := c.Episodes(show)
	if err != nil {
		return ret, err
	}
	var times []time.Time
	for _, episode := range episodes {
		times = append(times, episode.AirDate)
	}
	sortutil.Asc(times)

	for _, airDate := range times {
		if airDate.After(time.Now()) {
			return airDate, nil
		}
	}

	return ret, nil
}