load settings from db, use api to change settings

+ add route to get all settings
+ add route to set any setting
+ add untested migration to add settings into settings db
+ compress json in api responses using FlaskCompress
+ serve gziped assets if browser accepts encoded files
+ misc
This commit is contained in:
mungai-njoroge
2023-08-24 15:52:09 +03:00
parent e3a61c109b
commit 71cab5f5ea
22 changed files with 437 additions and 163 deletions
+7 -12
View File
@@ -3,14 +3,10 @@ This module contains functions for the server
"""
import time
from app.logger import log
from app.lib.populate import Populate, PopulateCancelledError
from app.utils.generators import get_random_str
from app.utils.network import Ping
from app.utils.threading import background
from app.settings import ParserFlags, get_flag, get_scan_sleep_time
from app.utils.generators import get_random_str
from app.utils.threading import background
@background
@@ -21,14 +17,13 @@ def run_periodic_scans():
# ValidateAlbumThumbs()
# ValidatePlaylistThumbs()
try:
Populate(key=get_random_str())
except PopulateCancelledError:
pass
run_periodic_scan = True
while run_periodic_scan:
run_periodic_scan = get_flag(ParserFlags.DO_PERIODIC_SCANS)
while get_flag(ParserFlags.DO_PERIODIC_SCANS):
try:
Populate(key=get_random_str())
Populate(instance_key=get_random_str())
except PopulateCancelledError:
pass