Restyle Remove global lists and read everything from the database. (#71)

This commit is contained in:
restyled-io[bot]
2022-07-06 17:41:01 +03:00
committed by GitHub
parent 73891aa5cf
commit e77f2b9f2b
11 changed files with 97 additions and 70 deletions
+9 -7
View File
@@ -11,14 +11,13 @@ from app import exceptions
from app import instances
from app import models
from app import settings
from app.helpers import Get
from app.lib import trackslib
from app.logger import get_logger
from PIL import Image
from PIL import ImageSequence
from werkzeug import datastructures
from app.lib import trackslib
from app.helpers import Get
from app.logger import get_logger
TrackExistsInPlaylist = exceptions.TrackExistsInPlaylist
logg = get_logger()
@@ -53,7 +52,8 @@ def create_thumbnail(image: any, img_path: str) -> str:
Creates a 250 x 250 thumbnail from a playlist image
"""
thumb_path = "thumb_" + img_path
full_thumb_path = os.path.join(settings.APP_DIR, "images", "playlists", thumb_path)
full_thumb_path = os.path.join(settings.APP_DIR, "images", "playlists",
thumb_path)
aspect_ratio = image.width / image.height
@@ -71,11 +71,13 @@ def save_p_image(file: datastructures.FileStorage, pid: str):
"""
img = Image.open(file)
random_str = "".join(random.choices(string.ascii_letters + string.digits, k=5))
random_str = "".join(
random.choices(string.ascii_letters + string.digits, k=5))
img_path = pid + str(random_str) + ".webp"
full_img_path = os.path.join(settings.APP_DIR, "images", "playlists", img_path)
full_img_path = os.path.join(settings.APP_DIR, "images", "playlists",
img_path)
if file.content_type == "image/gif":
frames = []