mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
add app version output to version.txt
+ refactor main entry point + add debug logging in image extraction
This commit is contained in:
@@ -35,4 +35,7 @@ RUN pip install bjoern
|
|||||||
ARG app_version
|
ARG app_version
|
||||||
ENV SWINGMUSIC_APP_VERSION=$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"]
|
ENTRYPOINT ["python", "run.py", "--host", "0.0.0.0", "--config", "/config"]
|
||||||
|
|||||||
@@ -108,10 +108,6 @@ def run(*args, **kwargs):
|
|||||||
start_swingmusic(kwargs["host"], kwargs["port"])
|
start_swingmusic(kwargs["host"], kwargs["port"])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
multiprocessing.freeze_support()
|
|
||||||
multiprocessing.set_start_method("fork")
|
|
||||||
run()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
multiprocessing.freeze_support()
|
||||||
|
run()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def create_api():
|
|||||||
Creates the Flask instance, registers modules and registers all the API blueprints.
|
Creates the Flask instance, registers modules and registers all the API blueprints.
|
||||||
"""
|
"""
|
||||||
api_info = Info(
|
api_info = Info(
|
||||||
title=f"Swing Music",
|
title="Swing Music",
|
||||||
version=f"v{AppInfo.SWINGMUSIC_APP_VERSION}",
|
version=f"v{AppInfo.SWINGMUSIC_APP_VERSION}",
|
||||||
description=open_api_description,
|
description=open_api_description,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
from dataclasses import asdict
|
|
||||||
import os
|
import os
|
||||||
from concurrent.futures import ProcessPoolExecutor
|
|
||||||
import platform
|
import platform
|
||||||
|
import multiprocessing
|
||||||
|
from dataclasses import asdict
|
||||||
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
|
||||||
from requests import ConnectionError as RequestConnectionError
|
from requests import ConnectionError as RequestConnectionError
|
||||||
from requests import ReadTimeout
|
from requests import ReadTimeout
|
||||||
@@ -63,11 +64,18 @@ def get_image(album: Album):
|
|||||||
:type album: Album
|
:type album: Album
|
||||||
:return: None
|
: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)
|
matching_tracks = AlbumStore.get_album_tracks(album.albumhash)
|
||||||
|
|
||||||
|
log.info("[get_image] Found matching tracks: %s", len(matching_tracks))
|
||||||
|
|
||||||
for track in 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")
|
extracted = extract_thumb(track.filepath, track.albumhash + ".webp")
|
||||||
|
|
||||||
|
log.info("[get_image] extracted: %s", extracted)
|
||||||
|
|
||||||
if extracted:
|
if extracted:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CustomFormatter(logging.Formatter):
|
|||||||
bold_red = "\x1b[31;1m"
|
bold_red = "\x1b[31;1m"
|
||||||
reset = "\x1b[0m"
|
reset = "\x1b[0m"
|
||||||
# format_ = "[%(asctime)s] %(name)s %(levelname)s %(message)s (%(filename)s:%(lineno)d)"
|
# 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"
|
# format_ = "%(message)s"
|
||||||
|
|
||||||
FORMATS = {
|
FORMATS = {
|
||||||
|
|||||||
Reference in New Issue
Block a user