Beispiel #1
0
 def Match(self, query: str):
     query, page = parseSearchQuery(query)
     query = "artist:" + query
     trackOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     results = self.spotify.search(query, int(getSetting("MAX_RESULTS")),
                                   trackOffset, "track")
     return parseTracks(results)
Beispiel #2
0
 def Match(self, query: str):
     query, page = parseSearchQuery(query)
     user = self.spotify.current_user()
     playlistOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     playlists = self.spotify.user_playlists(
         user["id"], int(getSetting("MAX_RESULTS")), playlistOffset)
     return parsePlaylists(playlists)
Beispiel #3
0
 def Match(self, query: str):
     query, page = parseSearchQuery(query)
     playlistOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     searchResults = self.spotify.search(query,
                                         int(getSetting("MAX_RESULTS")),
                                         playlistOffset, "playlist")
     return parsePlaylists(searchResults["playlists"])
Beispiel #4
0
 def Match(self, query: str):
     query, page = parseSearchQuery(query)
     trackOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     results = self.spotify.search(q=query,
                                   limit=int(getSetting("MAX_RESULTS")),
                                   offset=trackOffset,
                                   type="show")
     return self.ParsePodcasts(results)
Beispiel #5
0
 def Match(self, query: str):
     searchResults = []
     if (query != ""):
         query, page = parseSearchQuery(query)
         trackOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
         searchResults = self.spotify.search(query,
                                             int(getSetting("MAX_RESULTS")),
                                             trackOffset, "track")
     else:
         searchResults = {
             "tracks":
             self.spotify.current_user_top_tracks(
                 offset=0, limit=int(getSetting("MAX_RESULTS")))
         }
     return parseTracks(searchResults)
Beispiel #6
0
    def Match(self, query: str):
        query, page = parseSearchQuery(query)
        searchResults = []
        if (query != ""):
            query = "artist:" + query
            trackOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
            searchResults = self.spotify.search(query,
                                                int(getSetting("MAX_RESULTS")),
                                                trackOffset, "track")
        else:
            topArtist = self.spotify.current_user_top_artists(limit=1)
            result = self.spotify.artist_top_tracks(
                topArtist['items'][0]['id'])
            searchResults = {"tracks": {"items": result["tracks"]}}

        return parseTracks(searchResults)
 def Match(self, query: str):
     query = " a " + query
     query, page = parseSearchQuery(query)
     savedShowsOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     savedShows = self.spotify.current_user_saved_shows(
         offset=savedShowsOffset, limit=int(getSetting("MAX_RESULTS")))
     shows = []
     for show in savedShows['items']:
         name = show['show']['name']
         uri = show['show']['uri']
         shows.append((uri, name, "Spotify", 100, 100, {
             "actions": ["asdf"]
         }))
     if (len(shows) > 0):
         return shows
     return [("", "No podcasts found!", "Spotify", 100, 100, {})]
Beispiel #8
0
 def Match(self, query: str):
     query, page = parseSearchQuery(query)
     episodeOffset = int(getSetting("MAX_RESULTS")) * (page - 1)
     playbackDetails = self.spotify.currently_playing(
         additional_types="episode")
     if(playbackDetails["item"]["type"] == "episode"):
         episodes = self.spotify.show_episodes(
             playbackDetails["item"]["show"]['id'], offset=episodeOffset, limit=int(getSetting("MAX_RESULTS")))
         episodeResults = []
         relevance = 100
         for episode in episodes['items']:
             icon = self.GetIcon(episode, playbackDetails)
             episodeResults.append((episode["uri"],
                                    episode["name"],
                                    icon,
                                    relevance, 100, {}))
             relevance = relevance - 1
         return episodeResults
     else:
         return [("", "No podcast is being played!", "Spotify", 100, 100, {})]