Files
swingmusic-extended/app/setup/__init__.py
T
mungai-njoroge ec5889515b show recently added items based on by sorting all tracks
.ie. will still show recent items even if they are 3 months old (is this good or bad?)
2024-02-14 23:09:05 +03:00

31 lines
776 B
Python

"""
Prepares the server for use.
"""
from app.db.sqlite.settings import load_settings
from app.setup.files import create_config_dir
from app.setup.sqlite import run_migrations, setup_sqlite
from app.store.albums import AlbumStore
from app.store.artists import ArtistStore
from app.store.tracks import TrackStore
from app.utils.generators import get_random_str
def run_setup():
create_config_dir()
setup_sqlite()
run_migrations()
try:
load_settings()
except IndexError:
# settings table is empty
pass
instance_key = get_random_str()
# INFO: Load all tracks, albums, and artists into memory
TrackStore.load_all_tracks(instance_key)
AlbumStore.load_albums(instance_key)
ArtistStore.load_artists(instance_key)