| 508 | } |
| 509 | |
| 510 | fl::json WLED::getPlaylistConfig() const { |
| 511 | fl::json playlist = fl::json::object(); |
| 512 | |
| 513 | // Preset IDs |
| 514 | if (!mPlaylistPresets.empty()) { |
| 515 | fl::json ps = fl::json::array(); |
| 516 | for (const auto& preset : mPlaylistPresets) { |
| 517 | ps.push_back(fl::json(static_cast<i64>(preset))); |
| 518 | } |
| 519 | playlist.set("ps", ps); |
| 520 | } |
| 521 | |
| 522 | // Durations |
| 523 | if (!mPlaylistDurations.empty()) { |
| 524 | fl::json dur = fl::json::array(); |
| 525 | for (const auto& duration : mPlaylistDurations) { |
| 526 | dur.push_back(fl::json(static_cast<i64>(duration))); |
| 527 | } |
| 528 | playlist.set("dur", dur); |
| 529 | } |
| 530 | |
| 531 | // Transitions |
| 532 | if (!mPlaylistTransitions.empty()) { |
| 533 | fl::json trans = fl::json::array(); |
| 534 | for (const auto& transition : mPlaylistTransitions) { |
| 535 | trans.push_back(fl::json(static_cast<i64>(transition))); |
| 536 | } |
| 537 | playlist.set("transition", trans); |
| 538 | } |
| 539 | |
| 540 | // Other properties |
| 541 | playlist.set("repeat", static_cast<i64>(mPlaylistRepeat)); |
| 542 | playlist.set("end", static_cast<i64>(mPlaylistEnd)); |
| 543 | playlist.set("r", mPlaylistRandomize); |
| 544 | |
| 545 | return playlist; |
| 546 | } |
| 547 | |
| 548 | const WLEDSegment* WLED::findSegmentById(u8 id) const { |
| 549 | for (const auto& seg : mSegments) { |