-
Notifications
You must be signed in to change notification settings - Fork 0
/
Track.py
28 lines (24 loc) · 913 Bytes
/
Track.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Track.py -- defines track class
class Track:
def __init__(self, title=None, artist=None, album=""):
assert title is not None
assert artist is not None
self.title = title
self.artist = artist
self.album = album
def songStr(self):
#return self.title + " -- " + self.artist
return str(self.__dict__)
def spotify_query(self):
query = 'track:"{}" artist:"{}"'.format(self.title, self.artist)
if self.album != "":
query += ' album:"{}"'.format(self.album)
return query
def spotify_query2(self):
query = 'track:{} artist:{}'.format(self.title, self.artist)
if self.album != "":
query += ' album:{}'.format(self.album)
return query
def spotify_query3(self):
query = '{} {}'.format(self.title, self.artist)
return query