Skip to content

Commit fa5f35d

Browse files
committed
Improve playlist generation with more user friendly QuickLoad names and also create playlist for AnimARTrix - if present
1 parent ab89cd5 commit fa5f35d

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

wled00/data/index.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,7 +3210,8 @@ function genPresets()
32103210
var playlistSep = JSON.parse("{}");
32113211
var playlistDur = JSON.parse("{}");
32123212
var playlistTrans = JSON.parse("{}");
3213-
function addToPlaylist(m, id) {
3213+
var playlistQL = JSON.parse("{}");
3214+
function addToPlaylist(m, id, ql = undefined) {
32143215
if (!playlistPS[m]) playlistPS[m] = "";
32153216
if (!playlistDur[m]) playlistDur[m] = "";
32163217
if (!playlistTrans[m]) playlistTrans[m] = "";
@@ -3219,6 +3220,7 @@ function genPresets()
32193220
playlistDur[m] += playlistSep[m] + "100";
32203221
playlistTrans[m] += playlistSep[m] + "7";
32213222
playlistSep[m] = ",";
3223+
if(ql) playlistQL[m] = `${ql}`;
32223224
}
32233225
var seq=230; //Playlist start here
32243226
for (let ef of effects) {
@@ -3258,10 +3260,16 @@ function genPresets()
32583260
}
32593261
result += `${sep}"${ef.id}":{"n":"${ef.name}","mainseg":0,"seg":[{"id":0,"fx":${ef.id}${defaultString}}]}`;
32603262
sep = "\n,";
3261-
addToPlaylist(m, ef.id);
3262-
addToPlaylist("All", ef.id);
3263-
if (m.includes("1")) addToPlaylist("All1", ef.id);
3264-
if (m.includes("2")) addToPlaylist("All2", ef.id);
3263+
if(m.length <= 3) {
3264+
addToPlaylist(m, ef.id, m);
3265+
}
3266+
else {
3267+
addToPlaylist(m, ef.id);
3268+
}
3269+
addToPlaylist("All", ef.id, "ALL");
3270+
if(ef.name.startsWith("Y💡")) addToPlaylist("AnimARTrix", ef.id, "AM");
3271+
if (m.includes("1")) addToPlaylist("All 1D", ef.id, "1D");
3272+
if (m.includes("2")) addToPlaylist("All 2D", ef.id, "2D");
32653273

32663274
seq = Math.max(seq, (parseInt(ef.id) + 1));
32673275
} //fxdata is array
@@ -3270,7 +3278,8 @@ function genPresets()
32703278

32713279
// console.log(playlistPS, playlistDur, playlistTrans);
32723280
for (const m in playlistPS) {
3273-
let playListString = `\n,"${seq}":{"n":"${m}D Playlist","ql":"${seq}","on":true,"playlist":{"ps":[${playlistPS[m]}],"dur":[${playlistDur[m]}],"transition":[${playlistTrans[m]}],"repeat":0,"end":0,"r":1}}`;
3281+
if(!playlistQL[m]) playlistQL[m] = seq;
3282+
let playListString = `\n,"${seq}":{"n":"${m} Playlist","ql":"${playlistQL[m]}","on":true,"playlist":{"ps":[${playlistPS[m]}],"dur":[${playlistDur[m]}],"transition":[${playlistTrans[m]}],"repeat":0,"end":0,"r":1}}`;
32743283
// console.log(playListString);
32753284
result += playListString;
32763285
seq++;

0 commit comments

Comments
 (0)