From 7903a8e6663715f38c9123b06a29fc5d55eb8c64 Mon Sep 17 00:00:00 2001 From: Ral Date: Sun, 26 Dec 2021 03:32:01 +0100 Subject: [PATCH] Another try --- public/index.html | 2 +- ...6e64dd9f5aec7555b1e993ca99e620f6c78bd4.js} | 22 ++++++++++++------- public/music/index.html | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) rename public/{main.a72bc232cf7205707699cb3faf6243790fe29e806411c9c37138b32f6f5da481.js => main.b67a4b646a3847aa36131a70016e64dd9f5aec7555b1e993ca99e620f6c78bd4.js} (96%) diff --git a/public/index.html b/public/index.html index 7d4b5ab..7674bd9 100644 --- a/public/index.html +++ b/public/index.html @@ -13,6 +13,6 @@ - + \ No newline at end of file diff --git a/public/main.a72bc232cf7205707699cb3faf6243790fe29e806411c9c37138b32f6f5da481.js b/public/main.b67a4b646a3847aa36131a70016e64dd9f5aec7555b1e993ca99e620f6c78bd4.js similarity index 96% rename from public/main.a72bc232cf7205707699cb3faf6243790fe29e806411c9c37138b32f6f5da481.js rename to public/main.b67a4b646a3847aa36131a70016e64dd9f5aec7555b1e993ca99e620f6c78bd4.js index 30dc540..3b70271 100644 --- a/public/main.a72bc232cf7205707699cb3faf6243790fe29e806411c9c37138b32f6f5da481.js +++ b/public/main.b67a4b646a3847aa36131a70016e64dd9f5aec7555b1e993ca99e620f6c78bd4.js @@ -90,16 +90,22 @@ return scheduleFiltered; }; var is_new_music = (musicA, musicB) => { - let isNew; - musicA.forEach((ma) => { - musicB.forEach((mb) => { - isNew = ma.artist !== mb.artist || ma.title !== mb.title; - }); - }); - return isNew; + console.log("Eval new music?"); + console.log(musicA); + console.log(musicB); + let isSame; + if (musicA.length !== 0 && musicB.length !== 0) { + isSame = musicA[0].artist === musicB[0].artist && musicA[0].title === musicB[0].title; + } else if (musicA.length === 0 && musicB.length === 0) { + isSame = true; + } else { + isSame = false; + } + return !isSame; }; var music_filter = (musicA, musicB) => { let isNew = is_new_music(musicA, musicB); + console.log("New? " + isNew); musicB.forEach((m) => m.updated = true); return musicB; }; @@ -423,7 +429,7 @@ function update_screen() { let realTime = new Date(); console.log("Updating screen at at: " + realTime); - let now = Date.parse("2021-12-27T12:26:00+01:00"); + let now = Date.now(); console.log("Using 'now': " + now); update_main_slide({ schedule: future_events(scheduleData, now), diff --git a/public/music/index.html b/public/music/index.html index 7f41250..ee29352 100644 --- a/public/music/index.html +++ b/public/music/index.html @@ -13,6 +13,6 @@ - + \ No newline at end of file