[vlc-devel] [PATCH] Many patches for using VLC media player Lua's HTTP interface with JSON

Vicente Jiménez googuy at gmail.com
Mon Sep 7 13:50:44 CEST 2009


Many patches for using VLC media player Lua's HTTP interface with JSON.

Initial work.
Mimic more or less:
 - browse.xml
 - vlm.xml
 - vlm_cmd.xml
But with JSON responses.
Missing:
 - playlist.xml
 - status.xml
Obviously, I haven't done playlist.js and status.js because I only use
VLM. Conversion must be straightforward.
If you find this work useful and ask for, I'll be glad to do the JSON
version of those missing.

vlm_cmd.js has been enhanced outputting the response of the command so
vlm.js could be replaced by vlm_cmd.js?command=show.

Why this?
Because is more easy to control remotely a VLC media player from
JavaScript using JSON.

My first approach was to use the traditional HTTP server. Very
dificult to control other representation that is not XML (or markup)
based. I have those JSON versions but they're not completely correct
because I haven't figure a way to remove trailing comas in arrays and
objects.

Second approach, was to create a new Lua's JSON interface much like
Lua's HTTP interface. I've write it, putting all needed functions in
one file. When complexity grows, I realized how good could be to spit
code in several files and load them like Lua's HTTP interfce do. But I
think this could lead to a lot of code rewrite so I adapted the needed
functions to the third approach.

Third approach, adapt all those Lua's function to be used inside the
Lua's HTTP interface. I need mainly JSON responses to requests: A way
to send VLM command (vlm_cmd.js), a way to see the VLM status (vlm.js)
and a JSON version of the directory list (browse.js).

This is the result of this work. Any comment, critic or suggestion are welcome.

vicente
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-JSON-HTTP-request-to-list-a-directory.patch
Type: application/octet-stream
Size: 3124 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090907/7be25282/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Added-jsonify-function-to-convert-VLC-style-Lua-tabl.patch
Type: application/octet-stream
Size: 4717 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090907/7be25282/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-JSON-HTTP-request-to-show-VLM-status.patch
Type: application/octet-stream
Size: 2086 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090907/7be25282/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-JSON-HTTP-request-to-execute-a-VLM-command.patch
Type: application/octet-stream
Size: 2685 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090907/7be25282/attachment-0003.obj>


More information about the vlc-devel mailing list