mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
fix duplicate artist and album color entry in db
+ Remove folder store + Reduce fuzzy search score cutoff from 90% to 75% + use inheritance to init Artist class + misc
This commit is contained in:
+6
-1
@@ -8,6 +8,11 @@ api = Blueprint("colors", __name__, url_prefix="/colors")
|
||||
def get_album_color(albumhash: str):
|
||||
album = Store.get_album_by_hash(albumhash)
|
||||
|
||||
if len(album.colors) > 0:
|
||||
return {
|
||||
"color": album.colors[0]
|
||||
}
|
||||
|
||||
return {
|
||||
"color": album.colors[0]
|
||||
"color": ""
|
||||
}
|
||||
|
||||
+7
-8
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
from flask import Blueprint, request
|
||||
|
||||
from app import settings
|
||||
from app.lib.folderslib import GetFilesAndDirs, create_folder
|
||||
from app.lib.folderslib import GetFilesAndDirs, get_folders
|
||||
from app.db.sqlite.settings import SettingsSQLMethods as db
|
||||
from app.utils.wintools import win_replace_slash, is_windows
|
||||
|
||||
@@ -30,6 +30,7 @@ def get_folder_tree():
|
||||
req_dir = "$home"
|
||||
|
||||
root_dirs = db.get_root_dirs()
|
||||
root_dirs.sort()
|
||||
|
||||
try:
|
||||
if req_dir == "$home" and root_dirs[0] == "$home":
|
||||
@@ -38,19 +39,17 @@ def get_folder_tree():
|
||||
pass
|
||||
|
||||
if req_dir == "$home":
|
||||
folders = [Path(f) for f in root_dirs]
|
||||
folders = get_folders(root_dirs)
|
||||
|
||||
return {
|
||||
"folders": [
|
||||
create_folder(str(f)) for f in folders
|
||||
],
|
||||
"folders": folders,
|
||||
"tracks": [],
|
||||
}
|
||||
|
||||
if is_windows():
|
||||
# Trailing slash needed when drive letters are passed,
|
||||
# Remember, the trailing slash is removed in the client.
|
||||
req_dir = req_dir + "/"
|
||||
req_dir += "/"
|
||||
else:
|
||||
req_dir = "/" + req_dir + "/" if not req_dir.startswith("/") else req_dir + "/"
|
||||
|
||||
@@ -66,7 +65,7 @@ def get_all_drives(is_win: bool = False):
|
||||
"""
|
||||
Returns a list of all the drives on a Windows machine.
|
||||
"""
|
||||
drives = psutil.disk_partitions(all=False)
|
||||
drives = psutil.disk_partitions()
|
||||
drives = [d.mountpoint for d in drives]
|
||||
|
||||
if is_win:
|
||||
@@ -99,7 +98,7 @@ def list_folders():
|
||||
}
|
||||
|
||||
if is_win:
|
||||
req_dir = req_dir + "/"
|
||||
req_dir += "/"
|
||||
else:
|
||||
req_dir = "/" + req_dir + "/"
|
||||
req_dir = str(Path(req_dir).resolve())
|
||||
|
||||
+2
-2
@@ -34,9 +34,9 @@ delete_playlist = PL.delete_playlist
|
||||
# get_tracks_by_trackhashes = SQLiteTrackMethods.get_tracks_by_trackhashes
|
||||
def duplicate_images(images: list):
|
||||
if len(images) == 1:
|
||||
images = images * 4
|
||||
images *= 4
|
||||
elif len(images) == 2:
|
||||
images = images + list(reversed(images))
|
||||
images += list(reversed(images))
|
||||
elif len(images) == 3:
|
||||
images = images + images[:1]
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from app.db.sqlite.settings import SettingsSQLMethods as sdb
|
||||
from app.utils.generators import get_random_str
|
||||
from app.utils.threading import background
|
||||
|
||||
from app.store.folder import FolderStore
|
||||
from app.store.albums import AlbumStore
|
||||
from app.store.tracks import TrackStore
|
||||
from app.store.artists import ArtistStore
|
||||
@@ -27,7 +26,6 @@ def reload_everything():
|
||||
Reloads all stores using the current database items
|
||||
"""
|
||||
TrackStore.load_all_tracks()
|
||||
FolderStore.process_folders()
|
||||
AlbumStore.load_albums()
|
||||
ArtistStore.load_artists()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user