mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
fix incorrect album fetching
This commit is contained in:
+8
-4
@@ -351,12 +351,16 @@ def getAlbums():
|
||||
|
||||
return {'albums': albums}
|
||||
|
||||
@bp.route('/albums/<album>')
|
||||
def getAlbumSongs(album: str):
|
||||
album = urllib.parse.unquote(album)
|
||||
songs = all_songs_instance.find_songs_by_album(album)
|
||||
@bp.route('/albums/<query>')
|
||||
def getAlbumSongs(query: str):
|
||||
album = query.split('::')[0]
|
||||
artist = query.split('::')[1]
|
||||
|
||||
songs = all_songs_instance.find_songs_by_album(album, artist)
|
||||
songs_array = convert_to_json(songs)
|
||||
|
||||
print(artist)
|
||||
|
||||
for song in songs_array:
|
||||
song['artists'] = song['artists'].split(', ')
|
||||
song['filepath'] = song['filepath'].replace(home_dir, '')
|
||||
|
||||
@@ -46,8 +46,8 @@ class AllSongs(Mongo):
|
||||
self.collection.create_index([('title', pymongo.TEXT)])
|
||||
return self.collection.find({'title': {'$regex': query, '$options': 'i'}})
|
||||
|
||||
def find_songs_by_album(self, query):
|
||||
return self.collection.find({'album': query})
|
||||
def find_songs_by_album(self, name, artist):
|
||||
return self.collection.find({'album': name, 'album_artist': artist})
|
||||
|
||||
def get_all_songs(self):
|
||||
return self.collection.find().limit(25)
|
||||
|
||||
Reference in New Issue
Block a user