add app version output to version.txt

+ refactor main entry point
+ add debug logging in image extraction
This commit is contained in:
cwilvx
2025-06-18 14:38:43 +03:00
parent 58133de040
commit dd76b8c7f8
5 changed files with 17 additions and 10 deletions
+3
View File
@@ -35,4 +35,7 @@ RUN pip install bjoern
ARG app_version
ENV SWINGMUSIC_APP_VERSION=$app_version
# dump the app_version to the version.txt file
RUN echo $app_version > version.txt
ENTRYPOINT ["python", "run.py", "--host", "0.0.0.0", "--config", "/config"]
+2 -6
View File
@@ -108,10 +108,6 @@ def run(*args, **kwargs):
start_swingmusic(kwargs["host"], kwargs["port"])
def main():
multiprocessing.freeze_support()
multiprocessing.set_start_method("fork")
run()
if __name__ == "__main__":
main()
multiprocessing.freeze_support()
run()
+1 -1
View File
@@ -60,7 +60,7 @@ def create_api():
Creates the Flask instance, registers modules and registers all the API blueprints.
"""
api_info = Info(
title=f"Swing Music",
title="Swing Music",
version=f"v{AppInfo.SWINGMUSIC_APP_VERSION}",
description=open_api_description,
)
+10 -2
View File
@@ -1,7 +1,8 @@
from dataclasses import asdict
import os
from concurrent.futures import ProcessPoolExecutor
import platform
import multiprocessing
from dataclasses import asdict
from concurrent.futures import ProcessPoolExecutor
from requests import ConnectionError as RequestConnectionError
from requests import ReadTimeout
@@ -63,11 +64,18 @@ def get_image(album: Album):
:type album: Album
:return: None
"""
log.info("[MP] process was started using: %s", multiprocessing.get_start_method())
log.info("[get_image] extract image for album: %s", album.title)
matching_tracks = AlbumStore.get_album_tracks(album.albumhash)
log.info("[get_image] Found matching tracks: %s", len(matching_tracks))
for track in matching_tracks:
log.info("[get_image] extract image for track: %s", track.title)
extracted = extract_thumb(track.filepath, track.albumhash + ".webp")
log.info("[get_image] extracted: %s", extracted)
if extracted:
return
+1 -1
View File
@@ -16,7 +16,7 @@ class CustomFormatter(logging.Formatter):
bold_red = "\x1b[31;1m"
reset = "\x1b[0m"
# format_ = "[%(asctime)s] %(name)s %(levelname)s %(message)s (%(filename)s:%(lineno)d)"
format_ = "[%(asctime)s] [%(levelname)s] %(message)s (%(filename)s:%(lineno)d)\n"
format_ = "[%(asctime)s] [%(levelname)s] %(message)s (%(filename)s:%(lineno)d)"
# format_ = "%(message)s"
FORMATS = {