Esempio n. 1
0
def listener_album_specific(page, key):
    if page == "artist":
        artist = ArtistService().get_by_id(key)
        title = f"Albums of {artist['name']} {artist['surname']}"
        albums = AlbumService().list_by_artist_id(key)
    else:
        return

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "albums": albums}
    return render_template('listener_album.html', context=context)
Esempio n. 2
0
def artist_album_song(album_id):
    context = {
        "album": AlbumService().get_by_id(album_id),
        "songs": SongService().list_by_album_id(album_id),
        "artists": ArtistService().list()
    }
    return render_template('artist_album_song.html', context=context)
Esempio n. 3
0
def listener_coartist(name, surname):
    artists = ArtistService().list_coartist(name, surname)
    title = "Artists worked with " + str(name) + " " + str(surname)
    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "artists": artists}
    return render_template('listener_artist.html', context=context)
Esempio n. 4
0
def listener_album(page):
    if page == "all":
        title = "All Albums"
        albums = AlbumService().list()
    elif page == "popular":
        title = "Popular Albums"
        albums = AlbumService().list_by_popularity()
    elif page == "liked":
        title = "Liked Albums"
        albums = AlbumService().list_liked()
    else:
        return

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "albums": albums}
    return render_template('listener_album.html', context=context)
Esempio n. 5
0
def listener_song_artist_popular(_id):
    artist = ArtistService().get_by_id(_id)
    title = f"Popular Songs of {artist['name']} {artist['surname']}"
    songs = SongService().list_by_artist_id_and_popularity(_id)

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "songs": songs}
    return render_template('listener_song.html', context=context)
Esempio n. 6
0
def listener_listener():
    title = "Listeners"
    genres = AlbumService().list_genre()

    context = {
        "title": title,
        "genres": genres,
        "listeners": ListenerService().list()
    }
    return render_template('listener_listener.html', context=context)
Esempio n. 7
0
def listener_song_specific(page, key):
    if page == "artist":
        artist = ArtistService().get_by_id(key)
        title = f"Songs of {artist['name']} {artist['surname']}"
        songs = SongService().list_by_artist_id(key)
    elif page == "album":
        album = AlbumService().get_by_id(key)
        title = f"Songs in the {album['album_title']} album"
        songs = SongService().list_by_album_id(key)
    elif page == "listener":
        listener = ListenerService().get_by_id(key)
        title = f"Songs that are Liked by {listener['username']}"
        songs = SongService().list_by_listener_id(key)
    elif page == "genre":
        title = str(key) + " Songs"
        songs = SongService().list_by_genre(key)
    else:
        return

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "songs": songs}
    return render_template('listener_song.html', context=context)
Esempio n. 8
0
def listener_artist(page):
    if page == "all":
        title = "All Artists"
        artists = ArtistService().list()
    elif page == "popular":
        title = "Popular Artists"
        artists = ArtistService().list_by_popularity()
    else:
        return

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "artists": artists}
    return render_template('listener_artist.html', context=context)
Esempio n. 9
0
def listener_song(page):
    if page == "all":
        title = "All Songs"
        songs = SongService().list()
    elif page == "popular":
        title = "Popular Songs"
        songs = SongService().list_by_popularity()
    elif page == "liked":
        title = "Liked Songs"
        songs = SongService().list_liked()
    elif page == "search":
        title = "Searched Songs"
        form = request.form
        songs = SongService().search(form)
    else:
        return

    genres = AlbumService().list_genre()

    context = {"title": title, "genres": genres, "songs": songs}
    return render_template('listener_song.html', context=context)
Esempio n. 10
0
def index():
    context = {"genres": AlbumService().list_genre()}
    return render_template('index.html', context=context)
Esempio n. 11
0
def artist_album():
    context = {
        "albums": AlbumService().list_by_artist_id(session["id"]),
        "artists": ArtistService().list()
    }
    return render_template('artist_album.html', context=context)
def list():
    return jsonify(AlbumService().list())
def unlike(album_id):
    form = request.form.to_dict()
    form["album_id"] = album_id
    form["listener_id"] = session["id"]
    AlbumService().unlike(form)
    return redirect(request.referrer)
def delete(_id):
    AlbumService().delete(_id)
    return redirect(request.referrer)
def update():
    context = request.form.to_dict()
    print(context)
    AlbumService().update(context)
    return redirect(request.referrer)
def create():
    context = request.form.to_dict()
    context["other_artists"] = request.form.getlist("other_artists")
    context["album_id"] = AlbumService().create(context)
    context["song_id"] = SongService().create(context)
    return redirect(request.referrer)