mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
Restyled by yapf
This commit is contained in:
committed by
Mungai Geoffrey
parent
dc683e6314
commit
bb69ac1fc1
+9
-13
@@ -29,7 +29,6 @@ from progress.bar import Bar
|
||||
# from pprint import pprint
|
||||
|
||||
|
||||
|
||||
@helpers.background
|
||||
def reindex_tracks():
|
||||
"""
|
||||
@@ -62,7 +61,8 @@ def populate():
|
||||
"""
|
||||
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))
|
||||
|
||||
@@ -86,11 +86,8 @@ def populate():
|
||||
end = time.time()
|
||||
|
||||
print(
|
||||
str(datetime.timedelta(seconds=round(end - start)))
|
||||
+ " elapsed for "
|
||||
+ str(len(files))
|
||||
+ " files"
|
||||
)
|
||||
str(datetime.timedelta(seconds=round(end - start))) + " elapsed for " +
|
||||
str(len(files)) + " files")
|
||||
|
||||
|
||||
def fetch_image_path(artist: str) -> str or None:
|
||||
@@ -125,9 +122,8 @@ def populate_images():
|
||||
|
||||
_bar = Bar("Processing images", max=len(artists))
|
||||
for artist in artists:
|
||||
file_path = (
|
||||
helpers.app_dir + "/images/artists/" + artist.replace("/", "::") + ".webp"
|
||||
)
|
||||
file_path = (helpers.app_dir + "/images/artists/" +
|
||||
artist.replace("/", "::") + ".webp")
|
||||
|
||||
if not os.path.exists(file_path):
|
||||
img_path = fetch_image_path(artist)
|
||||
@@ -358,8 +354,7 @@ def get_album_bio(title: str, albumartist: str):
|
||||
Returns the album bio for a given album.
|
||||
"""
|
||||
last_fm_url = "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key={}&artist={}&album={}&format=json".format(
|
||||
settings.LAST_FM_API_KEY, albumartist, title
|
||||
)
|
||||
settings.LAST_FM_API_KEY, albumartist, title)
|
||||
|
||||
try:
|
||||
response = requests.get(last_fm_url)
|
||||
@@ -368,7 +363,8 @@ def get_album_bio(title: str, albumartist: str):
|
||||
return None
|
||||
|
||||
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:
|
||||
bio = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user