portify icon indicating copy to clipboard operation
portify copied to clipboard

app stops processing when playlist has only one song in it

Open ghost opened this issue 12 years ago • 1 comments

I ran the app a few times and found that it had stopped processing when it hit certain playlists I had.

In all cases, if the playlists had a total number of one tracks, it would get stuck at the first for loop (for(var i = 0; i < tracks.length; i++))

in the function around line 190 (var processTracks = function(playlist, tracks))

I tried debugging it by forcing it to break the loop if it found that the tracks.length was equal to 1 if (tracks.length != 1) { toget.push(tracks[i].uri); } else { toget.push(tracks[i].uri); break; }

but it would then get stuck at (before, I think) the second for loop (for(var i = 0; i < tracks.length; i++))

nested under the spotify.get function (spotifySession.get(toget, function (err, tracks))

ghost avatar Dec 07 '13 12:12 ghost

Did some digging on this. The version of spotify-web that portify is using appears to hang when requesting only one song. In fact, it uses a different codepath for one song: https://github.com/mauimauer/node-spotify-web/blob/master/lib/spotify.js#L505

I should note that the spotify-web which portify uses (https://github.com/mauimauer/node-spotify-web/) is hard coded to a very old version. The most recent version (https://github.com/TooTallNate/node-spotify-web/) doesn't seem to have this issue. However, the differences between the versions likely mean that the new version won't work with portify without some changes (although I haven't tried).

alienth avatar Jan 09 '14 11:01 alienth