在libspotify中搜索播放列表似乎无法从结果中获取元数据

时间:2013-02-26 17:04:04

标签: libspotify

不确定正确处理搜索播放列表,对艺术家,曲目,专辑没有任何问题。 开发人员资源似乎不包括这一点,当然这是我似乎正在努力的部分。

https://developer.spotify.com/technologies/libspotify/docs/12.1.45/search_8c-example.html 是否搜索但不处理播放列表结果。

search.c中的spshell有这个引用,但仅凭这个名称无济于事,我看到sp_search_playlist被注释掉了,但它没有记载。我假设它会返回我可以传递给sp_playlist_num_tracks,sp_playlist_name等的东西..但这似乎不起作用。

for (i = 0; i < sp_search_num_playlists(search); ++i) {
    // print some readily available metadata, the rest will
    // be available from the sp_playlist object loaded through
    // sp_search_playlist().
    printf("  Playlist \"%s\"\n", sp_search_playlist_name(search, i));
}

那么如何正确地将搜索播放列表转换为某些元数据和曲目呢?

任何帮助或建议都会很棒!!

2 个答案:

答案 0 :(得分:0)

我不确定为什么它不在在线文档中,但sp_search_playlist记录在api.h中:

/**
 * Load the playlist at the given index in the given search object
 *
 * @param[in]  search     Search object
 * @param[in]  index      Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
 *
 * @return                A playlist object. This reference is owned by the caller and should be released with sp_playlist_release()
 */
SP_LIBEXPORT(sp_playlist *) sp_search_playlist(sp_search *search, int index);

请注意,与API的许多类似部分不同,它表示调用者拥有引用。

或者,如果你因使用它而感到不舒服,因为它的记录很少,你可以从搜索中获取播放列表URI,从中创建一个链接然后从链接创建一个播放列表。

答案 1 :(得分:0)

好的,我好像已经解决了这个问题。我需要等到playlist_update_in_progress和done标志为真才能获得数据。希望这可以帮助其他人。

相关问题