diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-27 22:48:34 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-27 22:48:34 +0200 |
| commit | 431bc011072f6ede988f32adcc4b4a85a5f25943 (patch) | |
| tree | 568ed58813185b76dd491e5492c738a181b39974 | |
| parent | eb0b4dc9cc68b92ee27b1da1f02d7296d756d262 (diff) | |
sort onplay
| -rw-r--r-- | public/assets/js/lib/views/stream/hootstream.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/public/assets/js/lib/views/stream/hootstream.js b/public/assets/js/lib/views/stream/hootstream.js index 47a3bd7..1153469 100644 --- a/public/assets/js/lib/views/stream/hootstream.js +++ b/public/assets/js/lib/views/stream/hootstream.js @@ -80,12 +80,15 @@ var HootStream = View.extend({ // $.get(`/api/stream?thread=${thread}`).then((response) => { console.log(response); - audio.index( - response.files - .map((file) => [file.filename.toLowerCase(), file]) - .sort((a, b) => a[0].localeCompare(b[0])) - .map(([, file]) => file) - ); + let sort; + try { + const settings = JSON.parse(response.threads[0].settings); + sort = settings.sort; + } catch (error) { + // console.error(error); + sort = null; + } + audio.index(this.sortFiles(response.files, sort)); audio.play(0); }); }, |
