server: move all stores to api.py

This commit is contained in:
geoffrey45
2022-03-18 19:57:31 +03:00
parent 29124ce717
commit f8710a1596
7 changed files with 37 additions and 53 deletions
+4 -14
View File
@@ -4,19 +4,10 @@ This module contains mimi functions for the server.
import os
import threading
import time
from typing import List
import requests
import colorgram
from io import BytesIO
from PIL import Image
from app import instances
from app import functions
from app import watchdoge
from app import models, settings
from app import models
home_dir = os.path.expanduser("~") + "/"
app_dir = os.path.join(home_dir, ".musicx")
@@ -34,8 +25,6 @@ def background(func):
return background_func
def run_fast_scandir(_dir: str, ext: list):
"""
Scans a directory for files with a specific extension. Returns a list of files and folders in the directory.
@@ -117,13 +106,14 @@ def extract_image_colors(image) -> list:
return formatted_colors
def check_artist_image(image: str) -> str:
"""
Checks if the artist image is valid.
"""
img_name = image.replace("/", "::")+ ".webp"
img_name = image.replace("/", "::") + ".webp"
if not os.path.exists(os.path.join(app_dir, "images", "artists", img_name)):
return "http://0.0.0.0:8900/images/artists/0.webp"
else:
return "http://0.0.0.0:8900/images/artists/" + img_name,
return ("http://0.0.0.0:8900/images/artists/" + img_name,)