This commit is contained in:
mungai-njoroge 2023-08-02 14:26:19 +03:00
parent 9c9a187083
commit efb6aae927
4 changed files with 443 additions and 438 deletions

View File

@ -58,7 +58,7 @@ class ArtistsCache:
""" """
Returns the cached albums for the given artisthash. Returns the cached albums for the given artisthash.
""" """
for (index, albums) in enumerate(cls.artists): for index, albums in enumerate(cls.artists):
if albums.artisthash == artisthash: if albums.artisthash == artisthash:
return albums.albums, index return albums.albums, index
@ -325,3 +325,5 @@ def get_similar_artists(artisthash: str):
similar = random.sample(similar, limit) similar = random.sample(similar, limit)
return {"artists": similar[:limit]} return {"artists": similar[:limit]}
# TODO: Rewrite this file using generators where possible

View File

@ -79,12 +79,6 @@ class Search:
finder = searchlib.SearchAll() finder = searchlib.SearchAll()
return finder.search(self.query) return finder.search(self.query)
def search_all(self):
"""Calls all the search methods."""
self.search_tracks()
self.search_albums()
self.search_artists()
# self.search_playlists()
@api.route("/search/tracks", methods=["GET"]) @api.route("/search/tracks", methods=["GET"])
@ -211,3 +205,5 @@ def search_load_more():
"artists": a[index: index + SEARCH_COUNT], "artists": a[index: index + SEARCH_COUNT],
"more": len(a) > index + SEARCH_COUNT, "more": len(a) > index + SEARCH_COUNT,
} }
# TODO: Rewrite this file using generators where possible

View File

@ -1,16 +1,18 @@
import os import os
from io import BytesIO from io import BytesIO
import pendulum
import pendulum
from PIL import Image, UnidentifiedImageError from PIL import Image, UnidentifiedImageError
from tinytag import TinyTag from tinytag import TinyTag
from app.settings import Defaults, Paths from app.settings import Defaults, Paths
from app.utils.hashing import create_hash from app.utils.hashing import create_hash
from app.utils.parsers import parse_title_from_filename, parse_artist_from_filename from app.utils.parsers import (parse_artist_from_filename,
parse_title_from_filename)
from app.utils.wintools import win_replace_slash from app.utils.wintools import win_replace_slash
def parse_album_art(filepath: str): def parse_album_art(filepath: str):
""" """
Returns the album art for a given audio file. Returns the album art for a given audio file.
@ -179,6 +181,7 @@ def get_tags(filepath: str):
"samplerate", "samplerate",
"track_total", "track_total",
"year", "year",
"bitdepth",
] ]
for tag in to_delete: for tag in to_delete:

862
poetry.lock generated

File diff suppressed because it is too large Load Diff