remove telemetry

+ add docstrings to lyrics functions
This commit is contained in:
mungai-njoroge
2023-11-10 16:18:52 +03:00
parent 89b05ff80c
commit 8b6d10c832
9 changed files with 38 additions and 170 deletions
+1 -16
View File
@@ -1,8 +1,8 @@
"""
Contains all the artist(s) routes.
"""
import random
import math
import random
from datetime import datetime
from flask import Blueprint, request
@@ -15,29 +15,15 @@ from app.serializers.track import serialize_tracks
from app.store.albums import AlbumStore
from app.store.artists import ArtistStore
from app.store.tracks import TrackStore
from app.telemetry import Telemetry
from app.utils.threading import background
api = Blueprint("artist", __name__, url_prefix="/")
ARTIST_VISIT_COUNT = 0
@background
def send_event():
global ARTIST_VISIT_COUNT
ARTIST_VISIT_COUNT += 1
if ARTIST_VISIT_COUNT % 5 == 0:
Telemetry.send_artist_visited()
@api.route("/artist/<artisthash>", methods=["GET"])
def get_artist(artisthash: str):
"""
Get artist data.
"""
send_event()
limit = request.args.get("limit")
if limit is None:
@@ -211,7 +197,6 @@ def get_similar_artists(artisthash: str):
if artist is None:
return {"error": "Artist not found"}, 404
# result = LastFMStore.get_similar_artists_for(artist.artisthash)
result = fmdb.get_similar_artists_for(artist.artisthash)
if result is None: