projects
/
music-assistant-server.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f064467
)
Fix default album fallback image for tracks (#376)
author
Marcel van der Veldt
<m.vanderveldt@outlook.com>
Sun, 19 Jun 2022 21:18:43 +0000
(23:18 +0200)
committer
GitHub
<noreply@github.com>
Sun, 19 Jun 2022 21:18:43 +0000
(23:18 +0200)
music_assistant/models/media_items.py
patch
|
blob
|
history
diff --git
a/music_assistant/models/media_items.py
b/music_assistant/models/media_items.py
index 2ae836c02e5fd9a6d2524c94ae782024d2835094..0a075dfde4d56da41ae2b53f47724b6e96b6ef9a 100755
(executable)
--- a/
music_assistant/models/media_items.py
+++ b/
music_assistant/models/media_items.py
@@
-299,6
+299,16
@@
class Track(MediaItem):
"""Return custom hash."""
return hash((self.provider, self.item_id))
+ @property
+ def image(self) -> str | None:
+ """Return (first/random) image/thumb from metadata (if any)."""
+ if image := super().image:
+ return image
+ # fallback to album image
+ if self.album:
+ return self.album.image
+ return None
+
@dataclass
class Playlist(MediaItem):