refactor UI layout

This commit is contained in:
geoffrey45
2022-03-06 10:27:01 +03:00
parent 90f8703a8e
commit 7f2102f931
21 changed files with 214 additions and 164 deletions
+17 -2
View File
@@ -146,7 +146,7 @@ def create_config_dir() -> None:
os.chmod(path, 0o755)
def get_all_songs() -> List[models.Track]:
def create_all_tracks() -> List[models.Track]:
"""
Gets all songs under the ~/ directory.
"""
@@ -160,11 +160,26 @@ def get_all_songs() -> List[models.Track]:
except FileNotFoundError:
instances.songs_instance.remove_song_by_filepath(track["filepath"])
album = instances.album_instance.get_album_by_name(track['album', track['albumartist']])
if album is None:
track['albumid'] = album['albumid']
track['image'] = album['image']
tracks.append(models.Track(track))
return tracks
def create_all_albums() -> List[models.Album]:
"""Creates album objects for all albums"""
albums: list[models.Album] = []
for album in instances.album_instance.get_all_albums():
albums.append(models.Album(album))
return albums
def extract_colors(image) -> list:
"""Extracts 2 of the most dominant colors from an image."""
try:
@@ -208,4 +223,4 @@ def get_album_image(album: list) -> str:
if img is not None:
return img
return functions.use_defaults()
return functions.use_defaults()