Beispiel #1
0
static PyObject *Results_artists(Results *self) {
    int count = sp_search_num_artists(self->_search);
    PyObject *l = PyList_New(count);
    int i;
    for(i=0;i<count;++i) {
        Artist *a = (Artist *)PyObject_CallObject((PyObject *)&ArtistType, NULL);
        a->_artist = sp_search_artist(self->_search, i);
        PyList_SetItem(l, i, (PyObject *)a);
    }
    Py_INCREF(l);
    return l;
}
Beispiel #2
0
/**
 * Print the given search result with as much information as possible
 *
 * @param  search   The search result
 */
static void print_search(sp_search *search)
{
  int i;

  printf("Query          : %s\n", sp_search_query(search));
  printf("Did you mean   : %s\n", sp_search_did_you_mean(search));
  printf("Tracks in total: %d\n", sp_search_total_tracks(search));
  puts("");

  for (i = 0; i < sp_search_num_tracks(search); ++i)
    print_track(sp_search_track(search, i));

  puts("");

  for (i = 0; i < sp_search_num_albums(search); ++i)
    print_album(sp_search_album(search, i));

  puts("");

  for (i = 0; i < sp_search_num_artists(search); ++i)
    print_artist(sp_search_artist(search, i));

  puts("");
}
void QSpotifySearch::populateArtists(sp_search *search)
{
    m_artistResults->clear();
    if (m_enablePreview)
        m_artistResultsPreview->clear();

    if (search) {
        int c = sp_search_num_artists(search);
        for (int i = 0; i < c; ++i) {
            std::shared_ptr<QSpotifyArtist> artist = QSpotifyCacheManager::instance().getArtist(sp_search_artist(search, i));
            m_artistResults->appendRow(artist);
            if(m_enablePreview && i < m_numPreviewItems)
                m_artistResultsPreview->appendRow(artist);
        }
    }
}
Beispiel #4
0
Artist Search::artistAt(int index) const
{
    return isValid() ? Artist(sp_search_artist(handle(), index)) : Artist();
}