mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-17 07:12:09 +00:00
Logging + playlist + plans
Fix logger
This commit is contained in:
@@ -34,7 +34,7 @@ if platform in ("linux", "linux2"):
|
|||||||
NETRC_FILE = "/home/pi/.netrc"
|
NETRC_FILE = "/home/pi/.netrc"
|
||||||
LOGSTORE = "/home/pi/RetroPie/logs/"
|
LOGSTORE = "/home/pi/RetroPie/logs/"
|
||||||
ENCODING = "utf-8"
|
ENCODING = "utf-8"
|
||||||
|
MUSIC_FOLDER = "/home/pi/RetroPie/mp3/"
|
||||||
|
|
||||||
|
|
||||||
music_file_list = []
|
music_file_list = []
|
||||||
@@ -49,6 +49,14 @@ def rescan():
|
|||||||
if platform == "win32":
|
if platform == "win32":
|
||||||
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)
|
||||||
|
with open("playlist.json", "r+", encoding="utf-8") as s_file:
|
||||||
|
database = music_file_list
|
||||||
|
#self.app.logger.info("DUMPING DATA")
|
||||||
|
s_file.truncate(0)
|
||||||
|
s_file.seek(0)
|
||||||
|
json.dump(database, s_file)
|
||||||
|
#TODO: Zobaczyć czy losowo, itp. lepiej po stronie pythona czy po stronei liquidsoapa. Tak samo modyfikowanie playlisty itp. itd.
|
||||||
|
#TODO: Ale zacząć od odtwarzania playlisty z tego pliku json (może np. się format nie zgadzać albo coś)
|
||||||
|
|
||||||
def thread_rescan():
|
def thread_rescan():
|
||||||
"""
|
"""
|
||||||
@@ -62,7 +70,8 @@ def thread_rescan():
|
|||||||
rescan()
|
rescan()
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
#TODO: Parametry ustalające czy dajemy zwrotkę do bota czy do streamera ? W każdej z funkcji?
|
||||||
|
#TODO: Odpalić wyszukiwarki w wątkach i dopiero po wszystkim zsumować wyszukiwanie.
|
||||||
def wyszukaj(word_list, how_many):
|
def wyszukaj(word_list, how_many):
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
return_list = []
|
return_list = []
|
||||||
@@ -118,6 +127,7 @@ def wyszukaj(word_list, how_many):
|
|||||||
else:
|
else:
|
||||||
skip = 4
|
skip = 4
|
||||||
matched_times = 1
|
matched_times = 1
|
||||||
|
#TODO: To do wątków albo for asynchroniczny
|
||||||
for itm in all_words[skip:]:
|
for itm in all_words[skip:]:
|
||||||
pingu += 1
|
pingu += 1
|
||||||
pattern = ".*" + word + ".*"
|
pattern = ".*" + word + ".*"
|
||||||
@@ -181,6 +191,16 @@ def remove_characters(string, character):
|
|||||||
"""
|
"""
|
||||||
return string.replace(character, "")
|
return string.replace(character, "")
|
||||||
|
|
||||||
|
@app.route("/stream", methods=["GET"])
|
||||||
|
def stream_music():
|
||||||
|
"""
|
||||||
|
The function `get_music_list` returns a JSON object containing a list of music files.
|
||||||
|
:return: A JSON response containing a key "music_file_list" with the value of the variable
|
||||||
|
`music_file_list`.
|
||||||
|
"""
|
||||||
|
return jsonify({"music_file_list": music_file_list})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/mp3", methods=["GET"])
|
@app.route("/mp3", methods=["GET"])
|
||||||
def get_music_list():
|
def get_music_list():
|
||||||
|
|||||||
Reference in New Issue
Block a user