mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
extract original thumbnail image
This commit is contained in:
+7
-7
@@ -2,21 +2,21 @@
|
||||
Contains all the album routes.
|
||||
"""
|
||||
|
||||
from dataclasses import asdict
|
||||
import random
|
||||
from dataclasses import asdict
|
||||
|
||||
from flask import Blueprint, request
|
||||
|
||||
from app.db.sqlite.albums import SQLiteAlbumMethods as adb
|
||||
from app.db.sqlite.favorite import SQLiteFavoriteMethods as favdb
|
||||
from app.db.sqlite.lastfm.similar_artists import \
|
||||
SQLiteLastFMSimilarArtists as lastfmdb
|
||||
from app.models import FavType, Track
|
||||
from app.serializers.album import serialize_for_card
|
||||
from app.serializers.track import track_serializer
|
||||
from app.store.albums import AlbumStore
|
||||
from app.store.tracks import TrackStore
|
||||
from app.db.sqlite.albums import SQLiteAlbumMethods as adb
|
||||
from app.db.sqlite.favorite import SQLiteFavoriteMethods as favdb
|
||||
from app.db.sqlite.lastfm.similar_artists import SQLiteLastFMSimilarArtists as lastfmdb
|
||||
|
||||
from app.utils.hashing import create_hash
|
||||
from app.serializers.album import serialize_for_card
|
||||
from app.utils.remove_duplicates import remove_duplicates
|
||||
|
||||
get_albums_by_albumartist = adb.get_albums_by_albumartist
|
||||
@@ -210,4 +210,4 @@ def get_similar_albums():
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return {"albums": [serialize_for_card(a) for a in albums]}
|
||||
return {"albums": [serialize_for_card(a) for a in albums[:limit]]}
|
||||
|
||||
@@ -321,7 +321,6 @@ def get_similar_artists(artisthash: str):
|
||||
|
||||
similar = ArtistStore.get_artists_by_hashes(result.get_artist_hash_set())
|
||||
|
||||
# print(similar)
|
||||
if len(similar) > limit:
|
||||
similar = random.sample(similar, limit)
|
||||
|
||||
|
||||
@@ -22,6 +22,17 @@ def send_fallback_img(filename: str = "default.webp"):
|
||||
return send_from_directory(path, filename)
|
||||
|
||||
|
||||
@api.route("/t/o/<imgpath>")
|
||||
def send_original_thumbnail(imgpath: str):
|
||||
path = Paths.get_original_thumb_path()
|
||||
fpath = Path(path) / imgpath
|
||||
|
||||
if fpath.exists():
|
||||
return send_from_directory(path, imgpath)
|
||||
|
||||
return send_fallback_img()
|
||||
|
||||
|
||||
@api.route("/t/<imgpath>")
|
||||
def send_lg_thumbnail(imgpath: str):
|
||||
path = Paths.get_lg_thumb_path()
|
||||
|
||||
Reference in New Issue
Block a user