mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
Restyled by autopep8
This commit is contained in:
committed by
Mungai Geoffrey
parent
9c16d27507
commit
ec7352ec56
@@ -2,6 +2,7 @@
|
|||||||
Contains all the folder routes.
|
Contains all the folder routes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from app import helpers
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
from flask import Blueprint, request
|
from flask import Blueprint, request
|
||||||
@@ -11,7 +12,6 @@ from app import settings
|
|||||||
from app.lib import folderslib
|
from app.lib import folderslib
|
||||||
|
|
||||||
folder_bp = Blueprint("folder", __name__, url_prefix="/")
|
folder_bp = Blueprint("folder", __name__, url_prefix="/")
|
||||||
from app import helpers
|
|
||||||
|
|
||||||
|
|
||||||
@folder_bp.route("/folder", methods=["POST"])
|
@folder_bp.route("/folder", methods=["POST"])
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ def populate():
|
|||||||
"""
|
"""
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
s, files = helpers.run_fast_scandir(settings.HOME_DIR, [".flac", ".mp3"], full=True)
|
s, files = helpers.run_fast_scandir(
|
||||||
|
settings.HOME_DIR, [".flac", ".mp3"], full=True)
|
||||||
|
|
||||||
_bar = Bar("Processing files", max=len(files))
|
_bar = Bar("Processing files", max=len(files))
|
||||||
|
|
||||||
@@ -123,7 +124,8 @@ def populate_images():
|
|||||||
_bar = Bar("Processing images", max=len(artists))
|
_bar = Bar("Processing images", max=len(artists))
|
||||||
for artist in artists:
|
for artist in artists:
|
||||||
file_path = (
|
file_path = (
|
||||||
helpers.app_dir + "/images/artists/" + artist.replace("/", "::") + ".webp"
|
helpers.app_dir + "/images/artists/" +
|
||||||
|
artist.replace("/", "::") + ".webp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
@@ -365,7 +367,8 @@ def get_album_bio(title: str, albumartist: str):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bio = data["album"]["wiki"]["summary"].split('<a href="https://www.last.fm/')[0]
|
bio = data["album"]["wiki"]["summary"].split(
|
||||||
|
'<a href="https://www.last.fm/')[0]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
bio = None
|
bio = None
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ def get_album_image(album: list) -> str:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
for track in album:
|
for track in album:
|
||||||
img_p = (track["album"] + track["albumartist"] + ".webp").replace("/", "::")
|
img_p = (track["album"] + track["albumartist"] +
|
||||||
|
".webp").replace("/", "::")
|
||||||
img = functions.extract_thumb(track["filepath"], webp_path=img_p)
|
img = functions.extract_thumb(track["filepath"], webp_path=img_p)
|
||||||
|
|
||||||
if img is not None:
|
if img is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user