refactored using the song and src object instead of dict

This commit is contained in:
Lars Noack 2022-11-22 13:19:54 +01:00
parent 599b0fdd59
commit 4bd3e39a75

View File

@ -34,6 +34,9 @@ class Artist:
self.id = self.artist_data['id'] self.id = self.artist_data['id']
self.name = self.artist_data['name'] self.name = self.artist_data['name']
def __str__(self) -> str:
return self.name
class Source: class Source:
def __init__(self, src_data) -> None: def __init__(self, src_data) -> None:
self.src_data = src_data self.src_data = src_data
@ -63,6 +66,9 @@ class Song:
self.target.file = self.json_data['file'] self.target.file = self.json_data['file']
self.target.path = self.json_data['path'] self.target.path = self.json_data['path']
def __str__(self) -> str:
return f"\"{self.title}\" by {', '.join([str(a) for a in self.artists])}"
def has_isrc(self) -> bool: def has_isrc(self) -> bool:
return self.isrc is not None return self.isrc is not None