From 1f04b1e9d51146eefe2228f18ef99497eb17c24c Mon Sep 17 00:00:00 2001 From: dsc Date: Sat, 2 Sep 2023 22:24:12 +0300 Subject: [PATCH] fix thumbnails --- ircradio/routes.py | 4 +++- settings.py_example | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ircradio/routes.py b/ircradio/routes.py index ea33e5e..5b70fed 100644 --- a/ircradio/routes.py +++ b/ircradio/routes.py @@ -2,6 +2,7 @@ # Copyright (c) 2021, dsc@xmr.pm import os, re, dataclasses, random +from glob import glob from datetime import datetime from typing import Tuple, Optional from quart import request, render_template, abort, jsonify, send_from_directory, current_app, websocket, redirect, session, url_for @@ -319,9 +320,10 @@ async def ws(): async def assets_art(path: str): img_default = "album_art_default.jpg" _base = os.path.join(settings.cwd, "ircradio", "static") + mix_dirs = glob(settings.dir_mixes + "/*") try: - for _dirname in [settings.dir_meta, settings.dir_music]: + for _dirname in [settings.dir_meta, settings.dir_music, *mix_dirs]: _path = os.path.join(_dirname, path) if os.path.exists(_path): return await send_from_directory(_dirname, path) diff --git a/settings.py_example b/settings.py_example index eacf2e0..73a700f 100644 --- a/settings.py_example +++ b/settings.py_example @@ -19,6 +19,8 @@ redis_uri = os.environ.get('REDIS_URI', 'redis://localhost:6379') dir_music = os.environ.get("DIR_MUSIC", os.path.join(cwd, "data", "music")) dir_meta = os.environ.get("DIR_MUSIC", os.path.join(cwd, "data", "music_metadata")) +dir_mixes = "/home/radio/mixes/" + if not os.path.exists(dir_music): os.mkdir(dir_music) if not os.path.exists(dir_meta):