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))
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))
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))
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))
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))
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))
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))