简体   繁体   English

使用spotify-api-server添加曲目以Spotify播放列表

[英]Add a track to spotify playlist using spotify-api-server

I've asked the owner for the project for some help, but thought I'd ask stack overflow as well. 我已经向项目的所有者寻求帮助,但也想问堆栈溢出。

Does anyone know how to correctly add a track using the spotify-api-server? 有谁知道如何使用spotify-api-server正确添加曲目? I'm sure i'm missing something simple: 我确定我缺少一些简单的东西:

Could you please tell me how to POST and add a track to a playlist? 您能否告诉我如何发布帖子并将曲目添加到播放列表? I keep getting an error no matter what I try. 无论我如何尝试,我都会不断出错。 If i try and POST the URI as detailed in the readme, it errors: 如果我尝试按照自述文件中的详细说明发布URI,则会出错:

["spotify:track:1lDWb6b6ieDQ2xT7ewTC3G"]

error: {"message":"Invalid input"} 

["1lDWb6b6ieDQ2xT7ewTC3G"]

error: {"message":"No valid tracks"}

``` ```

If I try and POST to localhost:1337/playlist/{playlist ID}/add?index I get the error {"message":"Bad parameter: index must be numeric"} . 如果我尝试发布到localhost:1337/playlist/{playlist ID}/add?index则会收到错误{"message":"Bad parameter: index must be numeric"} It's only after changing index to index=1 does it let me move on and attempt to add a track. 只有将index更改为index=1 ,它才允许我继续尝试添加曲目。 Is this correct? 这个对吗?

I'm doing this through PHP, but happy to see terminal commands that I can try out and then adapt. 我正在通过PHP进行此操作,但很高兴看到我可以尝试并适应的终端命令。

Regarding {"message":"Bad parameter: index must be numeric"} , yes, that's correct — that's the index at which the track will be inserted into the playlist. 关于{"message":"Bad parameter: index must be numeric"} ,是的,这是正确的-这是将曲目插入播放列表的索引。 0 will make it the first item. 0将使其成为第一项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM