From 725c8e53853d420108714b5721326aa4835a5606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Sat, 27 Apr 2019 12:59:11 +0200 Subject: [PATCH] trying a fix for import not working corectly --- server/public/assets/js/search.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/public/assets/js/search.js b/server/public/assets/js/search.js index aecc52f5..e02267c0 100755 --- a/server/public/assets/js/search.js +++ b/server/public/assets/js/search.js @@ -359,6 +359,21 @@ var Search = { var data = response.items[y]; //Helper.log(data); //var title = data.snippet.title; + if(data.contentDetails == undefined || data.contentDetails.duration == undefined) { + Search.readySubmit(false, {totalLength: totalNumber - 1}); + Helper.log([ + "NO MATCH FOR:", + "Spotify title: " + title + " " + artist.join(" "), + "Spotify length: " + length + ]); + var not_added_song = document.createElement("div"); + not_added_song.innerHTML = not_import_html; + not_added_song.querySelector(".extra-add-text").innerText = title + " - " + artist.join(" "); + not_added_song.querySelector(".extra-add-text").setAttribute("title", title + " - " + artist.join(" ")); + not_added_song.querySelector(".extra-button-search").setAttribute("data-text", title + " - " + artist.join(" ")); + document.querySelector(".not-imported-container").insertAdjacentHTML("beforeend", not_added_song.innerHTML); + Helper.removeClass(".not-imported", "hide"); + } var duration = Search.durationToSeconds(data.contentDetails.duration); var not_matched = false; if(similarity(data.snippet.title, artist + " - " + title) > 0.75) {