Initial commit: Add ShadowStream media application with file scanning and classification
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
|
||||
This file describes commands available through the requests/ file:
|
||||
|
||||
Lines starting with < describe what the page sends back
|
||||
Lines starting with > describe what you can send to the page
|
||||
|
||||
All parameters need to be URL encoded.
|
||||
Examples:
|
||||
# -> %23
|
||||
% -> %25
|
||||
+ -> %2B
|
||||
space -> +
|
||||
...
|
||||
|
||||
|
||||
Deprecation Notice:
|
||||
---
|
||||
The entire interface is moving to using <MRL> for input and output parameters and attributes
|
||||
pl_play and in_enqueue previously accepted paths. This is still supported, but from 1.3 <MRL> will be required
|
||||
where path attributes are provided in output, these should be ignored in favour of uri attributes
|
||||
path support is scheduled to be removed entirely from 1.3
|
||||
---
|
||||
|
||||
<root> (/)
|
||||
===========
|
||||
|
||||
|
||||
> Get album art for current input:
|
||||
/art (NB: not /requests/art)
|
||||
|
||||
> Get album art for any playlist input (available from API version 3):
|
||||
/art?item=123 (NB: not /requests/art)
|
||||
|
||||
|
||||
status.xml or status.json
|
||||
===========
|
||||
|
||||
|
||||
< Get VLC status information, current item info and meta.
|
||||
< Get VLC version, and http api version
|
||||
|
||||
> add <uri> to playlist and start playback:
|
||||
?command=in_play&input=<uri>&option=<option>
|
||||
the option field is optional, and can have the values:
|
||||
noaudio
|
||||
novideo
|
||||
|
||||
> add <uri> to playlist:
|
||||
?command=in_enqueue&input=<uri>
|
||||
|
||||
> add subtitle to currently playing file
|
||||
?command=addsubtitle&val=<uri>
|
||||
|
||||
> play playlist item <id>. If <id> is omitted, play last active item:
|
||||
?command=pl_play&id=<id>
|
||||
|
||||
> toggle pause. If current state was 'stop', play item <id>, if no <id> specified, play current item. If no current item, play 1st item in the playlist:
|
||||
?command=pl_pause&id=<id>
|
||||
|
||||
> resume playback if paused, else do nothing
|
||||
?command=pl_forceresume
|
||||
|
||||
> pause playback, do nothing if already paused
|
||||
?command=pl_forcepause
|
||||
|
||||
> stop playback:
|
||||
?command=pl_stop
|
||||
|
||||
> jump to next item:
|
||||
?command=pl_next
|
||||
|
||||
> jump to previous item:
|
||||
?command=pl_previous
|
||||
|
||||
> delete item <id> from playlist:
|
||||
?command=pl_delete&id=<id>
|
||||
NOTA BENE: pl_delete is completly UNSUPPORTED
|
||||
|
||||
> empty playlist:
|
||||
?command=pl_empty
|
||||
|
||||
> set audio delay
|
||||
?command=audiodelay&val=<delayinseconds>
|
||||
|
||||
> set subtitle delay
|
||||
?command=subdelay&val=<delayinseconds>
|
||||
|
||||
> set playback rate. must be > 0
|
||||
?command=rate&val=<newplaybackrate>
|
||||
|
||||
> set aspect ratio. Must be one of the following values. Any other value will reset aspect ratio to default
|
||||
?command=aspectratio&val=<newratio>
|
||||
Valid aspect ratio values: 1:1 , 4:3 , 5:4 , 16:9 , 16:10 , 221:100 , 235:100 , 239:100
|
||||
|
||||
> sort playlist using sort mode <val> and order <id>:
|
||||
?command=pl_sort&id=<id>&val=<val>
|
||||
If id=0 then items will be sorted in normal order, if id=1 they will be
|
||||
sorted in reverse order
|
||||
A non exhaustive list of sort modes:
|
||||
0 Id
|
||||
1 Name
|
||||
3 Author
|
||||
5 Random
|
||||
7 Track number
|
||||
|
||||
> toggle random playback:
|
||||
?command=pl_random
|
||||
|
||||
> toggle loop:
|
||||
?command=pl_loop
|
||||
|
||||
> toggle repeat:
|
||||
?command=pl_repeat
|
||||
|
||||
> toggle enable service discovery module <val>:
|
||||
?command=pl_sd&val=<val>
|
||||
Typical values are:
|
||||
sap
|
||||
shoutcast
|
||||
podcast
|
||||
hal
|
||||
|
||||
> toggle fullscreen:
|
||||
?command=fullscreen
|
||||
|
||||
> set volume level to <val> (can be absolute integer, percent or +/- relative value):
|
||||
?command=volume&val=<val>
|
||||
Allowed values are of the form:
|
||||
+<int>, -<int>, <int> or <int>%
|
||||
|
||||
> seek to <val>:
|
||||
?command=seek&val=<val>
|
||||
Allowed values are of the form:
|
||||
[+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">]
|
||||
or [+ or -]<int>%
|
||||
(value between [ ] are optional, value between < > are mandatory)
|
||||
examples:
|
||||
1000 -> seek to the 1000th second
|
||||
+1H:2M -> seek 1 hour and 2 minutes forward
|
||||
-10% -> seek 10% back
|
||||
|
||||
>command=preamp&val=<val in dB>
|
||||
sets the preamp value, must be >=-20 and <=20
|
||||
|
||||
>command=equalizer&band=<band>&val=<gain in dB, must be >=-20 and <=20)
|
||||
set the gain for a specific band
|
||||
|
||||
>command=enableeq&val=<0 or 1>
|
||||
0 -- disables the equalizer
|
||||
1 -- enables the equalizer
|
||||
|
||||
>command=setpreset&val=<presetid>
|
||||
set the equalizer preset as per the id specified
|
||||
|
||||
<Displays the equalizer band gains.
|
||||
Band 0: 60 Hz, 1: 170 Hz, 2: 310 Hz, 3: 600 Hz, 4: 1 kHz,
|
||||
5: 3 kHz, 6: 6 kHz, 7: 12 kHz , 8: 14 kHz , 9: 16 kHz
|
||||
|
||||
<Display the list of presets available for the equalizer
|
||||
|
||||
---
|
||||
Commands available from API version 2
|
||||
---
|
||||
|
||||
> select the title
|
||||
?command=title&val=<val>
|
||||
|
||||
> select the chapter
|
||||
?command=title&val=<val>
|
||||
|
||||
> select the audio track (use the number from the stream)
|
||||
?command=audio_track&val=<val>
|
||||
|
||||
> select the video track (use the number from the stream)
|
||||
?command=video_track&val=<val>
|
||||
|
||||
> select the sibtitle track (use the number from the stream)
|
||||
?command=subtitle_track&val=<val>
|
||||
|
||||
playlist.xml or playlist.json:
|
||||
=============
|
||||
< get the full playlist tree
|
||||
|
||||
NB: playlist_jstree.xml is used for the internal web client. It should not be relied upon by external remotes.
|
||||
It may be removed without notice.
|
||||
|
||||
browse.xml or browse.json:
|
||||
===========
|
||||
|
||||
< ?dir=<uri>
|
||||
> get file list from uri. At the moment, only local file uris are supported
|
||||
|
||||
NB: uri is the preferred parameter. Dir is deprecated and may be removed in a future release.
|
||||
< ?dir=<dir>
|
||||
> get <dir>'s filelist
|
||||
|
||||
vlm.xml:
|
||||
========
|
||||
< get the full list of VLM elements
|
||||
|
||||
vlm_cmd.xml:
|
||||
============
|
||||
< execute VLM command <cmd>
|
||||
?command=<cmd>
|
||||
> get the error message from <cmd>
|
||||
|
@@ -0,0 +1,38 @@
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< status.xml: VLC media player web interface
|
||||
< this should mirror the content and function of status.json
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2009 the VideoLAN team
|
||||
<
|
||||
< Authors: Rob Jonson <rob -at- hobbyistsoftware -dot- com>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
local browseTable=httprequests.getbrowsetable()
|
||||
|
||||
httprequests.printTableAsJson(browseTable)
|
||||
|
||||
|
||||
?>
|
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< browse.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
local browseTable=httprequests.getbrowsetable()
|
||||
|
||||
print('<root>\n')
|
||||
|
||||
--httprequests.printTableAsJson(browseTable.element._array,0)
|
||||
|
||||
|
||||
for i,e in ipairs(browseTable.element._array) do
|
||||
print('\n<element ')
|
||||
|
||||
for k,v in pairs(e) do
|
||||
print(" "..httprequests.xmlString(k).."='"..httprequests.xmlString(v).."'")
|
||||
end
|
||||
|
||||
print('/>')
|
||||
end
|
||||
|
||||
|
||||
print('\n</root>')
|
||||
|
||||
?>
|
||||
|
@@ -0,0 +1,35 @@
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< playlist.json: VLC media player web interface
|
||||
< this should mirror the content of playlist.xml
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Rob Jonson <rob -at- hobbyistsoftware -dot- com>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
httprequests.printTableAsJson(httprequests.playlisttable())
|
||||
|
||||
?>
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< playlist.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
< Authors: Rob Jonson <rob -at- hobbyistsoftware -dot- com>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
local printleaf = function(item)
|
||||
print ("\n<leaf")
|
||||
|
||||
for k,v in pairs(item) do
|
||||
|
||||
if (k~="type") then
|
||||
print(" "..httprequests.xmlString(k).."=\""..httprequests.xmlString(v).."\"")
|
||||
end
|
||||
end
|
||||
|
||||
print ("/>")
|
||||
end
|
||||
|
||||
local printnode = function(item)
|
||||
local children=NULL
|
||||
|
||||
print ("\n<node")
|
||||
|
||||
for k,v in pairs(item) do
|
||||
|
||||
if (k=="type") then
|
||||
|
||||
elseif (k=="children") then
|
||||
children=v._array
|
||||
else
|
||||
print(" "..httprequests.xmlString(k).."=\""..httprequests.xmlString(v).."\"")
|
||||
end
|
||||
end
|
||||
|
||||
print (">")
|
||||
|
||||
return children
|
||||
end
|
||||
|
||||
printitem = function(item)
|
||||
local children=NULL
|
||||
|
||||
if item.type=="node" then
|
||||
children=printnode(item)
|
||||
if (children) then
|
||||
for i,v in ipairs(children) do
|
||||
printitem(v)
|
||||
end
|
||||
end
|
||||
print ("</node>")
|
||||
else
|
||||
printleaf(item)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
local pt=httprequests.playlisttable()
|
||||
|
||||
printitem(pt)
|
||||
|
||||
|
||||
?>
|
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< playlist.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
<
|
||||
< 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.
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
]] ?>
|
||||
<root>
|
||||
<?vlc
|
||||
--[[
|
||||
function a(t,pre)
|
||||
local pre = pre or ""
|
||||
for k,v in pairs(t) do
|
||||
vlc.msg.err(pre..tostring(k).." : "..tostring(v))
|
||||
if type(v) == "table" then
|
||||
a(v,pre.." ")
|
||||
end
|
||||
end
|
||||
end
|
||||
--]]
|
||||
|
||||
function print_playlist(item)
|
||||
if item.flags.disabled then return end
|
||||
if(item.children) then
|
||||
local name = vlc.strings.convert_xml_special_chars(item.name or "")
|
||||
name = name or ""
|
||||
if(name ~= "Undefined") then
|
||||
print('<item id="plid_' ..tostring(item.id).. '" name="' ..tostring(name).. '" ro="' ..(item.flags.ro and "ro" or "rw").. '"><content><name>' ..name.. '</name></content>')
|
||||
for _, child in ipairs(item.children) do
|
||||
print_playlist(child)
|
||||
end
|
||||
print('</item>')
|
||||
else
|
||||
for _, child in ipairs(item.children) do
|
||||
print_playlist(child)
|
||||
end
|
||||
end
|
||||
else
|
||||
local name, path = vlc.strings.convert_xml_special_chars(item.name or "", item.path or "")
|
||||
name = name or ""
|
||||
local current_item_id = vlc.playlist.current()
|
||||
local current = ""
|
||||
-- Is the item the one currently played
|
||||
if(current_item_id ~= nil) then
|
||||
if(current_item_id == item.id) then
|
||||
current = 'current="current"'
|
||||
end
|
||||
end
|
||||
print('<item id="plid_' ..tostring(item.id).. '" uri="' ..tostring(path).. '" name="' ..name.. '" ro="' ..(item.flags.ro and "ro" or "rw").. '" duration ="' ..math.floor(item.duration).. '" ' ..current.. ' ><content><name>' ..name.. '</name></content></item>')
|
||||
end
|
||||
end
|
||||
|
||||
local p
|
||||
if _GET["search"] then
|
||||
if _GET["search"] ~= "" then
|
||||
_G.search_key = _GET["search"]
|
||||
else
|
||||
_G.search_key = nil
|
||||
end
|
||||
local key = vlc.strings.decode_uri(_GET["search"])
|
||||
p = vlc.playlist.search(key)
|
||||
else
|
||||
p = vlc.playlist.get()
|
||||
end
|
||||
--a(p) --Uncomment to debug
|
||||
print_playlist(p)
|
||||
?>
|
||||
</root>
|
@@ -0,0 +1,37 @@
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< status.xml: VLC media player web interface
|
||||
< this should mirror the content and function of status.json
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2009 the VideoLAN team
|
||||
<
|
||||
< Authors: Rob Jonson <rob -at- hobbyistsoftware -dot- com>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
local statusTable=httprequests.getstatus(true)
|
||||
|
||||
httprequests.printTableAsJson(statusTable)
|
||||
|
||||
?>
|
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< status.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2009 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
< Rob Jonson <rob -at- hobbyistsoftware -dot- com>
|
||||
<
|
||||
< 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
|
||||
|
||||
--package.loaded.httprequests = nil --uncomment to debug changes
|
||||
local httprequests = require "httprequests"
|
||||
|
||||
httprequests.processcommands()
|
||||
|
||||
local statusTable=httprequests.getstatus(false)
|
||||
|
||||
print('<root>\n')
|
||||
httprequests.printTableAsXml(statusTable,0)
|
||||
|
||||
local item = vlc.input.item()
|
||||
|
||||
--data in the information section is presented in a non-standard way to keep compatibility.
|
||||
|
||||
?>
|
||||
<information>
|
||||
<category name="meta">
|
||||
<?vlc
|
||||
if item then
|
||||
local metas = item:metas()
|
||||
for k,v in pairs(metas) do
|
||||
local metadataContent = vlc.strings.convert_xml_special_chars( httprequests.xmlString(v) )
|
||||
print("<info name='"..httprequests.xmlString(k).."'>"..metadataContent.."</info>")
|
||||
end
|
||||
end
|
||||
?>
|
||||
</category>
|
||||
<?vlc
|
||||
if item then
|
||||
local info = item:info()
|
||||
for k, v in pairs(info) do
|
||||
print("<category name='"..httprequests.xmlString(k).."'>")
|
||||
for k2, v2 in pairs(v) do
|
||||
print("<info name='"..httprequests.xmlString(k2).."'>"..httprequests.xmlString(v2).."</info>")
|
||||
end
|
||||
print("</category>")
|
||||
end
|
||||
end
|
||||
?>
|
||||
</information>
|
||||
<stats>
|
||||
<?vlc
|
||||
if item then
|
||||
local stats = item:stats()
|
||||
for k,v in pairs(stats) do
|
||||
local tag = string.gsub(k,"_","")
|
||||
print("<"..httprequests.xmlString(tag)..">"..httprequests.xmlString(v).."</"..httprequests.xmlString(tag)..">\n")
|
||||
end
|
||||
end
|
||||
?>
|
||||
</stats>
|
||||
</root>
|
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
vim:syntax=lua
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< vlm.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
<
|
||||
< 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.
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
]]
|
||||
|
||||
local function insert_children(c,t)
|
||||
if c.children then
|
||||
for _, d in ipairs(c.children) do
|
||||
table.insert(t,d.value or d.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function print_table(name,t)
|
||||
print("<"..name.."s>")
|
||||
if #t ~= 0 then
|
||||
for _,v in ipairs(t) do
|
||||
print("<"..name..">")
|
||||
print(vlc.strings.convert_xml_special_chars(v))
|
||||
print("</"..name..">")
|
||||
end
|
||||
end
|
||||
print("</"..name.."s>")
|
||||
end
|
||||
local function print_media(m)
|
||||
local name = m.name
|
||||
local type_, enabled, output
|
||||
local loop = ""
|
||||
local inputs = {}
|
||||
local options = {}
|
||||
local instances = {}
|
||||
for _,c in ipairs(m.children) do
|
||||
if c.name=="type" then
|
||||
type_ = c.value
|
||||
elseif c.name=="enabled" then
|
||||
enabled = c.value
|
||||
elseif c.name=="loop" then
|
||||
loop = c.value
|
||||
elseif c.name=="output" then
|
||||
output = c.value
|
||||
elseif c.name=="inputs" then
|
||||
insert_children(c,inputs)
|
||||
elseif c.name=="options" then
|
||||
insert_children(c,options)
|
||||
elseif c.name=="instances" then
|
||||
if c.children then
|
||||
for _, d in ipairs(c.children) do
|
||||
local instance = "<instance "
|
||||
for _,e in ipairs(d.children) do
|
||||
instance = instance .. vlc.strings.convert_xml_special_chars(e.name) .. "=\"" .. vlc.strings.convert_xml_special_chars(e.value) .. "\" "
|
||||
end
|
||||
instance = instance .. "/>"
|
||||
table.insert(instances,instance)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
print("<"..type_.." name=\""..vlc.strings.convert_xml_special_chars(name).."\" enabled=\""..vlc.strings.convert_xml_special_chars(enabled).."\" loop=\""..vlc.strings.convert_xml_special_chars(loop).."\">\n")
|
||||
print("<output>"..vlc.strings.convert_xml_special_chars(output).."</output>\n")
|
||||
print_table("input",inputs)
|
||||
print_table("option",options)
|
||||
print "<instances>\n"
|
||||
if #instances ~= 0 then
|
||||
print(table.concat(instances))
|
||||
end
|
||||
print "</instances>\n"
|
||||
print("</"..type_..">\n")
|
||||
end
|
||||
|
||||
local function print_schedule(m)
|
||||
local name = m.name
|
||||
local enabled, date, period, repeat_ = "", "", "", ""
|
||||
local commands = {}
|
||||
for _,c in ipairs(m.children) do
|
||||
if c.name=="enabled" then
|
||||
enabled = c.value
|
||||
elseif c.name=="date" then
|
||||
date = c.value
|
||||
elseif c.name=="period" then
|
||||
period = c.value
|
||||
elseif c.name=="repeat" then
|
||||
repeat_ = c.value
|
||||
elseif c.name=="commands" then
|
||||
insert_children(c,commands)
|
||||
end
|
||||
end
|
||||
print("<schedule name=\""..vlc.strings.convert_xml_special_chars(name).."\" enabled=\""..vlc.strings.convert_xml_special_chars(enabled).."\" period=\""..vlc.strings.convert_xml_special_chars(period).."\" repeat=\""..vlc.strings.convert_xml_special_chars(repeat_).."\">\n")
|
||||
print_table("command",commands)
|
||||
print("</schedule>\n")
|
||||
end
|
||||
|
||||
local function print_xml(m)
|
||||
print "<vlm>"
|
||||
if m then
|
||||
for _, c in ipairs(m.children) do
|
||||
if c.name=="media" and c.children then
|
||||
for _, d in ipairs(c.children) do
|
||||
print_media(d)
|
||||
end
|
||||
elseif c.name=="schedule" and c.children then
|
||||
for _, d in ipairs(c.children) do
|
||||
print_schedule(d)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
print "oops"
|
||||
end
|
||||
print "</vlm>"
|
||||
end
|
||||
|
||||
local function print_msg(m)
|
||||
if not m then return end
|
||||
print("<"..m.name..">\n")
|
||||
if m.children then
|
||||
for _, child in ipairs(m.children) do
|
||||
print_msg(child)
|
||||
end
|
||||
elseif m.value then
|
||||
print(m.value)
|
||||
end
|
||||
print("</"..m.name..">\n")
|
||||
end
|
||||
|
||||
local msg = vlm:execute_command("show")
|
||||
print_xml(msg)
|
||||
--print_msg(msg)
|
||||
|
||||
?>
|
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<?vlc --[[
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< vlm_cmd.xml: VLC media player web interface
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
|
||||
< Copyright (C) 2005-2006 the VideoLAN team
|
||||
<
|
||||
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
|
||||
<
|
||||
< 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.
|
||||
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
]]?>
|
||||
<vlm><error><?vlc
|
||||
if _GET["command"] then
|
||||
local msg = vlm:execute_command(_GET["command"])
|
||||
if msg.value then
|
||||
print(msg.name,":",vlc.strings.convert_xml_special_chars(msg.value))
|
||||
end
|
||||
else
|
||||
?>No command<?vlc
|
||||
end
|
||||
?></error>
|
||||
</vlm>
|
Reference in New Issue
Block a user