fix thumbnails

This commit is contained in:
dsc 2023-09-02 22:24:12 +03:00
parent 9cff22f6ac
commit 1f04b1e9d5
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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):