refactored and cleaned up data objects

This commit is contained in:
Hellow 2023-02-28 01:13:53 +01:00
parent fe86f8591d
commit 2df5fc7488
2 changed files with 10 additions and 26 deletions

View File

@ -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

View File

@ -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)