From 2df5fc74885a3cb3d8b8213094d4aa2d90e2fbe7 Mon Sep 17 00:00:00 2001 From: Hellow Date: Tue, 28 Feb 2023 01:13:53 +0100 Subject: [PATCH] refactored and cleaned up data objects --- src/music_kraken/objects/artist.py | 22 ---------------------- src/music_kraken/objects/song.py | 14 ++++++++++---- 2 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 src/music_kraken/objects/artist.py diff --git a/src/music_kraken/objects/artist.py b/src/music_kraken/objects/artist.py deleted file mode 100644 index b035903..0000000 --- a/src/music_kraken/objects/artist.py +++ /dev/null @@ -1,22 +0,0 @@ -from src.music_kraken.utils.shared import ( - DATABASE_LOGGER as logger -) -from .parents import ( - DatabaseObject, - Reference -) - - -class Artist(DatabaseObject): - def __init__(self, id_: str = None, mb_id: str = None, name: str = None) -> None: - super().__init__(id_=id_) - self.mb_id = mb_id - self.name = name - - def __eq__(self, __o: object) -> bool: - if type(__o) != type(self): - return False - return self.id == __o.id - - def __str__(self) -> str: - return self.name diff --git a/src/music_kraken/objects/song.py b/src/music_kraken/objects/song.py index 9a98f70..7f4e855 100644 --- a/src/music_kraken/objects/song.py +++ b/src/music_kraken/objects/song.py @@ -276,10 +276,6 @@ class Album(MainObject, SourceAttribute, MetadataAttribute): id3Mapping.DATE: [self.date.timestamp] }) - @property - def is_split(self) -> bool: - return len(self.artist_collection) > 1 - def get_copyright(self) -> str: if self.date is None: return "" @@ -295,6 +291,16 @@ class Album(MainObject, SourceAttribute, MetadataAttribute): return self.language.alpha_3 + @property + def is_split(self) -> bool: + """ + A split Album is an Album from more than one Artists + usually half the songs are made by one Artist, the other half by the other one. + In this case split means either that or one artist featured by all songs. + :return: + """ + return len(self.artist_collection) > 1 + def get_options(self) -> list: options = self.artist_collection.copy() options.append(self)