Commit 43055c96 authored by Antoine Cellerier's avatar Antoine Cellerier

Change input item options handling in the lua http interface. Fixes normal...

Change input item options handling in the lua http interface. Fixes normal playlist mode option handling. The VLM part most likely needs to be fixed.
parent 4845f3da
......@@ -32,14 +32,23 @@ This dialog needs the following dialogs to be fully functional: browse
<img class="close" src="images/white_cross_small.png" alt="Close" onclick="hide('input');"/>
</div>
<div class="controls">
<label for="input_mrl">Input (MRL)</label>
<label for="input_mrl">Input</label>
<?vlc if current_page == "vlm" then ?>
<input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_input_change();"/>
<?vlc else ?>
<input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) in_play();"/>
<?vlc end ?>
<div>
Options
<!-- <input type="button" value="Refresh options" onclick="refresh_input_options_list();" /> -->
<input type="button" value="Add option" onclick="add_input_option(':option=value');" />
<div id="input_options_list"></div>
</div>
<?vlc if current_page == "vlm" then ?>
<input type="button" value="Ok" onclick="vlm_input_change();" />
<input type="button" value="Cancel" onclick="hide('input');" />
<input type="hidden" id="input_dest" value="" />
<?vlc else ?>
<input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) in_play();"/>
<input type="button" value="Play" onclick="in_play();" />
<input type="button" value="Enqueue" onclick="in_enqueue();" />
<?vlc end ?>
......
......@@ -33,15 +33,15 @@ Note that the sout chain is used and sent to VLC by the input dialog
<img class="close" src="images/white_cross_small.png" alt="Close" onclick="hide('sout');"/>
</div>
<div class="controls">
<label for="sout_mrl">Destination (MRL)</label>
<label for="sout_mrl">Destination</label>
<?vlc if current_page == "vlm" then ?>
<input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_output_change();"/>
<input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_output_change();" disabled="disabled" />
<br/>
<input type="button" value="Ok" onclick="vlm_output_change();" />
<input type="button" value="Cancel" onclick="hide('sout');" />
<input type="hidden" id="sout_dest" />
<?vlc else ?>
<input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) save_sout();" />
<input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) save_sout();" disabled="disabled" />
<br/>
<input type="button" value="Save" onclick="save_sout();" />
<?vlc end ?>
......
......@@ -13,17 +13,17 @@
<script type="text/javascript">
// <![CDATA[
host = document.location.toString().replace( /http:\/\//, '' ).replace( /[:/].*/, '' );
input_options.push( ":sout=#transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv}" );
input_options.push( ":no-sout-keep" );
// ]]>
</script>
</head>
<body onload="hide('playlist');">
<body onload="hide('playlist'); refresh_input_options_list();">
<?vlc
current_page = "index"
dialogs("browse","main","input","playlist") ?>
<input id="sout_mrl" type="hidden" value=":sout=#transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv} :no-sout-keep" />
<div style='height: 100%; width: 100%; text-align: center;'>
<object type="application/x-shockwave-flash" data="http://flowplayer.sourceforge.net/video/FlowPlayer.swf" width="800px" height="600px" id="FlowPlayer" style="z-index: 0">
<param name="allowScriptAccess" value="sameDomain" />
......
This diff is collapsed.
......@@ -30,8 +30,12 @@ local input = _GET['input']
local command = _GET['command']
local id = tonumber(_GET['id'] or -1)
local val = _GET['val']
local options = _GET['option']
if type(options) ~= "table" then -- Deal with the 0 or 1 option case
options = { options }
end
--vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))
---[[]] vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))
local function stripslashes(s)
return string.gsub(s,"\\(%.)","%1")
......@@ -40,13 +44,16 @@ end
local status = vlc.playlist.status()
if command == "in_play" then
local options = {}
for o in string.gmatch(input," :[^ ]*") do -- FIXME: options should be in seperate variables, not in the same string as the input.
table.insert(options,string.sub(o,3))
---[[
vlc.msg.err( "<options>" )
for a,b in ipairs(options) do
vlc.msg.err(b)
end
vlc.msg.err( "</options>" )
--]]
vlc.playlist.add({{path=stripslashes(input),options=options}})
elseif command == "in_enqueue" then
vlc.playlist.enqueue(stripslashes(input))
vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
elseif command == "pl_play" then
vlc.playlist.goto(id)
elseif command == "pl_pause" then
......
......@@ -35,7 +35,7 @@ require "httpd"
require "acl"
require "common"
vlc.msg.err("Lua HTTP interface")
vlc.msg.info("Lua HTTP interface")
open_tag = "<?vlc"
close_tag = "?>"
......@@ -175,7 +175,19 @@ function parse_url_request(request)
for k,v in string.gmatch(request,"([^=&]+)=?([^=&]*)") do
local k_ = vlc.decode_uri(k)
local v_ = vlc.decode_uri(v)
t[k_]=v_
if t[k_] ~= nil then
local t2
if type(t[k_]) ~= "table" then
t2 = {}
table.insert(t2,t[k_])
t[k_] = t2
else
t2 = t[k_]
end
table.insert(t2,v_)
else
t[k_] = v_
end
end
return t
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment