fix infinite backspin on "previous track";

when playing the first track in a folder and hitting the previous track
button, it would keep switching through the previous folders inifinitely
This commit is contained in:
ed 2023-11-21 23:23:51 +00:00
parent f3035e8869
commit 6f4bde2111

View file

@ -2243,7 +2243,7 @@ function song_skip(n, dirskip) {
return;
}
if (tid)
if (tid && !dirskip)
play(ofs + n);
else
play(mp.order[n == -1 ? mp.order.length - 1 : 0]);
@ -2276,6 +2276,21 @@ function next_song_cmn(e) {
mpl.traversals = 0;
t_fchg = 0;
}
function last_song(e) {
ev(e);
if (mp.order.length) {
mpl.traversals = 0;
return song_skip(-1, true);
}
if (mpl.traversals++ < 5) {
treectl.ls_cb = last_song;
return tree_neigh(-1);
}
toast.inf(10, L.mm_nof);
console.log("mm_nof2");
mpl.traversals = 0;
t_fchg = 0;
}
function prev_song(e) {
ev(e);
@ -2920,7 +2935,7 @@ function play(tid, is_ev, seek) {
tn = mp.order.length - 1;
}
else if (mpl.pb_mode == 'next') {
treectl.ls_cb = prev_song;
treectl.ls_cb = last_song;
return tree_neigh(-1);
}
}