From 8b9e62cc8a50601861d90f34338c208006b98346 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 29 Nov 2022 17:05:38 +0100 Subject: [PATCH] started refactoring of the song object to be indipendent from the database --- src/music_kraken/database/song.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/music_kraken/database/song.py b/src/music_kraken/database/song.py index 1af427d..c7d6ca8 100644 --- a/src/music_kraken/database/song.py +++ b/src/music_kraken/database/song.py @@ -13,6 +13,27 @@ from .target import Target class Song: def __init__(self, json_response: dict) -> None: + """ + id: is not NECESARRILY the musicbrainz id, but is DISTINCT for every song + mb_id: is the musicbrainz_id + target: Each Song can have exactly one target which can be either full or empty + lyrics: There can be multiple lyrics. Each Lyrics object can me added to multiple lyrics + """ + # attributes + self.id: str | None = None + self.mb_id: str | None = None + self.title: str | None = None + self.isrc: str | None = None + self.length: int | None = None + + self.metadata: Metadata = Metadata() + # joins + self.artists: List[Artist] = [] + self.lyrics: LyricsContainer = LyricsContainer(parent=self) + + self.sources: List[Source] = [] + self.target: Target = Target() + self.json_data = json_response # initialize the data