Visual loop and not exported elements

This commit is contained in:
Kasper Rynning-Tønnesen
2018-10-23 13:02:16 +02:00
parent a6e49995e6
commit d74a6694a8
2 changed files with 18 additions and 12 deletions

View File

@@ -610,15 +610,25 @@ var List = {
console.log(thisSong, i);
if(i >= full_playlist.length) {
console.log(result, List.found, List.not_found);
//List.found = [];
//List.not_found = [];
SC_player.post('/playlists', {
playlist: {
title: "zoff_list",
title: chan.toLowerCase() + " - Zoff",
tracks: List.found,
}
}).then(function(result) {
console.log(result, List.found, List.not_found);
for(var x = 0; x < List.not_found.length; x++) {
var data = List.not_found[x];
var not_added_song = document.createElement("div");
not_added_song.innerHTML = not_export_html;
not_added_song.querySelector(".extra-add-text").setAttribute("value", data);
not_added_song.querySelector(".extra-add-text").setAttribute("title", data);
document.querySelector(".not-exported-container").insertAdjacentHTML("beforeend", not_added_song.innerHTML);
}
Helper.addClass(".current_number", "hide");
Helper.addClass("#playlist_loader_export", "hide");
Helper.addClass(".exported-list-container", "hide");
document.querySelector(".exported-list").insertAdjacentHTML("beforeend", "<a target='_blank' class='btn light exported-playlist exported-spotify-list' href='" result.permalink_url + "'>" + result.title + "</a>");
List.found = [];
List.not_found = [];
}).catch(function(error) {
@@ -630,6 +640,8 @@ var List = {
}
} else if(thisSong != undefined && i != undefined) {
var isFound = false;
Helper.removeClass(".current_number", "hide");
document.querySelector(".current_number").innerText = (i) + " of " + (full_playlist.length);
if(thisSong.source == "soundcloud") {
List.found.push({id: parseInt(thisSong.id)});
List.exportToSoundCloud(full_playlist[i+1], i+1);

View File

@@ -975,15 +975,9 @@ function addDynamicListeners() {
soundcloud_window = window.open("/api/oauth#soundcloud=true&nonce=" + nonce, "", "width=600, height=600");*/
SC_player.connect({"display":"page"}).then(function() {
console.log("We export now");
var tracks = [{id: 290}, {id: 291}, {id: 292}];
SC_player.post('/playlists', {
playlist: { title: 'My Playlist', tracks: tracks }
}).then(function(res) {
console.log("this", res);
});
Helper.removeClass("#playlist_loader_export", "hide");
Helper.addClass(".soundcloud-export-button", "hide");
Helper.removeClass(".exported-list-container", "hide");
List.exportToSoundCloud();
});
});