mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
b40f05cc7c
+ rewrite migrations logic + rename encode_password to hash_password + update image sizes (add medium size) + rename image endpoints
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""
|
|
This module contains functions for the server
|
|
"""
|
|
import time
|
|
|
|
from app.lib.populate import Populate, PopulateCancelledError
|
|
from app.settings import SessionVarKeys, get_flag, get_scan_sleep_time
|
|
from app.utils.generators import get_random_str
|
|
from app.utils.threading import background
|
|
from app.logger import log
|
|
|
|
@background
|
|
def run_periodic_scans():
|
|
"""
|
|
Runs periodic scans.
|
|
|
|
Periodic scans are checks that run every few minutes
|
|
in the background to do stuff like:
|
|
- checking for new music
|
|
- delete deleted entries
|
|
- downloading artist images, and other data.
|
|
"""
|
|
# ValidateAlbumThumbs()
|
|
# ValidatePlaylistThumbs()
|
|
|
|
run_periodic_scan = True
|
|
|
|
while run_periodic_scan:
|
|
run_periodic_scan = get_flag(SessionVarKeys.DO_PERIODIC_SCANS)
|
|
|
|
try:
|
|
Populate(instance_key=get_random_str())
|
|
except PopulateCancelledError:
|
|
log.error("'run_periodic_scans': Periodic scan cancelled.")
|
|
pass
|
|
|
|
sleep_time = get_scan_sleep_time()
|
|
time.sleep(sleep_time)
|