Restyle Integrate topbar and refactor playlists page (#31)

This commit is contained in:
restyled-io[bot]
2022-04-14 11:39:26 +03:00
committed by GitHub
parent 85c59b4cba
commit a6e46dcde2
8 changed files with 66 additions and 35 deletions
+8 -4
View File
@@ -35,7 +35,8 @@ def add_track(playlistid: str, trackid: str):
try:
playlist.add_track(track)
instances.playlist_instance.add_track_to_playlist(playlistid, track)
instances.playlist_instance.add_track_to_playlist(
playlistid, track)
return
except TrackExistsInPlaylist as error:
raise error
@@ -68,7 +69,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
@@ -86,11 +88,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 = []