mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
separate playFolder and playAlbum
This commit is contained in:
+4
-7
@@ -13,7 +13,7 @@ all_the_f_music = helpers.getAllSongs()
|
||||
|
||||
def initialize() -> None:
|
||||
helpers.create_config_dir()
|
||||
helpers.check_for_new_songs()
|
||||
# helpers.check_for_new_songs()
|
||||
|
||||
initialize()
|
||||
|
||||
@@ -208,7 +208,6 @@ def getFolderTree(folder: str = None):
|
||||
|
||||
return {"files": helpers.remove_duplicates(songs), "folders": sorted(folders, key=lambda i: i['name'])}
|
||||
|
||||
|
||||
@bp.route('/qwerty')
|
||||
def populateArtists():
|
||||
all_songs = instances.songs_instance.get_all_songs()
|
||||
@@ -230,7 +229,6 @@ def populateArtists():
|
||||
|
||||
return {'songs': artists}
|
||||
|
||||
|
||||
@bp.route('/albums')
|
||||
def getAlbums():
|
||||
s = instances.songs_instance.get_all_songs()
|
||||
@@ -248,16 +246,14 @@ def getAlbums():
|
||||
|
||||
return {'albums': albums}
|
||||
|
||||
|
||||
@bp.route('/albums/<query>')
|
||||
@cache.cached()
|
||||
def getAlbumSongs(query: str):
|
||||
album = query.split('::')[0].replace('|', '/')
|
||||
artist = query.split('::')[1].replace('|', '/')
|
||||
|
||||
songs = instances.songs_instance.find_songs_by_album(album, artist)
|
||||
|
||||
print(artist)
|
||||
|
||||
for song in songs:
|
||||
song['artists'] = song['artists'].split(', ')
|
||||
song['image'] = "http://127.0.0.1:8900/images/thumbnails/" + song['image']
|
||||
@@ -269,4 +265,5 @@ def getAlbumSongs(query: str):
|
||||
"image": songs[0]['image'],
|
||||
"artist": songs[0]['album_artist']
|
||||
}
|
||||
return {'songs': songs, 'info': album_obj}
|
||||
|
||||
return {'songs': helpers.remove_duplicates(songs), 'info': album_obj}
|
||||
|
||||
@@ -20,8 +20,6 @@ def populate():
|
||||
'''
|
||||
files = helpers.run_fast_scandir(helpers.home_dir, [".flac", ".mp3"])[1]
|
||||
|
||||
bar = Bar('Indexing files', max=len(files))
|
||||
|
||||
for file in files:
|
||||
file_in_db_obj = instances.songs_instance.find_song_by_path(file)
|
||||
|
||||
@@ -39,10 +37,6 @@ def populate():
|
||||
except MutagenError:
|
||||
pass
|
||||
|
||||
bar.next()
|
||||
|
||||
bar.finish()
|
||||
|
||||
return {'msg': 'updated everything'}
|
||||
|
||||
|
||||
|
||||
@@ -3,5 +3,3 @@ from app.models import Artists
|
||||
|
||||
songs_instance = AllSongs()
|
||||
artist_instance = Artists()
|
||||
|
||||
""
|
||||
Reference in New Issue
Block a user