From 4bd3e39a75b4dafb1af079f1d85a45d64b670beb Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 22 Nov 2022 13:19:54 +0100 Subject: [PATCH] refactored using the song and src object instead of dict --- src/music_kraken/database/song.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/music_kraken/database/song.py b/src/music_kraken/database/song.py index 5b52024..b085086 100644 --- a/src/music_kraken/database/song.py +++ b/src/music_kraken/database/song.py @@ -34,6 +34,9 @@ class Artist: self.id = self.artist_data['id'] self.name = self.artist_data['name'] + def __str__(self) -> str: + return self.name + class Source: def __init__(self, src_data) -> None: self.src_data = src_data @@ -63,6 +66,9 @@ class Song: self.target.file = self.json_data['file'] 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: return self.isrc is not None