Beispiel #1
0
 def artistSource(self, query=None, query_string=None):
     if query is not None:
         q = query.name
     elif query_string is not None:
         q = query_string
     else:
         raise ValueError("query and query_string cannot both be None")
     
     artists = self.__spotify.search('artist', q=q, timeout=MERGE_TIMEOUT)['artists']
     return listSource(artists, constructor=lambda x: SpotifyArtist(x['href'], data=x))
Beispiel #2
0
 def albumSource(self, query=None, query_string=None):
     if query is not None:
         q = query.name
     elif query_string is not None:
         q = query_string
     else:
         raise ValueError("query and query_string cannot both be None")
     
     albums = self.__spotify.search('album',q=q, timeout=MERGE_TIMEOUT)['albums']
     albums = filter(available_in_us, albums)
     return listSource(albums, constructor=lambda x: SpotifyAlbum(x['href'], data=x))
Beispiel #3
0
 def trackSource(self, query=None, query_string=None):
     if query is not None:
         q = query.name
     elif query_string is not None:
         q = query_string
     else:
         raise ValueError("query and query_string cannot both be None")
     
     tracks = self.__spotify.search('track', q=q, timeout=MERGE_TIMEOUT)['tracks']
     tracks = filter(available_in_us, tracks)
     return listSource(tracks, constructor=lambda x: SpotifyTrack(x['href'], data=x))
Beispiel #4
0
 def appSource(self, query):
     items = self.__itunes.method('search', term=query.name, entity='software', attribute='softwareDeveloper', limit=100,
         timeout=MERGE_TIMEOUT)['results']
     return listSource(items, constructor=lambda x: iTunesApp(data=x))
Beispiel #5
0
 def tvSource(self, query):
     items = self.__itunes.method('search', term=query.name, entity='tvShow', attribute='showTerm', limit=100,
         timeout=MERGE_TIMEOUT)['results']
     return listSource(items, constructor=lambda x: iTunesTVShow(data=x))
Beispiel #6
0
 def bookSource(self, query):
     items = self.__itunes.method('search', term=query.name, entity='ebook', limit=100,
         timeout=MERGE_TIMEOUT)['results']
     return listSource(items, constructor=lambda x: iTunesBook(data=x))
Beispiel #7
0
 def albumSource(self, query):
     items = self.__itunes.method('search', term=query.name, entity='album', attribute='albumTerm', limit=200,
         timeout=MERGE_TIMEOUT)['results']
     return listSource(items, constructor=lambda x: iTunesAlbum(data=x))