mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-17 15:22:10 +00:00
aa
This commit is contained in:
@@ -4,7 +4,7 @@ from platform import uname
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from sys import platform
|
from sys import platform
|
||||||
|
import logging
|
||||||
from flask import Flask, jsonify, request
|
from flask import Flask, jsonify, request
|
||||||
|
|
||||||
if platform in ("linux", "linux2"):
|
if platform in ("linux", "linux2"):
|
||||||
@@ -33,7 +33,8 @@ if platform in ("linux", "linux2"):
|
|||||||
|
|
||||||
|
|
||||||
music_file_list = []
|
music_file_list = []
|
||||||
def rescan(logger):
|
def rescan():
|
||||||
|
logger = logging.getLogger("conjurer_musician")
|
||||||
logger.info("Rescan triggered")
|
logger.info("Rescan triggered")
|
||||||
for mp3_item in Path.glob(Path(MUSIC_FOLDER), "**/*.mp3"):
|
for mp3_item in Path.glob(Path(MUSIC_FOLDER), "**/*.mp3"):
|
||||||
temp_music_file = mp3_item.as_posix()
|
temp_music_file = mp3_item.as_posix()
|
||||||
@@ -41,7 +42,8 @@ def rescan(logger):
|
|||||||
temp_music_file = temp_music_file.replace("/", "\\")
|
temp_music_file = temp_music_file.replace("/", "\\")
|
||||||
music_file_list.append(temp_music_file)
|
music_file_list.append(temp_music_file)
|
||||||
|
|
||||||
def thread_rescan(name,logger):
|
def thread_rescan(name):
|
||||||
|
logger = logging.getLogger("conjurer_musician")
|
||||||
logger.info(f"Starting filesystemupdater {name}")
|
logger.info(f"Starting filesystemupdater {name}")
|
||||||
while True:
|
while True:
|
||||||
time.sleep(60*60*24)
|
time.sleep(60*60*24)
|
||||||
@@ -69,8 +71,8 @@ def update_music_list():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(app.logger.name)
|
print(app.logger.name)
|
||||||
rescan(app.logger.getChild("BGtask"))
|
rescan()
|
||||||
thread = threading.Thread(target=thread_rescan, args=["Updater",app.logger.getChild("BGtask")])
|
thread = threading.Thread(target=thread_rescan, args=(1,))
|
||||||
thread.start()
|
thread.start()
|
||||||
app.run(debug=True, host="0.0.0.0")
|
app.run(debug=True, host="0.0.0.0")
|
||||||
#from waitress import serve
|
#from waitress import serve
|
||||||
|
|||||||
Reference in New Issue
Block a user