Can skip to a random track on double click
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
nemunaire 2024-01-14 10:17:03 +01:00
commit 19fa419d89
7 changed files with 83 additions and 0 deletions

View file

@ -24,6 +24,7 @@
<button
class="btn btn-sm btn-primary"
on:click={() => source.nexttrack()}
on:dblclick={() => source.nextrandomtrack()}
>
<i class="bi bi-skip-forward-fill"></i>
</button>

View file

@ -39,6 +39,13 @@ export class Input {
}
}
async nextrandomtrack(idstream) {
const data = await fetch(`api/inputs/${this.id}/streams/${idstream}/next_random_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
if (data.status != 200) {
throw new Error((await res.json()).errmsg);
}
}
async prevtrack(idstream) {
const data = await fetch(`api/inputs/${this.id}/streams/${idstream}/prev_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
if (data.status != 200) {

View file

@ -46,6 +46,13 @@ export class Source {
}
}
async nextrandomtrack() {
const data = await fetch(`api/sources/${this.id}/next_random_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
if (data.status != 200) {
throw new Error((await res.json()).errmsg);
}
}
async prevtrack() {
const data = await fetch(`api/sources/${this.id}/prev_track`, {headers: {'Accept': 'application/json'}, method: 'POST'});
if (data.status != 200) {