add colors to album page header

- add colors attribute to the album class
- render color gradient in the album page
This commit is contained in:
geoffrey45
2022-06-30 14:01:48 +03:00
committed by Mungai Geoffrey
parent f919ce35df
commit a23b6200eb
7 changed files with 70 additions and 42 deletions
+8
View File
@@ -82,6 +82,7 @@ class Album:
Creates an album object
"""
albumid: str
title: str
artist: str
hash: str
@@ -92,14 +93,21 @@ class Album:
is_soundtrack: bool = False
is_compilation: bool = False
is_single: bool = False
colors: List[str] = field(default_factory=list)
def __init__(self, tags):
self.albumid = tags["_id"]["$oid"]
self.title = tags["title"]
self.artist = tags["artist"]
self.date = tags["date"]
self.image = tags["image"]
self.hash = tags["hash"]
try:
self.colors = tags["colors"]
except KeyError:
self.colors = []
@property
def is_soundtrack(self) -> bool:
keywords = ["motion picture", "soundtrack"]