server: move all stores to api.py

This commit is contained in:
geoffrey45
2022-03-18 19:57:31 +03:00
parent 29124ce717
commit f8710a1596
7 changed files with 37 additions and 53 deletions
+3 -5
View File
@@ -1,14 +1,12 @@
from typing import List
from app import models, trackslib, albumslib, helpers
TRACKS = trackslib.TRACKS
from app import models, api, albumslib, helpers
def get_tracks(query: str) -> List[models.Track]:
"""
Gets all songs with a given title.
"""
tracks = [track for track in TRACKS if query.lower() in track.title.lower()]
tracks = [track for track in api.TRACKS if query.lower() in track.title.lower()]
return helpers.remove_duplicates(tracks)
@@ -23,4 +21,4 @@ def get_artists(artist: str) -> List[models.Track]:
"""
Gets all songs with a given artist.
"""
return [track for track in TRACKS if artist.lower() in str(track.artists).lower()]
return [track for track in api.TRACKS if artist.lower() in str(track.artists).lower()]