我需要使用 apiSpotify我的客户需要有一个 Spotify 应用程序,该应用程序将代表注册用户连接到 Spotify,并获取所有播放列表名称及其在这些播放列表中的歌曲,并将创建这些播放列表的 txt 文件,就是这样。
请帮助我我应该从哪里开始,我需要用 php 来完成它。
Thanks
正如评论中提到的,有很多代码使用不幸的非开源 libspotify。提供的 API 示例小心地省略了迭代所有播放列表的方法。
你提到你想要一些可以连接到 Spotify 的东西(在线 API 肯定是 Spotify 希望每个人都使用的),但我很确定同样可以离线完成。正如您自己所说,文件可以备份。
位于:
〜/.config/spotify/用户/名称/
or
{USER_APP_DATA}/Spotify/用户/{USER_ID}
您可能已经知道我不喜欢限制访问我能做或不能做的事情的专有库。所以我想出了一个简单的程序,可以打印所有存储的播放列表的名称。这很有帮助,因为我通常为每个播放列表添加一张专辑。
我很确定它可以进一步开发以包含单独的曲目。
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
int main(int argc, char *argv[]) {
std::vector<char> vbuf;
unsigned int len;
std::vector<char>::iterator bpos,dpos,epos;
std::ifstream in("playlist.bnk", std::ios::in|std::ios::binary);
if (in) {
in.seekg(0,std::ios::end);
len = in.tellg();
vbuf.resize(len);
in.seekg(0,std::ios::beg);
in.read(&vbuf[0],len);
for(std::vector<char>::iterator it = vbuf.begin(); it != vbuf.end(); ++it) {
if (*it == (char)0x02 && *(it+1) == (char)0x09) {
bpos = it+3;
}
if (*it == (char)0xE2 && *(it+1) == (char)0x80 && *(it+2) == (char)0x93 && bpos != vbuf.end()) {
dpos = it;
}
if (*it == (char)0x18 && *(it+1) == (char)0x01 && *(it+2) == (char)0x19 && dpos != vbuf.end()) {
epos = it;
}
if (bpos != vbuf.end() && dpos != vbuf.end() && epos != vbuf.end()) {
for(std::vector<char>::iterator it2 = bpos; it2 < dpos; ++it2) {
std::cout << *it2;
}
for(std::vector<char>::iterator it2 = dpos; it2 < epos; ++it2) {
std::cout << *it2;
}
std::cout << std::endl;
bpos = vbuf.end();
dpos = vbuf.end();
epos = vbuf.end();
}
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)