aboutsummaryrefslogtreecommitdiff
path: root/client/js
diff options
context:
space:
mode:
Diffstat (limited to 'client/js')
-rw-r--r--client/js/radio_emulator.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/client/js/radio_emulator.js b/client/js/radio_emulator.js
index ac2299a..12e6c67 100644
--- a/client/js/radio_emulator.js
+++ b/client/js/radio_emulator.js
@@ -294,23 +294,19 @@ function listCallback(json, params)
{
for ( var i = 0; i < json.list.length - 1; i++)
{
+ if( i !== 0) appendPreviouslyPlayedShows(json.list[i-1]);
debugLog("getting there " + i)
debugLog(`${json.list[i].starts_on} < ${values.now_on_sequence} < ${json.list[i+1].starts_on}`);
if ( json.list[i].starts_on < values.now_on_sequence && values.now_on_sequence < json.list[i+1].starts_on )
{
- if( i !== 0)
- {
- appendPreviouslyPlayedShows(json.list[i-1]);
- }
values.now_on_sequence = values.now_on_sequence - json.list[i].starts_on;
debugLog(`now_on_sequence (1updated): ${values.now_on_sequence}`);
FetchJSON(`${jsonRequest}${json.list[i].hash}`, loadShowCallback, [json, values.now_on_sequence, json.list[i], hash_of_list]);
debugLog('First!');
break;
}
- else if ( values.now_on_sequence < json.list[i].starts_on )
+ else if ( values.now_on_sequence > json.list[i].starts_on && values.now_on_sequence > json.list[i].starts_on)
{
- if ( i !== 0 ) appendPreviouslyPlayedShows(json.list[i-1]);
values.now_on_sequence = values.now_on_sequence - json.list[i].starts_on;
FetchJSON(`${jsonRequest}${json.list[i].hash}`, loadShowCallback, [json, values.now_on_sequence, json.list[i], hash_of_list]);
debugLog('Second!');
@@ -318,7 +314,6 @@ function listCallback(json, params)
}
else
{
- // values.now_on_sequence = values.now_on_sequence - json.list[i].starts_on;
debugLog(`We are here: ${i}`);
debugLog(values.now_on_sequence);
debugLog(json.list[i].starts_on);