Did some refactor, add YouTube as search variant
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
from attrs import define
|
||||
import spotipy
|
||||
|
||||
from ..common.song import BaseSongItem
|
||||
|
||||
|
||||
@define
|
||||
class SongItem:
|
||||
name: str
|
||||
id: str
|
||||
artists: list[str]
|
||||
preview_url: str | None
|
||||
thumbnail: str
|
||||
|
||||
class SongItem(BaseSongItem):
|
||||
@classmethod
|
||||
def from_spotify(cls, song_item: dict):
|
||||
return cls(
|
||||
@@ -21,17 +17,6 @@ class SongItem:
|
||||
thumbnail=song_item['album']['images'][1]['url']
|
||||
)
|
||||
|
||||
@property
|
||||
def all_artists(self):
|
||||
return ', '.join(self.artists)
|
||||
|
||||
@property
|
||||
def full_name(self):
|
||||
return f"{self.all_artists} - {self.name}"
|
||||
|
||||
def __str__(self):
|
||||
return f"{', '.join(self.artists)} - {self.name}"
|
||||
|
||||
|
||||
@define
|
||||
class Songs(object):
|
||||
|
||||
Reference in New Issue
Block a user