X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/08af2413287bc5f665b8c337a4be6763600c3dd2..0bc1d67cbb413a23b3cf3dce64be13738739b9d3:/scripts/protocol diff --git a/scripts/protocol b/scripts/protocol index dfdc795..118fda3 100755 --- a/scripts/protocol +++ b/scripts/protocol @@ -44,7 +44,7 @@ sub c_in_decl { return "const char *$name"; } elsif($type eq 'integer') { return "long $name"; - } elsif($type eq 'list') { + } elsif($type eq 'list' or $type eq 'body') { return ("char **$name", "int n$name"); } else { @@ -78,7 +78,7 @@ sub c_param_docs { my $args = shift; my @d = (); for my $arg (@$args) { - if($arg->[0] eq 'list') { + if($arg->[0] eq 'body' or $arg->[0] eq 'list') { push(@d, " * \@param $arg->[1] $arg->[2]\n", " * \@param n$arg->[1] Length of $arg->[1]\n"); @@ -144,10 +144,16 @@ sub simple { if(!defined $return) { my @cargs = (); for my $arg (@$args) { - if($arg->[0] eq 'list') { - push(@cargs, "disorder_body", $arg->[1], "n$arg->[1]"); - } else { + if($arg->[0] eq 'body' or $arg->[0] eq 'list') { + push(@cargs, "disorder_$arg->[0]", $arg->[1], "n$arg->[1]"); + } elsif($arg->[0] eq 'string') { push(@cargs, $arg->[1]); + } elsif($arg->[0] eq 'integer') { + push(@cargs, "buf_$arg->[1]"); + push(@c, " char buf_$arg->[1]\[16];\n", + " byte_snprintf(buf_$arg->[1], sizeof buf_$arg->[1], \"%ld\", $arg->[1]);\n"); + } else { + die "$0: unsupported arg type '$arg->[0]' for '$cmd'\n"; } } push(@c, " return disorder_simple(", @@ -383,9 +389,17 @@ simple("make-cookie", [], ["string", "cookie", "Newly created cookie"]); -# TODO move +simple("move", + "Move a track", + "Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue.", + [["string", "track", "Track ID or name"], + ["integer", "delta", "How far to move the track towards the head of the queue"]]); -# TODO moveafter +simple("moveafter", + "Move multiple tracks", + "Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue.", + [["string", "target", "Move after this track, or to head if \"\""], + ["list", "ids", "List of tracks to move by ID"]]); # TODO new @@ -413,7 +427,11 @@ simple("play", [["string", "track", "Track to play"]], ["string", "id", "Queue ID of new track"]); -# TODO playafter +simple("playafter", + "Play multiple tracks", + "Requires the 'play' right.", + [["string", "target", "Insert into queue after this track, or at head if \"\""], + ["list", "tracks", "List of track names to play"]]); # TODO playing @@ -443,7 +461,7 @@ simple("playlist-set", "Set the contents of a playlist", "Requires the 'play' right and permission to modify the playlist, which must be locked.", [["string", "playlist", "Playlist to modify"], - ["list", "tracks", "New list of tracks for playlist"]]); + ["body", "tracks", "New list of tracks for playlist"]]); simple("playlist-set-share", "Set a playlist's sharing status",