mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
🔷 redesign playlist header
This commit is contained in:
committed by
Mungai Geoffrey
parent
d0e2980dfe
commit
9c808aa817
@@ -5,7 +5,7 @@ This library contains all the functions related to albums.
|
||||
from pprint import pprint
|
||||
import urllib
|
||||
from typing import List
|
||||
from app import models, functions, helpers
|
||||
from app import models, functions
|
||||
from app.lib import trackslib
|
||||
from app import api
|
||||
|
||||
@@ -19,7 +19,11 @@ def create_everything() -> List[models.Track]:
|
||||
|
||||
api.ALBUMS.clear()
|
||||
api.ALBUMS.extend(albums)
|
||||
trackslib.create_all_tracks()
|
||||
|
||||
tracks = trackslib.create_all_tracks()
|
||||
|
||||
api.TRACKS.clear()
|
||||
api.TRACKS.extend(tracks)
|
||||
|
||||
|
||||
def get_album_duration(album: list) -> int:
|
||||
@@ -41,7 +45,8 @@ def get_album_image(album: list) -> str:
|
||||
"""
|
||||
|
||||
for track in album:
|
||||
img = functions.extract_thumb(track["filepath"])
|
||||
img_p = track["album"] + track["albumartist"] + ".webp"
|
||||
img = functions.extract_thumb(track["filepath"], webp_path=img_p)
|
||||
|
||||
if img is not None:
|
||||
return img
|
||||
|
||||
@@ -18,12 +18,13 @@ def create_all_tracks() -> List[models.Track]:
|
||||
tracks: list[models.Track] = []
|
||||
|
||||
_bar = Bar("Creating tracks", max=len(api.PRE_TRACKS))
|
||||
|
||||
|
||||
for track in api.PRE_TRACKS:
|
||||
try:
|
||||
os.chmod(track["filepath"], 0o755)
|
||||
except FileNotFoundError:
|
||||
instances.songs_instance.remove_song_by_filepath(track["filepath"])
|
||||
api.PRE_TRACKS.remove(track)
|
||||
|
||||
album = albumslib.find_album(track["album"], track["albumartist"])
|
||||
|
||||
@@ -34,8 +35,7 @@ def create_all_tracks() -> List[models.Track]:
|
||||
|
||||
_bar.finish()
|
||||
|
||||
api.TRACKS.clear()
|
||||
api.TRACKS.extend(tracks)
|
||||
return tracks
|
||||
|
||||
|
||||
def get_album_tracks(albumname, artist):
|
||||
@@ -54,4 +54,3 @@ def get_track_by_id(trackid: str) -> models.Track:
|
||||
for track in api.TRACKS:
|
||||
if track.trackid == trackid:
|
||||
return track
|
||||
|
||||
|
||||
Reference in New Issue
Block a user