def browse_artist(artist): albums = set() data = Database().select_category("music") for key, value in data.items(): if value["name_one"] == artist: albums.add(value["name_two"]) albums = sorted(albums) return flask.render_template("browse.html", page="browse", artist=artist, albums=albums)
def browse_television(): items = OrderedDict() shows = [] data = Database().select_category("television") for key, value in data.items(): show = value["name_one"] if show not in shows: shows.append(show) items[key] = value return flask.render_template("browse.html", page="browse", category="television", items=items)
def browse_season(show, season): episodes = [] data = Database().select_category("television") for key, value in data.items(): if value["name_one"] == show and value["name_two"] == season: info = value info["id"] = key episodes.append(info) episodes = sorted(episodes, key=lambda k: int(k["name_three"])) return flask.render_template("browse.html", page="browse", show=show, season=season, episodes=episodes)
def browse_show(show): seasons = set() data = Database().select_category("television") for key, value in data.items(): if value["name_one"] == show: seasons.add(value["name_two"]) seasons = sorted(seasons) continue_ = retrieve.get_continue_media_by_show(show) return flask.render_template("browse.html", page="browse", show=show, seasons=seasons, continue_=continue_)
def browse_album(artist, album): tracks = [] data = Database().select_category("music") for key, value in data.items(): if value["name_one"] == artist and value["name_two"] == album: info = value info["id"] = key tracks.append(info) tracks = sorted(tracks, key=lambda k: k["name_three"]) return flask.render_template("browse.html", page="browse", artist=artist, album=album, tracks=tracks)