Example #1
0
def artist_metadata_run(uri):
    _ = Fetch.artist_mb_metadata(uri)
    _ = Fetch.artist_wikipedia_uri(uri)
    _ = Fetch.artist_dbp_uri(uri, True)
    _ = Fetch.artist_hometown(uri)
    _ = Fetch.artist_birthplace(uri)
    return jsonify({"Message": "done"})
Example #2
0
def update_track(track_id: int):
    form = TrackForm(request.form)
    if form.validate_on_submit():
        _track = Track.query.filter_by(id=track_id).first()
        _track.name = form.name.data
        _track.lyrics = form.lyrics.data if form.lyrics.data and form.lyrics.data != "None" else None
        _track.lyrics_url = form.lyrics_url.data if form.lyrics_url.data and form.lyrics_url.data != "None" else None
        _track.lyrics_annotated = form.lyrics_annotated.data if form.lyrics_annotated.data and form.lyrics_annotated.data != "None" else None
        db.session.add(_track)
        db.session.commit()
        if not _track.lyrics_annotated:
            try:
                _ = Fetch.track_lyrics_annotate(_track.spot_uri)
            except Exception as e:
                print(f"Unable to annotate {_track.name}")
                traceback.print_tb(e.__traceback__)
    else:
        print(f"INVALID: {form.errors}")
    return redirect(url_for('ui.get_track', track_id=track_id))
Example #3
0
def track_lyrics_links(uri):
    return jsonify(Fetch.track_lyric_links(uri))
Example #4
0
def track_lyrics_annotations(uri):
    return Response(Fetch.track_lyrics_annotations(uri))
Example #5
0
def artist_birthplace(uri):
    return jsonify(Fetch.artist_birthplace(uri))
Example #6
0
def index():
    queries = ["wack", "dope"]
    counts = [build_lyric_query_stat(q) for q in queries]
    stats = Fetch.stats()
    return render_template('ui/index.html', stats=stats, counts=counts)
Example #7
0
def artists():
    name_filter = request.args.get('filter', default=None)
    fetched = Fetch.artists(name_filter)
    if len(fetched) == 1:
        return redirect(url_for("api.artist", uri=fetched[0]["spot_uri"]))
    return jsonify(fetched)
Example #8
0
def album_release_date(album_uri):
    force_update = request.args.get('update', default=False)
    return jsonify(Fetch.album_release_date(album_uri, force_update))
Example #9
0
def album_geni(artist_slug, album_slug):
    return jsonify(Fetch.geni_album_tracks(artist_slug, album_slug))
Example #10
0
def stats():
    return jsonify(Fetch.stats())
Example #11
0
def location(_id):
    return jsonify(Fetch.location(_id))
Example #12
0
def locations():
    name_filter = request.args.get('filter', default=None)
    fetched = Fetch.locations(name_filter)
    if len(fetched) == 1:
        return redirect(url_for("api.location", _id=fetched[0]["id"]))
    return jsonify(fetched)
Example #13
0
def genre(_id):
    return jsonify(Fetch.genre(_id))
Example #14
0
def album_metadata_run(uri):
    _ = Fetch.album_mb_metadata(uri)
    _ = Fetch.album_wikipedia_uri(uri)
    _ = Fetch.album_dbp_uri(uri)
    return jsonify({"Message": "done"})
Example #15
0
def artist_wikipedia_url(uri: str):
    return jsonify(Fetch.artist_wikipedia_uri(uri))
Example #16
0
def track_mb(uri):
    return jsonify(Fetch.track_mb_metadata(uri))
Example #17
0
def album(uri):
    return jsonify(Fetch.album(uri))
Example #18
0
def tracks_with_lyrics():
    return jsonify(Fetch.tracks_with_lyrics())
Example #19
0
def album_tracks_missing_lyrics(uri):
    return jsonify(Fetch.album_tracks_missing_lyrics(uri))
Example #20
0
def tracks_missing_lyrics():
    return jsonify(Fetch.tracks_missing_lyrics())
Example #21
0
def album_wikipedia_update(album_uri):
    updated = request.json
    if updated and "uri" in updated:
        _album = Fetch.album(album_uri)
        Persistence.persist_album_wikipedia_uri(_album["id"], updated["uri"])
    return redirect(url_for("api.album", uri=album_uri))
Example #22
0
def track(uri):
    return jsonify(Fetch.track(uri))
Example #23
0
def artist(uri):
    return jsonify(Fetch.artist(uri))
Example #24
0
def track_lyrics(track_uri):
    force_update = request.args.get('update', default=False)
    return jsonify(Fetch.track_lyrics(track_uri, force_update))
Example #25
0
def albums_debug():
    name_filter = request.args.get('filter', default=None)
    fetched = Fetch.albums_debug(name_filter)
    return jsonify(fetched)
Example #26
0
def artist_hometown(uri):
    return jsonify(Fetch.artist_hometown(uri))