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 ...@@ -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');"/> <img class="close" src="images/white_cross_small.png" alt="Close" onclick="hide('input');"/>
</div> </div>
<div class="controls"> <div class="controls">
<label for="input_mrl">Input (MRL)</label> <label for="input_mrl">Input</label>
<?vlc if current_page == "vlm" then ?> <?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();"/> <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="Ok" onclick="vlm_input_change();" />
<input type="button" value="Cancel" onclick="hide('input');" /> <input type="button" value="Cancel" onclick="hide('input');" />
<input type="hidden" id="input_dest" value="" /> <input type="hidden" id="input_dest" value="" />
<?vlc else ?> <?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="Play" onclick="in_play();" />
<input type="button" value="Enqueue" onclick="in_enqueue();" /> <input type="button" value="Enqueue" onclick="in_enqueue();" />
<?vlc end ?> <?vlc end ?>
......
...@@ -33,15 +33,15 @@ Note that the sout chain is used and sent to VLC by the input dialog ...@@ -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');"/> <img class="close" src="images/white_cross_small.png" alt="Close" onclick="hide('sout');"/>
</div> </div>
<div class="controls"> <div class="controls">
<label for="sout_mrl">Destination (MRL)</label> <label for="sout_mrl">Destination</label>
<?vlc if current_page == "vlm" then ?> <?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/> <br/>
<input type="button" value="Ok" onclick="vlm_output_change();" /> <input type="button" value="Ok" onclick="vlm_output_change();" />
<input type="button" value="Cancel" onclick="hide('sout');" /> <input type="button" value="Cancel" onclick="hide('sout');" />
<input type="hidden" id="sout_dest" /> <input type="hidden" id="sout_dest" />
<?vlc else ?> <?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/> <br/>
<input type="button" value="Save" onclick="save_sout();" /> <input type="button" value="Save" onclick="save_sout();" />
<?vlc end ?> <?vlc end ?>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>VLC media player - Web Interface with Flash Viewer</title> <title>VLC media player - Web Interface with Flash Viewer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" /> <link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE ]> <!--[if IE ]>
<link href="iehacks.css" rel="stylesheet" type="text/css" /> <link href="iehacks.css" rel="stylesheet" type="text/css" />
<![endif]--> <![endif]-->
<script type="text/javascript" src="js/functions.js"></script> <script type="text/javascript" src="js/functions.js"></script>
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
host = document.location.toString().replace( /http:\/\//, '' ).replace( /[:/].*/, '' ); 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}" );
</script> input_options.push( ":no-sout-keep" );
</head> // ]]>
</script>
<body onload="hide('playlist');"> </head>
<?vlc
current_page = "index" <body onload="hide('playlist'); refresh_input_options_list();">
dialogs("browse","main","input","playlist") ?> <?vlc
current_page = "index"
<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" /> dialogs("browse","main","input","playlist") ?>
<div style='height: 100%; width: 100%; text-align: center;'> <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"> <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" /> <param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://flowplayer.sourceforge.net/video/FlowPlayer.swf" /> <param name="movie" value="http://flowplayer.sourceforge.net/video/FlowPlayer.swf" />
<param name="quality" value="high" /> <param name="quality" value="high" />
<!-- <param name="scale" value="noScale" />--> <!-- <param name="scale" value="noScale" />-->
<param name="wmode" value="transparent" /> <param name="wmode" value="transparent" />
<!-- <param name="flashvars" value="config={ loop: false, initialScale: \'fit\', autoPlay: false, configInject: true}" />--> <!-- <param name="flashvars" value="config={ loop: false, initialScale: \'fit\', autoPlay: false, configInject: true}" />-->
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
document.write( '' + document.write( '' +
' <param name="flashvars" value="config={ loop: false, initialScale: \'fit\', autoPlay: false, playList: [{ url: \'http://' + host + ':8081/stream.flv\', controlEnabled: true}] }" />' ); ' <param name="flashvars" value="config={ loop: false, initialScale: \'fit\', autoPlay: false, playList: [{ url: \'http://' + host + ':8081/stream.flv\', controlEnabled: true}] }" />' );
// ]]> // ]]>
</script> </script>
</object> </object>
<p style="font-size: small;">Uses the <a href="http://flowplayer.sourceforge.net/">Flow Player</a> free flash video player for playback (client side).</p> <p style="font-size: small;">Uses the <a href="http://flowplayer.sourceforge.net/">Flow Player</a> free flash video player for playback (client side).</p>
</div> </div>
<?vlc dialogs("footer") ?> <?vlc dialogs("footer") ?>
</body> </body>
</html> </html>
This diff is collapsed.
...@@ -30,8 +30,12 @@ local input = _GET['input'] ...@@ -30,8 +30,12 @@ local input = _GET['input']
local command = _GET['command'] local command = _GET['command']
local id = tonumber(_GET['id'] or -1) local id = tonumber(_GET['id'] or -1)
local val = _GET['val'] 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) local function stripslashes(s)
return string.gsub(s,"\\(%.)","%1") return string.gsub(s,"\\(%.)","%1")
...@@ -40,13 +44,16 @@ end ...@@ -40,13 +44,16 @@ end
local status = vlc.playlist.status() local status = vlc.playlist.status()
if command == "in_play" then 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. vlc.msg.err( "<options>" )
table.insert(options,string.sub(o,3)) for a,b in ipairs(options) do
vlc.msg.err(b)
end end
vlc.msg.err( "</options>" )
--]]
vlc.playlist.add({{path=stripslashes(input),options=options}}) vlc.playlist.add({{path=stripslashes(input),options=options}})
elseif command == "in_enqueue" then elseif command == "in_enqueue" then
vlc.playlist.enqueue(stripslashes(input)) vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
elseif command == "pl_play" then elseif command == "pl_play" then
vlc.playlist.goto(id) vlc.playlist.goto(id)
elseif command == "pl_pause" then elseif command == "pl_pause" then
......
...@@ -35,7 +35,7 @@ require "httpd" ...@@ -35,7 +35,7 @@ require "httpd"
require "acl" require "acl"
require "common" require "common"
vlc.msg.err("Lua HTTP interface") vlc.msg.info("Lua HTTP interface")
open_tag = "<?vlc" open_tag = "<?vlc"
close_tag = "?>" close_tag = "?>"
...@@ -175,7 +175,19 @@ function parse_url_request(request) ...@@ -175,7 +175,19 @@ function parse_url_request(request)
for k,v in string.gmatch(request,"([^=&]+)=?([^=&]*)") do for k,v in string.gmatch(request,"([^=&]+)=?([^=&]*)") do
local k_ = vlc.decode_uri(k) local k_ = vlc.decode_uri(k)
local v_ = vlc.decode_uri(v) 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 end
return t return t
end 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