mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
try adding playlists list to context menu - unsuccsessfully
This commit is contained in:
@@ -10,6 +10,7 @@ from app import models, instances
|
||||
from app import functions, helpers, prep
|
||||
from app.lib import albumslib
|
||||
from app.lib import folderslib
|
||||
from app.lib import playlistlib
|
||||
|
||||
|
||||
DB_TRACKS = instances.songs_instance.get_all_songs()
|
||||
@@ -20,6 +21,7 @@ TRACKS: List[models.Track] = []
|
||||
PLAYLISTS: List[models.Playlist] = []
|
||||
FOLDERS: List[models.Folder] = []
|
||||
|
||||
|
||||
@helpers.background
|
||||
def initialize() -> None:
|
||||
"""
|
||||
@@ -29,8 +31,8 @@ def initialize() -> None:
|
||||
prep.create_config_dir()
|
||||
albumslib.create_everything()
|
||||
folderslib.run_scandir()
|
||||
playlistlib.create_all_playlists()
|
||||
functions.reindex_tracks()
|
||||
|
||||
|
||||
initialize()
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ def get_folder_tree():
|
||||
songs = []
|
||||
|
||||
for track in api.TRACKS:
|
||||
if track.folder + "/" == req_dir:
|
||||
if track.folder == req_dir:
|
||||
songs.append(track)
|
||||
|
||||
final_tracks = helpers.remove_duplicates(songs)
|
||||
|
||||
@@ -11,22 +11,24 @@ playlist_bp = Blueprint("playlist", __name__, url_prefix="/")
|
||||
|
||||
@playlist_bp.route("/playlists", methods=["GET"])
|
||||
def get_all_playlists():
|
||||
print(api.PLAYLISTS)
|
||||
playlists = []
|
||||
|
||||
for playlist in api.PLAYLISTS:
|
||||
del playlist.tracks
|
||||
playlist.tracks = []
|
||||
playlists.append(playlist)
|
||||
|
||||
return playlists
|
||||
return {"data": playlists}
|
||||
|
||||
|
||||
@playlist_bp.route("/playlist/new")
|
||||
@playlist_bp.route("/playlist/new", methods=["POST"])
|
||||
def create_playlist():
|
||||
data = request.get_json()
|
||||
|
||||
playlist = {"name": data["name"], "description": data["description"], "tracks": []}
|
||||
playlist = {"name": data["name"], "description": [], "tracks": []}
|
||||
|
||||
instances.playlist_instance.insert_playlist(playlist)
|
||||
return 200
|
||||
return {"msg": "success"}
|
||||
|
||||
|
||||
@playlist_bp.route("/playlist/<playlist_id>/add", methods=["POST"])
|
||||
|
||||
Reference in New Issue
Block a user