diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-10-15 05:06:38 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-10-15 05:06:38 +0300 |
commit | 305ba5ecee65d9d608134a2c4a754acc748f68b2 (patch) | |
tree | 602e597207928a8b492b0d0cc60bcf2834cdbbe0 /client | |
parent | 3ce8cb83dda0029f675f68110177c314a7346f1a (diff) | |
download | arching-kaos-radio-305ba5ecee65d9d608134a2c4a754acc748f68b2.tar.gz arching-kaos-radio-305ba5ecee65d9d608134a2c4a754acc748f68b2.tar.bz2 arching-kaos-radio-305ba5ecee65d9d608134a2c4a754acc748f68b2.zip |
Final fix: wild looping cause untested before
Diffstat (limited to 'client')
-rw-r--r-- | client/js/radio_emulator.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/client/js/radio_emulator.js b/client/js/radio_emulator.js index 2787cba..2388196 100644 --- a/client/js/radio_emulator.js +++ b/client/js/radio_emulator.js @@ -294,10 +294,10 @@ function listCallback(json, params) { for ( var i = 0; i < json.list.length - 1; i++) { - if( i !== 0) appendPreviouslyPlayedShows(json.list[i-1]); + 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 && i < json.list.length - 2) + if ( json.list[i].starts_on < values.now_on_sequence && values.now_on_sequence < json.list[i+1].starts_on ) { values.now_on_sequence = values.now_on_sequence - json.list[i].starts_on; debugLog(`now_on_sequence (1updated): ${values.now_on_sequence}`); @@ -305,10 +305,11 @@ function listCallback(json, params) debugLog('First!'); break; } - else if ( values.now_on_sequence > json.list[i].starts_on && i === json.list.length - 2 ) + else if ( values.now_on_sequence > json.list[i+1].starts_on && i === json.list.length - 2 ) { - 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]); + if( i !== 0 ) appendPreviouslyPlayedShows(json.list[i]); + values.now_on_sequence = values.now_on_sequence - json.list[i+1].starts_on; + FetchJSON(`${jsonRequest}${json.list[i+1].hash}`, loadShowCallback, [json, values.now_on_sequence, json.list[i+1], hash_of_list]); debugLog('Second!'); break; } @@ -319,7 +320,6 @@ function listCallback(json, params) debugLog(json.list[i].starts_on); if (i > 0) debugLog(json.list[i-1].starts_on); debugLog('Nothing!'); - // continue; } } } |