예제 #1
0
def _load_yesterday_episodes(data):
    shows = []
    yesterday = datetime.date.today() - datetime.timedelta(days=1)
    episodes = db.get_user_shows_by_date(data['user'], yesterday)
    for episode in episodes:
        display = DisplayShow(episode.season.serie, episode)
        shows.append(display)
    return shows
예제 #2
0
def _load_day_episode(data):
    date = datetime.date.today()
    day = DAYS.index(date.strftime("%A").lower()) + 1
    offset = DAYS.index(data['filter']) + 1
    difference = day - offset
    shows = []
    weekday = datetime.date.today() - datetime.timedelta(days=difference)
    episodes = db.get_user_shows_by_date(data['user'], weekday)
    for episode in episodes:
        display = DisplayShow(episode.season.serie, episode)
        shows.append(display)
    return shows