Make most song info optional, to support untagged music

This commit is contained in:
Danielle McLean 2023-12-06 10:54:51 +11:00
parent 88a38a1bbd
commit 9ff488d807
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
4 changed files with 105 additions and 55 deletions

View file

@ -1,5 +1,7 @@
from enum import StrEnum
from pathlib import Path
from typing import Protocol
from uuid import UUID
from attrs import define, field
@ -13,10 +15,18 @@ class PlaybackState(StrEnum):
@define
class Song:
state: PlaybackState
title: str
artist: str
album: str
album_artist: str
queue_index: int
queue_length: int
file: Path
musicbrainz_trackid: UUID | None
title: str | None
artist: str | None
composer: str | None
album: str | None
album_artist: str | None
track: int | None
disc: int | None
genre: str | None
duration: float
elapsed: float
art: bytes | None = field(repr=lambda a: "<has art>" if a else "<no art>")