aboutsummaryrefslogtreecommitdiff
path: root/client/js/radio_emulator.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-10-14 02:16:10 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-10-14 02:16:10 +0300
commit30475d7b4d0b4e7aa49435050fb95c932278c10d (patch)
treec2f3e139ee8bab138a994a8aca68ff02f0113fbf /client/js/radio_emulator.js
parentc75a2a2212381767c253203edea7637380823d59 (diff)
downloadarching-kaos-radio-30475d7b4d0b4e7aa49435050fb95c932278c10d.tar.gz
arching-kaos-radio-30475d7b4d0b4e7aa49435050fb95c932278c10d.tar.bz2
arching-kaos-radio-30475d7b4d0b4e7aa49435050fb95c932278c10d.zip
Bugfixes
Diffstat (limited to 'client/js/radio_emulator.js')
-rw-r--r--client/js/radio_emulator.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/client/js/radio_emulator.js b/client/js/radio_emulator.js
index ed6c58d..7064a5e 100644
--- a/client/js/radio_emulator.js
+++ b/client/js/radio_emulator.js
@@ -256,12 +256,13 @@ function listCallback(json, params)
previous = { starts_on: -1 };
if ( json.list.length === 1 )
{
- FetchJSON(`${jsonRequest}${previous.hash}`, loadShowCallback, [json, now_on_sequence, json.list[0], hash_of_list]);
+ FetchJSON(`${jsonRequest}${json.list[0].hash}`, loadShowCallback, [json, now_on_sequence, json.list[0], hash_of_list]);
}
for ( var i = 1; i < json.list.length; i++)
{
debugLog("getting there")
- if ( now_on_sequence < json.list[i].starts_on && now_on_sequence > json.list[i-1].starts_on){
+ if ( now_on_sequence < json.list[i].starts_on && now_on_sequence > json.list[i-1].starts_on )
+ {
var tmp = document.createElement('pre');
tmp.innerText = JSON.stringify(json.list[i-1], null, 2);
@@ -270,17 +271,25 @@ function listCallback(json, params)
debugLog(`now_on_sequence (1updated): ${now_on_sequence}`);
previous = json.list[i-1];
FetchJSON(`${jsonRequest}${previous.hash}`, loadShowCallback, [json, now_on_sequence, previous, hash_of_list]);
+ debugLog('First!');
break;
}
- else
+ else if ( now_on_sequence > json.list[i].starts_on && now_on_sequence > json.list[i-1].starts_on )
{
var tmp = document.createElement('pre');
tmp.innerText = JSON.stringify(json.list[i-1], null, 2);
placeholders.previouslyPlayed.append(tmp);
+ FetchJSON(`${jsonRequest}${json.list[i].hash}`, loadShowCallback, [json, now_on_sequence, json.list[i], hash_of_list]);
+ debugLog('Second!');
+ break;
+ }
+ else
+ {
debugLog(now_on_sequence);
debugLog(json.list[i].starts_on);
- FetchJSON(`${jsonRequest}${json.list[i].hash}`, loadShowCallback, [json, now_on_sequence, json.list[i], hash_of_list]);
debugLog(json.list[i-1].starts_on);
+ debugLog('Nothing!');
+ continue;
}
}
}