Added not found and logging

This commit is contained in:
Kasper Rynning-Tønnesen
2018-10-23 13:10:11 +02:00
parent ceb70a0996
commit f0e1e26cc3

View File

@@ -610,13 +610,7 @@ var List = {
console.log(thisSong, i);
if(i >= full_playlist.length) {
console.log(result, List.found, List.not_found);
SC_player.post('/playlists', {
playlist: {
title: chan.toLowerCase() + " - Zoff",
tracks: List.found,
}
}).then(function(result) {
console.log(result, List.found, List.not_found);
if(List.found.length == 0) {
for(var x = 0; x < List.not_found.length; x++) {
var data = List.not_found[x];
var not_added_song = document.createElement("div");
@@ -628,12 +622,34 @@ var List = {
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) {
console.log(error);
});
} else {
SC_player.post('/playlists', {
playlist: {
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) {
console.log(error);
});
}
} else if(thisSong == undefined) {
if(full_playlist.length > 0) {
List.exportToSoundCloud(full_playlist[0], 0);
@@ -664,8 +680,10 @@ var List = {
if(title.indexOf(song.user.username) == -1) {
title = song.user.username + " - " + title;
}
title = title.toLowerCase();
var id=song.id;
if(similarity(title, thisSong.track) > 0.60) {
console.log(title, thisSong.title, similarity(title, thisSong.title));
if(similarity(title, thisSong.title) > 0.60) {
List.found.push({id: parseInt(song.id)});
isFound = true;
break;