简体   繁体   English

Spotify应用-列表不显示播放列表的曲目,仅显示thead

[英]Spotify app - List don't show tracks of playlist, just the thead

I want to list a normal List with tracks from a playlist. 我想列出一个带有播放列表中曲目的普通列表。 i have problem to list the tracks from that list, I just get the head with the fields (track, artist, time, star, nr and more), which is the gray one. 我在从该列表中列出曲目时遇到问题,我只是弄清楚字段(曲目,艺术家,时间,明星,nr等)的头,这是灰色的。 That's the only one showing up, no tracks appears and it looks very weird. 那是唯一出现的一个,没有曲目出现,看起来很奇怪。

This is the function i'm using: 这是我正在使用的功能:

function setPlaylistWithTopic(playlisturi, row) {
    // Play multiple tracks
    console.log(playlisturi);

    models.Playlist.fromURI(playlisturi).load(['name','owner', 'tracks', 'description']).done(function(playlist) {
        console.log("came in");
        console.log(playlist);
        var multiple_tracks_player = document.getElementById(row);
        multiple_tracks_player.className = multiple_tracks_player.className + " sp-list-style-rounded albumlist";

        console.log(playlist);

        var list = List.forPlaylist(playlist);

        var image = Image.forPlaylist(playlist, {width: 65, height: 65});

        var playlistname = playlist.name;
        var playlistowner = playlist.owner;
        if(playlistname.length > 75) {
            playlistname=playlistname.substr(0,75) + "..";
        }
        $("#"+row).append("<div class='col-md-12 col-sm-12 col-xs-12 row'><div class='pull-left' id='albumcover'></div><div class='albumhead' id='"+playlisturi+"'><h3><a href='"+playlisturi+"'>"+playlistname+"</a></h3><span class='label col-md-12 row'>"+playlistowner+"</span></div></div>").append(list.node);
        $("#"+row + " #albumcover").append(image.node);
        $("#"+row + " .albumhead").append("<button class='sp-button sp-add-to-collection-button sp-button-accentuated-positive sp-button-accentuated' style='min-width: 156.15625px;'><span class='sp-button-text'><div class='sp-button-icon sp-icon-add'></div>Subscribe</span><span class='sp-button-background'></span></button>");
        $("#"+row + " #"+playlisturi+" .sp-add-to-collection-button").die("click");
        $("#"+row + " #"+playlisturi+" .sp-add-to-collection-button").live('click',function(e){
                //Subscribe on playlist
                e.preventDefault();
        });

        list.init();
    });
}

I'm using jQuery and Spotify's API version 1.30.0, i think it should be 1.0.0, but i tested to change to 1.30.0 while looking in the API doc when it didn't work, and view had 1.3*.0 in version. 我正在使用jQuery和Spotify的API版本1.30.0,我认为应该是1.0.0,但是我测试了在不起作用的情况下在API文档中查找时会更改为1.30.0,并且视图具有1.3 *。版本为0。

What am I doing wrong? 我究竟做错了什么?

The playlisturi variable contains colons, which need to be escaped with \\\\: playlisturi变量包含冒号,需要使用\\\\进行转义

var escapedPlaylistUri = playlisturi.replace(":","\\:");
$("#" + row + " #" + escapedPlaylistUri + " .sp-add-to-collection-button").die("click");
$("#" + row + " #" + escapedPlaylistUri + " .sp-add-to-collectionbutton").live('click', function(e) { ...

"To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\." - http://api.jquery.com/category/selectors/ “要将任何元字符(例如!“#$%&'()* +,。/ :; <=>?@ [] ^`{|}〜)用作名称的文字部分,它必须以两个反斜杠转义:\\。”-http: //api.jquery.com/category/selectors/

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

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