WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 09520f0

Browse files
committed
Merge pull request #391 from jllodra/hide-unstreamable-from-playlists
removes unstreamable tracks from data fetched from API in playlists
2 parents 9917d7e + 7befac7 commit 09520f0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/public/js/playlists/playlistsCtrl.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ app.controller('PlaylistsCtrl', function ($scope, SCapiService, $rootScope, $log
99

1010
SCapiService.get(endpoint, params)
1111
.then(function(data) {
12+
data.forEach(function(playlist, i) {
13+
var l = playlist.tracks.length;
14+
while(l--) {
15+
if(!playlist.tracks[l].streamable) {
16+
data[i].tracks.splice(l, 1);
17+
}
18+
}
19+
});
1220
$scope.data = data;
1321
}, function(error) {
1422
console.log('error', error);
@@ -64,7 +72,7 @@ app.controller('PlaylistsCtrl', function ($scope, SCapiService, $rootScope, $log
6472
}, function(error) {
6573
console.log('error', error);
6674
});
67-
75+
6876
};
6977

7078
/**

0 commit comments

Comments
 (0)