是否有可靠、有效且有据可查的 .Net Spotify 库?到目前为止,我一直在摆弄 shapotify 和 libspotify-sharp,但没有运气!
我正在尝试创建一个新的播放列表,然后将其加载到 Spotify 客户端。这是我迄今为止尝试使用的Sharpotify
using Sharpotify;
public JsonResult AddList(string list, string name)
{
SpotifyConnection connection = new SpotifyConnection(new harpotify.Cache.FileCache(),new TimeSpan(0,1,0));
string username = "username";
string password = "password";
bool result = false;
try
{
connection.Login(username, password);
Sharpotify.Media.Playlist playlist = connection.PlaylistCreate(name);
String [] tracks = list.Split(';');
for (int i = 0; i < tracks.Length; i++)
{
if(tracks[i] != string.Empty){
Sharpotify.Media.Track t = new Sharpotify.Media.Track(tracks[i]);
if (t != null){
playlist.Tracks.Add(t);
}
}
}
result = true;
}
catch (Sharpotify.Exceptions.AuthenticationException ex)
{
connection.Close();
result = false;
}
catch (Exception ex)
{
connection.Close();
result = false;
}
return Json(result, JsonRequestBehavior.AllowGet);
}