tmp
This commit is contained in:
parent
19d22d1428
commit
7e6605dde2
@ -13,16 +13,24 @@ from .util import exhaust
|
|||||||
class Query:
|
class Query:
|
||||||
"Query builder for Spotify search API"
|
"Query builder for Spotify search API"
|
||||||
|
|
||||||
def __init__(self, query: Optional[str] = None, artist: Optional[str] = None, label: Optional[str] = None) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
query: Optional[str] = None,
|
||||||
|
artist: Optional[str] = None,
|
||||||
|
label: Optional[str] = None,
|
||||||
|
year: Optional[int] = None,
|
||||||
|
) -> None:
|
||||||
self.query = query
|
self.query = query
|
||||||
self.artist = artist
|
self.artist = artist
|
||||||
self.label = label
|
self.label = label
|
||||||
|
self.year = year
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
query_items = [
|
query_items = [
|
||||||
self.query,
|
self.query,
|
||||||
f'artist:"{self.artist}"' if self.artist is not None else None,
|
f'artist:"{self.artist}"' if self.artist is not None else None,
|
||||||
f'label:"{self.label}"' if self.label is not None else None,
|
f'label:"{self.label}"' if self.label is not None else None,
|
||||||
|
f"year:{self.year}" if self.year is not None else None,
|
||||||
]
|
]
|
||||||
return " ".join([i for i in query_items if i is not None])
|
return " ".join([i for i in query_items if i is not None])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user