refactor: rename function and remove useless code

This commit is contained in:
rick 2021-09-04 19:26:14 +02:00
parent 67b05a30b4
commit b71067d84f
Signed by: Rick
GPG key ID: 2B593F087240EE99
2 changed files with 4 additions and 35 deletions

View file

@ -93,7 +93,6 @@ func getAllTracksPlaylist(id string, offset int) (SpotifyPlaylist, error) {
}
ret = *playlist
fmt.Printf("\n%d cc %d\n", ret.Total, offset)
if ret.Total > offset {
r, e := getAllTracksPlaylist(id, offset + 100)
if e != nil {

View file

@ -1,6 +1,5 @@
const spotifyText = document.createTextNode("Spotify");
const bandcampText = document.createTextNode("Bandcamp");
//const tab = document.getElementById("my-list");
async function addCell(id, elem) {
let tab = document.getElementById(id), tmpLink, artist, album, newRow;
@ -29,7 +28,7 @@ async function addCell(id, elem) {
}
}
async function test() {
async function refreshArray() {
const data = await fetch('/refresh').then(response => response.json());
if (data != null) {
document.getElementById("nb-fait").textContent = data.done;
@ -52,37 +51,6 @@ async function test() {
addCell("notfound", elem);
}
}
/*
if (data.urls != null) {
var newRow, artist, album, tmpLink;
for (const elem of data.urls) {
artist = document.createTextNode(elem.artist);
album = document.createTextNode(elem.album);
tmpLink = document.createElement("a");
tmpLink.appendChild(spotifyText.cloneNode());
tmpLink.title = "Lien Spotify";
tmpLink.href = elem.spotifyurl;
/*
let tmp = document.createTextNode(elem);
let newP = document.createElement("p");
newP.appendChild(tmp);
document.getElementById("my-list").appendChild(newP);
newRow = tab.insertRow(-1);
newRow.insertCell(0).appendChild(artist);
newRow.insertCell(1).appendChild(album);
newRow.insertCell(2).appendChild(tmpLink);
tmpLink = document.createElement("a");
tmpLink.appendChild(bandcampText.cloneNode());
tmpLink.title = "Lien Bandcamp";
tmpLink.href = elem.bandcampurl;
newRow.insertCell(3).appendChild(tmpLink);
}
}
*/
if (data.done === data.todo) {
document.getElementById("inf-loader").remove();
@ -91,8 +59,10 @@ async function test() {
}
}
/*
window.onbeforeunload = function() {
return "Vous perdrez tous les artistes trouvés en rafraichissant la page."
}
*/
const refreshList = setInterval(test, 5000);
const refreshList = setInterval(refreshArray, 5000);