added random playlist example in json-api.md#276
added random playlist example in json-api.md#276
Conversation
added random playlist example
WalkthroughDocumentation update adds a new JSON example in the Playlists section demonstrating configuration of an endless playlist with preset 12. The example shows random effect, random palette selection, and segment brightness settings for the preset payload. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/interfaces/json-api.md (1)
350-355: 💤 Low valueFormat the JSON example for readability/correct copy-paste.
The
"12"preset object (and nested"seg"fields) is currently very dense on one line, which increases the risk of accidental edits when users copy it (missing commas/quotes/brackets, etc.). Consider re-indenting the JSON to match the style used in earlier examples in this file.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/interfaces/json-api.md` around lines 350 - 355, Reformat the JSON example so the preset objects (especially the "12" preset and its nested "seg" array) are pretty-printed with proper indentation and line breaks like the earlier examples; expand the single-line object for "12" into multiple lines for each key (bri, mainseg, on, seg, transition, n) and likewise format the seg object fields (bri, c1/c2/c3, cct, col, frz, fx, grp, id, ix, m12, mi, o1/o2/o3, of, on, pal, rev, sel, set, si, spc, start, stop, sx, fxdef) so commas, brackets and quotes are clear and the "9" -> "playlist" structure remains readable for safe copy/paste.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/interfaces/json-api.md`:
- Around line 348-356: The example uses top-level numeric keys "9" (playlist
object with "playlist":{...}) and "12" (preset/preset segment under
"seg":{...}); add one short clarifying sentence below the JSON explaining that
those numeric keys are resource IDs (playlist ID 9 and preset ID 12), that
POSTing this payload to /json/cfg will persist/save both the playlist and
preset, and that to apply a playlist immediately you would instead POST an
appropriate state update to /json/state (or use the "playlist" command) —
reference the "9" playlist and "12" preset in the sentence so readers know which
parts are persisted vs applied.
- Around line 348-356: The sample playlist JSON includes an undocumented "r"
field inside the playlist object (the object keyed as "9" with
"playlist":{...}); either remove that "r" property from the example to match the
documented Playlist schema (which lists only ps, dur, transition, repeat, end),
or update the Playlist table above to add a clear entry for "r" (explaining its
type and semantics for playlists). Modify the sample under the
"AllRandomPlaylist" example or the Playlist object documentation accordingly so
the schema and example are consistent.
---
Nitpick comments:
In `@docs/interfaces/json-api.md`:
- Around line 350-355: Reformat the JSON example so the preset objects
(especially the "12" preset and its nested "seg" array) are pretty-printed with
proper indentation and line breaks like the earlier examples; expand the
single-line object for "12" into multiple lines for each key (bri, mainseg, on,
seg, transition, n) and likewise format the seg object fields (bri, c1/c2/c3,
cct, col, frz, fx, grp, id, ix, m12, mi, o1/o2/o3, of, on, pal, rev, sel, set,
si, spc, start, stop, sx, fxdef) so commas, brackets and quotes are clear and
the "9" -> "playlist" structure remains readable for safe copy/paste.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e7383106-b1af-4603-abdb-28b78eb0982d
📒 Files selected for processing (1)
docs/interfaces/json-api.md
| Sample playlist for an endless cycle of random effects with random colors and random palettes: | ||
|
|
||
| ```json | ||
| { | ||
| "9":{"playlist":{"ps":[12],"dur":[600],"transition":[30],"repeat":0,"r":false,"end":0},"on":true,"n":"AllRandomPlaylist"}, | ||
|
|
||
| "12":{"bri":255,"mainseg":0,"on":true,"seg":[{"bri":255,"c1":128,"c2":128,"c3":16,"cct":127,"col":["r",[0,0,0], "r"],"frz":false,"fx":"r","grp":1,"id":0,"ix":128,"m12":1,"mi":false,"o1":false,"o2":false,"o3":false,"of":0,"on":true,"pal":"r","rev":false,"sel":true,"set":0,"si":0,"spc":0,"start":0,"stop":50,"sx":128 ,"fxdef":true}],"transition":7,"n":"random effect"} | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Clarify what this numeric-key JSON payload is for ("9" playlist + "12" preset), and which endpoint to POST to.
This example uses top-level numeric keys "9" and "12" to define both a playlist and a preset in one payload, which differs from the earlier sample that uses a top-level "playlist": { ... } object. The section doesn’t explain whether this form is meant to:
- apply a playlist immediately, or
- persist/store a playlist and preset configuration (and which endpoint: e.g.,
/json,/json/state,/json/cfg, etc.).
Please add one short sentence under the code block (or adjust the example heading) clarifying the intended usage and endpoint so users don’t copy a payload that does nothing.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/interfaces/json-api.md` around lines 348 - 356, The example uses
top-level numeric keys "9" (playlist object with "playlist":{...}) and "12"
(preset/preset segment under "seg":{...}); add one short clarifying sentence
below the JSON explaining that those numeric keys are resource IDs (playlist ID
9 and preset ID 12), that POSTing this payload to /json/cfg will persist/save
both the playlist and preset, and that to apply a playlist immediately you would
instead POST an appropriate state update to /json/state (or use the "playlist"
command) — reference the "9" playlist and "12" preset in the sentence so readers
know which parts are persisted vs applied.
🧩 Analysis chain
🏁 Script executed:
# First, locate and read the relevant section of the documentation file
head -356 docs/interfaces/json-api.md | tail -50Repository: wled/WLED-Docs
Length of output: 2773
🏁 Script executed:
# Search for playlist-related definitions in the codebase to verify if "r" field exists
rg "\"r\"" -A 2 -B 2 --type-list | head -20Repository: wled/WLED-Docs
Length of output: 448
🏁 Script executed:
# Search for WLED playlist structure definitions
rg -i "playlist.*object\|playlist.*schema" -A 10 -B 2 docs/Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
# Look for any mention of "r" in the context of playlists
rg -i "playlist" docs/interfaces/json-api.md -A 5 -B 5 | grep -i "\"r\""Repository: wled/WLED-Docs
Length of output: 549
🏁 Script executed:
# Search for WLED source code files (likely in a src or similar directory)
find . -name "*.cpp" -o -name "*.h" | grep -i playlist | head -20Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
# Search for playlist struct/class definitions with "r" field
rg -i "struct.*playlist\|class.*playlist" -A 20 | head -100Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
# Search for "r" field in playlist context
rg "repeat.*r\|\"r\".*false" -B 3 -A 3 | head -50Repository: wled/WLED-Docs
Length of output: 40
🏁 Script executed:
# Check if there's a WLED source directory
ls -la | head -20Repository: wled/WLED-Docs
Length of output: 696
🏁 Script executed:
# Search all documentation files for mentions of "r" field in any context
rg -i "\"r\"" docs/ -B 2 -A 2 | head -100Repository: wled/WLED-Docs
Length of output: 2742
🏁 Script executed:
# Search for any other references to playlist structure or examples
rg -i "playlist" docs/ -lRepository: wled/WLED-Docs
Length of output: 219
🏁 Script executed:
# Look for any API documentation or JSON schema files
find docs/ -name "*api*" -o -name "*schema*" -o -name "*json*"Repository: wled/WLED-Docs
Length of output: 1022
🏁 Script executed:
# Check the main json-api.md file for any notes or footnotes about the "r" field
grep -n "r\|repeat" docs/interfaces/json-api.md | head -30Repository: wled/WLED-Docs
Length of output: 2159
Remove or document the playlist.r field in the example.
The example includes "r": false inside the playlist object, but the Playlist object table above lists only ps, dur, transition, repeat, and end as valid fields. The documented uses of "r" elsewhere in this file (for segment properties like col, fx, and pal) indicate random values at the segment level, not the playlist level. Either document what r means for playlists in the table, or remove it from the example to align with the documented schema.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/interfaces/json-api.md` around lines 348 - 356, The sample playlist JSON
includes an undocumented "r" field inside the playlist object (the object keyed
as "9" with "playlist":{...}); either remove that "r" property from the example
to match the documented Playlist schema (which lists only ps, dur, transition,
repeat, end), or update the Playlist table above to add a clear entry for "r"
(explaining its type and semantics for playlists). Modify the sample under the
"AllRandomPlaylist" example or the Playlist object documentation accordingly so
the schema and example are consistent.
added random playlist example
Summary by CodeRabbit