The second file, is a JSONP adaptation to test the functionality without need to put some infraestructure to avoid Cross Domain Request.
Doing so, I spot some rough points that perhaps could be resolved:
1. I name the files html to take advantages of the VLC parser. Could it be posible to include others extension to the parsed files (like .json or even .jsonp) in the web interface directories.
2. "enabled" and "loop" use "yes" and "no" as values, and in "instances" "seekable" has "0" or "1" as values. This is inconsistent, I think. Pehaps change both to use "true" and "false" as values could be a good idea. This way, the values could be converted to JSON boolean directly.
3. Documentation in HowTo/Building Pages for the HTTP Interface (http://wiki.videolan.org/Documentation: ... _Interface) is not complete. I don't know how much is left but there's no mention to vlm local variable for example. I need to figure out seeing the code.
Hope you consider those changes and the inclusion of those files in the "requests" directory.
vlm.json.html:
Code: Select all
<vlc id="if" param1="0"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< vlm.jsonp.html: VLC media player web interface
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< Copyright (C) 2008 the VideoLAN team
<
< Authors: Vicente Jimenez Aguilar (based on vlm.xml by Antoine Cellerier)
<
< This program is free software; you can redistribute it and/or modify
< it under the terms of the GNU General Public License as published by
< the Free Software Foundation; either version 2 of the License, or
< (at your option) any later version.
<
< This program is distributed in the hope that it will be useful,
< but WITHOUT ANY WARRANTY; without even the implied warranty of
< MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
< GNU General Public License for more details.
<
< You should have received a copy of the GNU General Public License
< along with this program; if not, write to the Free Software
< Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<vlc id="end"/>
{
<vlc id="foreach" param1="el" param2="vlm" />
<vlc id="if" param1="el.type value 'broadcast' strcmp 0 =" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "broadcast",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"loop": "<vlc id="value" param1="el.loop"/>",
"output": "<vlc id="value" param1="el.output" />",
"inputs": [
<vlc id="foreach" param1="in" param2="el.inputs" />
"<vlc id="value" param1="in" />",
<vlc id="end" />
],
"options": [
<vlc id="foreach" param1="opt" param2="el.options" />
"<vlc id="value" param1="opt" />",
<vlc id="end" />
],
"instances": [
<vlc id="foreach" param1="inst" param2="el.instances" />
{
"name": "<vlc id="value" param1="inst.name"/>",
"state": "<vlc id="value" param1="inst.state"/>",
"position": <vlc id="value" param1="inst.position"/>,
"time": <vlc id="value" param1="inst.time"/>,
"length": <vlc id="value" param1="inst.length"/>,
"rate": <vlc id="value" param1="inst.rate"/>,
"title": "<vlc id="value" param1="inst.title"/>",
"chapter": "<vlc id="value" param1="inst.chapter"/>",
"seekable": "<vlc id="value" param1="inst.seekable"/>",
"playlistindex": <vlc id="value" param1="inst.playlistindex"/>
}
<vlc id="end" />
]
},
<vlc id="else" />
<vlc id="if" param1="el.type value 'vod' strcmp 0 =" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "vod",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"output": "<vlc id="value" param1="el.output" />",
"inputs": [
<vlc id="foreach" param1="in" param2="el.inputs" />
"<vlc id="value" param1="in" />",
<vlc id="end" />
],
"options": [
<vlc id="foreach" param1="opt" param2="el.options" />
"<vlc id="value" param1="opt" />",
<vlc id="end" />
],
"instances": [
<vlc id="foreach" param1="inst" param2="el.instances" />
{
"name": "<vlc id="value" param1="inst.name"/>",
"state": "<vlc id="value" param1="inst.state"/>",
"position": <vlc id="value" param1="inst.position"/>,
"time": <vlc id="value" param1="inst.time"/>,
"length": <vlc id="value" param1="inst.length"/>,
"rate": <vlc id="value" param1="inst.rate"/>,
"title": "<vlc id="value" param1="inst.title"/>",
"chapter": "<vlc id="value" param1="inst.chapter"/>",
"seekable": "<vlc id="value" param1="inst.seekable"/>",
"playlistindex": <vlc id="value" param1="inst.playlistindex"/>
}
<vlc id="end" />
]
},
<vlc id="else" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "schedule",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"date": "<vlc id="value" param1="el.date"/>",
"period": "<vlc id="value" param1="el.period"/>",
"repeat": "<vlc id="value" param1="el.repeat"/>",
"commands": [
<vlc id="foreach" param1="com" param2="el.commands" />
"<vlc id="value" param1="com" />",
<vlc id="end" />
],
},
<vlc id="end" />
<vlc id="end" />
<vlc id="end" />
}
Code: Select all
<vlc id="if" param1="0"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< vlm.json.html: VLC media player web interface
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< Copyright (C) 2008 the VideoLAN team
<
< Authors: Vicente Jimenez Aguilar (based on vlm.xml by Antoine Cellerier)
<
< This program is free software; you can redistribute it and/or modify
< it under the terms of the GNU General Public License as published by
< the Free Software Foundation; either version 2 of the License, or
< (at your option) any later version.
<
< This program is distributed in the hope that it will be useful,
< but WITHOUT ANY WARRANTY; without even the implied warranty of
< MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
< GNU General Public License for more details.
<
< You should have received a copy of the GNU General Public License
< along with this program; if not, write to the Free Software
< Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<vlc id="end"/>
<vlc id="if" param1="url_param 1 =" />
<vlc id="value" param1="; 'jsonp' url_extract" />(
{
<vlc id="foreach" param1="el" param2="vlm" />
<vlc id="if" param1="el.type value 'broadcast' strcmp 0 =" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "broadcast",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"loop": "<vlc id="value" param1="el.loop"/>",
"output": "<vlc id="value" param1="el.output" />",
"inputs": [
<vlc id="foreach" param1="in" param2="el.inputs" />
"<vlc id="value" param1="in" />",
<vlc id="end" />
],
"options": [
<vlc id="foreach" param1="opt" param2="el.options" />
"<vlc id="value" param1="opt" />",
<vlc id="end" />
],
"instances": [
<vlc id="foreach" param1="inst" param2="el.instances" />
{
"name": "<vlc id="value" param1="inst.name"/>",
"state": "<vlc id="value" param1="inst.state"/>",
"position": <vlc id="value" param1="inst.position"/>,
"time": <vlc id="value" param1="inst.time"/>,
"length": <vlc id="value" param1="inst.length"/>,
"rate": <vlc id="value" param1="inst.rate"/>,
"title": "<vlc id="value" param1="inst.title"/>",
"chapter": "<vlc id="value" param1="inst.chapter"/>",
"seekable": "<vlc id="value" param1="inst.seekable"/>",
"playlistindex": <vlc id="value" param1="inst.playlistindex"/>
}
<vlc id="end" />
]
},
<vlc id="else" />
<vlc id="if" param1="el.type value 'vod' strcmp 0 =" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "vod",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"output": "<vlc id="value" param1="el.output" />",
"inputs": [
<vlc id="foreach" param1="in" param2="el.inputs" />
"<vlc id="value" param1="in" />",
<vlc id="end" />
],
"options": [
<vlc id="foreach" param1="opt" param2="el.options" />
"<vlc id="value" param1="opt" />",
<vlc id="end" />
],
"instances": [
<vlc id="foreach" param1="inst" param2="el.instances" />
{
"name": "<vlc id="value" param1="inst.name"/>",
"state": "<vlc id="value" param1="inst.state"/>",
"position": <vlc id="value" param1="inst.position"/>,
"time": <vlc id="value" param1="inst.time"/>,
"length": <vlc id="value" param1="inst.length"/>,
"rate": <vlc id="value" param1="inst.rate"/>,
"title": "<vlc id="value" param1="inst.title"/>",
"chapter": "<vlc id="value" param1="inst.chapter"/>",
"seekable": "<vlc id="value" param1="inst.seekable"/>",
"playlistindex": <vlc id="value" param1="inst.playlistindex"/>
}
<vlc id="end" />
]
},
<vlc id="else" />
"vlmElement<vlc id="value" param1="el.name"/>": {
"type": "schedule",
"name": "<vlc id="value" param1="el.name"/>",
"enabled": "<vlc id="value" param1="el.enabled" />",
"date": "<vlc id="value" param1="el.date"/>",
"period": "<vlc id="value" param1="el.period"/>",
"repeat": "<vlc id="value" param1="el.repeat"/>",
"commands": [
<vlc id="foreach" param1="com" param2="el.commands" />
"<vlc id="value" param1="com" />",
<vlc id="end" />
],
},
<vlc id="end" />
<vlc id="end" />
<vlc id="end" />
})
<vlc id="end" />