mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
fix: stores not being populated on track indexing
This commit is contained in:
@@ -54,4 +54,5 @@
|
|||||||
|
|
||||||
# Bug fixes
|
# Bug fixes
|
||||||
|
|
||||||
- Duplicates on search
|
- Duplicates on search
|
||||||
|
- Audio stops on ending
|
||||||
+8
-2
@@ -10,6 +10,7 @@ import PyInstaller.__main__ as bundler
|
|||||||
|
|
||||||
from app import settings
|
from app import settings
|
||||||
from app.config import UserConfig
|
from app.config import UserConfig
|
||||||
|
from app.db.userdata import UserTable
|
||||||
from app.logger import log
|
from app.logger import log
|
||||||
from app.print_help import HELP_MESSAGE
|
from app.print_help import HELP_MESSAGE
|
||||||
from app.utils.auth import hash_password
|
from app.utils.auth import hash_password
|
||||||
@@ -220,7 +221,8 @@ class ProcessArgs:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
username = username.strip()
|
username = username.strip()
|
||||||
user = authdb.get_user_by_username(username)
|
# user = authdb.get_user_by_username(username)
|
||||||
|
user = UserTable.get_by_username(username)
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
print(f"User {username} not found")
|
print(f"User {username} not found")
|
||||||
@@ -234,6 +236,10 @@ class ProcessArgs:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
password = hash_password(password)
|
password = hash_password(password)
|
||||||
user = authdb.update_user({"id": user.id, "password": password})
|
# user = authdb.update_user({"id": user.id, "password": password})
|
||||||
|
UserTable.update_one({
|
||||||
|
"id": user.id,
|
||||||
|
"password": password
|
||||||
|
})
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
+30
-9
@@ -1,23 +1,44 @@
|
|||||||
from app.lib.mapstuff import map_album_colors, map_artist_colors, map_favorites, map_scrobble_data
|
|
||||||
from app.lib.populate import CordinateMedia
|
|
||||||
from app.lib.tagger import IndexTracks
|
|
||||||
from app.store.folder import FolderStore
|
|
||||||
|
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
from time import time
|
from time import time
|
||||||
|
from app.lib.mapstuff import (
|
||||||
|
map_album_colors,
|
||||||
|
map_artist_colors,
|
||||||
|
map_favorites,
|
||||||
|
map_scrobble_data,
|
||||||
|
)
|
||||||
|
from app.lib.populate import CordinateMedia
|
||||||
|
from app.lib.tagger import IndexTracks
|
||||||
|
from app.store.albums import AlbumStore
|
||||||
|
from app.store.artists import ArtistStore
|
||||||
|
from app.store.folder import FolderStore
|
||||||
|
from app.store.tracks import TrackStore
|
||||||
from app.utils.threading import background
|
from app.utils.threading import background
|
||||||
|
|
||||||
|
def load_and_map():
|
||||||
|
key = str(time())
|
||||||
|
FolderStore.load_filepaths()
|
||||||
|
AlbumStore.load_albums(key)
|
||||||
|
ArtistStore.load_artists(key)
|
||||||
|
|
||||||
|
map_scrobble_data()
|
||||||
|
map_favorites()
|
||||||
|
map_artist_colors()
|
||||||
|
map_album_colors()
|
||||||
|
|
||||||
|
|
||||||
class IndexEverything:
|
class IndexEverything:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
IndexTracks(instance_key=time())
|
IndexTracks(instance_key=time())
|
||||||
|
|
||||||
|
key = str(time())
|
||||||
|
TrackStore.load_all_tracks(key)
|
||||||
|
AlbumStore.load_albums(key)
|
||||||
|
ArtistStore.load_artists(key)
|
||||||
FolderStore.load_filepaths()
|
FolderStore.load_filepaths()
|
||||||
|
|
||||||
map_scrobble_data()
|
map_scrobble_data()
|
||||||
map_favorites()
|
map_favorites()
|
||||||
map_artist_colors()
|
|
||||||
map_album_colors()
|
|
||||||
CordinateMedia(instance_key=str(time()))
|
CordinateMedia(instance_key=str(time()))
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
|||||||
+16
-11
@@ -2,7 +2,14 @@
|
|||||||
Prepares the server for use.
|
Prepares the server for use.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from time import time
|
||||||
import uuid
|
import uuid
|
||||||
|
from app.lib.mapstuff import (
|
||||||
|
map_album_colors,
|
||||||
|
map_artist_colors,
|
||||||
|
map_favorites,
|
||||||
|
map_scrobble_data,
|
||||||
|
)
|
||||||
from app.setup.files import create_config_dir
|
from app.setup.files import create_config_dir
|
||||||
from app.setup.sqlite import run_migrations, setup_sqlite
|
from app.setup.sqlite import run_migrations, setup_sqlite
|
||||||
from app.store.albums import AlbumStore
|
from app.store.albums import AlbumStore
|
||||||
@@ -29,21 +36,19 @@ def run_setup():
|
|||||||
setup_sqlite()
|
setup_sqlite()
|
||||||
run_migrations()
|
run_migrations()
|
||||||
|
|
||||||
# try:
|
|
||||||
# load_settings()
|
|
||||||
# except IndexError:
|
|
||||||
# # settings table is empty
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
def load_into_mem():
|
def load_into_mem():
|
||||||
"""
|
"""
|
||||||
Load all tracks, albums, and artists into memory.
|
Load all tracks, albums, and artists into memory.
|
||||||
"""
|
"""
|
||||||
# instance_key = get_random_str()
|
|
||||||
|
|
||||||
# INFO: Load all tracks, albums, and artists data into memory
|
# INFO: Load all tracks, albums, and artists data into memory
|
||||||
|
key = str(time())
|
||||||
TrackStore.load_all_tracks(get_random_str())
|
TrackStore.load_all_tracks(get_random_str())
|
||||||
AlbumStore.load_albums('a')
|
AlbumStore.load_albums(key)
|
||||||
ArtistStore.load_artists('a')
|
ArtistStore.load_artists(key)
|
||||||
FolderStore.load_filepaths()
|
FolderStore.load_filepaths()
|
||||||
|
|
||||||
|
map_scrobble_data()
|
||||||
|
map_favorites()
|
||||||
|
map_artist_colors()
|
||||||
|
map_album_colors()
|
||||||
|
|||||||
@@ -61,11 +61,7 @@ mimetypes.add_type("application/manifest+json", ".webmanifest")
|
|||||||
# Background tasks
|
# Background tasks
|
||||||
@background
|
@background
|
||||||
def bg_run_setup():
|
def bg_run_setup():
|
||||||
pass
|
|
||||||
# run_periodic_scans()
|
|
||||||
IndexEverything()
|
IndexEverything()
|
||||||
# map_scrobble_data()
|
|
||||||
# map_favorites()
|
|
||||||
|
|
||||||
|
|
||||||
# @background
|
# @background
|
||||||
|
|||||||
Reference in New Issue
Block a user