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>
...@@ -36,6 +36,8 @@ var albumart_id = -1; ...@@ -36,6 +36,8 @@ var albumart_id = -1;
var slider_mouse_down = 0; var slider_mouse_down = 0;
var slider_dx = 0; var slider_dx = 0;
var input_options = new Array();
/* findPosX() from http://www.quirksmode.rg/js/indpos.html */ /* findPosX() from http://www.quirksmode.rg/js/indpos.html */
function findPosX(obj) function findPosX(obj)
{ {
...@@ -283,23 +285,25 @@ function clear_children( elt ) ...@@ -283,23 +285,25 @@ function clear_children( elt )
* Interface actions * Interface actions
*********************************************************************/ *********************************************************************/
/* input actions */ /* input actions */
function in_play() function in_playenqueue( cmd )
{ {
var input = value('input_mrl'); var input = value('input_mrl');
if( value('sout_mrl') != '' ) var url = 'requests/status.xml?command=in_'+cmd+'&input='+encodeURIComponent( addslashes(escapebackslashes(input)) );
input += ' '+value('sout_mrl'); for( i in input_options )
var url = 'requests/status.xml?command=in_play&input='+encodeURIComponent( addslashes(escapebackslashes(input)) ); if( input_options[i] != ':option=value' )
url += '&option='+encodeURIComponent( addslashes(escapebackslashes(input_options[i]) ));
loadXMLDoc( url, parse_status ); loadXMLDoc( url, parse_status );
setTimeout( 'update_playlist()', 1000 ); setTimeout( 'update_playlist()', 1000 );
} }
function in_play()
{
in_playenqueue( 'play' );
}
function in_enqueue() function in_enqueue()
{ {
var input = value('input_mrl'); in_playenqueue( 'enqueue' );
if( value('sout_mrl') != '' )
input += ' '+value('sout_mrl');
var url = 'requests/status.xml?command=in_enqueue&input='+encodeURIComponent( addslashes(escapebackslashes(input)) );
loadXMLDoc( url, parse_status );
setTimeout( 'update_playlist()', 1000 );
} }
/* playlist actions */ /* playlist actions */
...@@ -771,12 +775,15 @@ function update_input_disc() ...@@ -771,12 +775,15 @@ function update_input_disc()
mrl.value += ":"+chapter; mrl.value += ":"+chapter;
} }
remove_input_options( ':sub-track' );
remove_input_options( ':audio-track' );
if( type != "cdda" ) if( type != "cdda" )
{ {
if( subs != '' ) if( subs != '' )
mrl.value += " :sub-track="+subs; add_input_option( ":sub-track="+subs );
if( audio != '' ) if( audio != '' )
mrl.value += " :audio-track="+audio; add_input_option( ":audio-track="+audio );
} }
} }
...@@ -825,24 +832,27 @@ function update_input_net() ...@@ -825,24 +832,27 @@ function update_input_net()
mrl.value += url; mrl.value += url;
} }
remove_input_options( ':access-filter' );
if( checked( "input_net_timeshift" ) ) if( checked( "input_net_timeshift" ) )
mrl.value += " :access-filter=timeshift"; add_input_option( ":access-filter=timeshift" );
} }
/* update the input MRL using data from the input fake helper */ /* update the input MRL using data from the input fake helper */
function update_input_fake() function update_input_fake()
{ {
remove_input_options( ":fake" );
var mrl = document.getElementById( 'input_mrl' ); var mrl = document.getElementById( 'input_mrl' );
mrl.value = "fake:"; mrl.value = "fake:";
mrl.value += " :fake-file=" + value( "input_fake_filename" );
add_input_option( ":fake-file=" + value( "input_fake_filename" ) );
if( value( "input_fake_width" ) ) if( value( "input_fake_width" ) )
mrl.value += " :fake-width=" + value( "input_fake_width" ); add_input_option( ":fake-width=" + value( "input_fake_width" ) );
if( value( "input_fake_height" ) ) if( value( "input_fake_height" ) )
mrl.value += " :fake-height=" + value( "input_fake_height" ); add_input_option( ":fake-height=" + value( "input_fake_height" ) );
if( value( "input_fake_ar" ) ) if( value( "input_fake_ar" ) )
mrl.value += " :fake-ar=" + value( "input_fake_ar" ); add_input_option( ":fake-ar=" + value( "input_fake_ar" ) );
} }
/********************************************************************** /**********************************************************************
...@@ -867,8 +877,10 @@ function toggle_show_sout_helper() ...@@ -867,8 +877,10 @@ function toggle_show_sout_helper()
/* update the sout MRL using data from the sout_helper */ /* update the sout MRL using data from the sout_helper */
function update_sout() function update_sout()
{ {
var mrl = document.getElementById( 'sout_mrl' ); var option = "";
mrl.value = ""; /* Remove all options starting with :sout since we're going to write them
* again. */
remove_input_options( ":sout" );
check_and_replace_int( 'sout_http_port', 8080 ); check_and_replace_int( 'sout_http_port', 8080 );
check_and_replace_int( 'sout_mmsh_port', 8080 ); check_and_replace_int( 'sout_mmsh_port', 8080 );
...@@ -892,36 +904,37 @@ function update_sout() ...@@ -892,36 +904,37 @@ function update_sout()
if( transcode ) if( transcode )
{ {
mrl.value += ":sout=#transcode{"; option = ":sout=#transcode{";
var alot = false; /* alot == at least one transcode */ var alot = false; /* alot == at least one transcode */
if( checked( 'sout_vcodec_s' ) ) if( checked( 'sout_vcodec_s' ) )
{ {
mrl.value += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' ); option += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' );
alot = true; alot = true;
} }
if( checked( 'sout_acodec_s' ) ) if( checked( 'sout_acodec_s' ) )
{ {
if( alot ) mrl.value += ","; if( alot ) option += ",";
mrl.value += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' ); option += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' );
if( value( 'sout_channels' ) ) if( value( 'sout_channels' ) )
mrl.value += ",channels="+value( 'sout_channels' ); option += ",channels="+value( 'sout_channels' );
alot = true; alot = true;
} }
if( checked( 'sout_soverlay' ) ) if( checked( 'sout_soverlay' ) )
{ {
if( alot ) mrl.value += ","; if( alot ) option += ",";
mrl.value += "soverlay"; option += "soverlay";
alot = true; alot = true;
} }
else if( checked( 'sout_sub' ) ) else if( checked( 'sout_sub' ) )
{ {
if( alot ) mrl.value += ","; if( alot ) option += ",";
mrl.value += "scodec="+value( 'sout_scodec' ); option += "scodec="+value( 'sout_scodec' );
alot = true; alot = true;
} }
mrl.value += value( 'sout_transcode_extra' ); option += value( 'sout_transcode_extra' );
mrl.value += "}"; option += "}";
} }
var output = checked( 'sout_display' ) + checked( 'sout_file' ) var output = checked( 'sout_display' ) + checked( 'sout_file' )
...@@ -931,93 +944,101 @@ function update_sout() ...@@ -931,93 +944,101 @@ function update_sout()
if( output ) if( output )
{ {
if( transcode ) if( transcode )
mrl.value += ":"; option += ":";
else else
mrl.value += ":sout=#"; option += ":sout=#";
var aloo = false; /* aloo == at least one output */ var aloo = false; /* aloo == at least one output */
var mux = radio_value( 'sout_mux' ); var mux = radio_value( 'sout_mux' );
var ttl = parseInt( value( 'sout_ttl' ) ); var ttl = parseInt( value( 'sout_ttl' ) );
if( output > 1 ) mrl.value += "duplicate{"; if( output > 1 ) option += "duplicate{";
if( checked( 'sout_display' ) ) if( checked( 'sout_display' ) )
{ {
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "display"; option += "display";
aloo = true; aloo = true;
} }
if( checked( 'sout_file' ) ) if( checked( 'sout_file' ) )
{ {
if( aloo ) mrl.value += ","; if( aloo ) option += ",";
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}"; option += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}";
aloo = true; aloo = true;
} }
if( checked( 'sout_http' ) ) if( checked( 'sout_http' ) )
{ {
if( aloo ) mrl.value += ","; if( aloo ) option += ",";
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' ); option += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' );
if( value( 'sout_http_port' ) ) if( value( 'sout_http_port' ) )
mrl.value += ":"+value( 'sout_http_port' ); option += ":"+value( 'sout_http_port' );
mrl.value += "}"; option += "}";
aloo = true; aloo = true;
} }
if( checked( 'sout_mmsh' ) ) if( checked( 'sout_mmsh' ) )
{ {
if( aloo ) mrl.value += ","; if( aloo ) option += ",";
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' ); option += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' );
if( value( 'sout_mmsh_port' ) ) if( value( 'sout_mmsh_port' ) )
mrl.value += ":"+value( 'sout_mmsh_port' ); option += ":"+value( 'sout_mmsh_port' );
mrl.value += "}"; option += "}";
aloo = true; aloo = true;
} }
if( checked( 'sout_rtp' ) ) if( checked( 'sout_rtp' ) )
{ {
if( aloo ) mrl.value += ","; if( aloo ) option += ",";
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "std{access=rtp"; option += "std{access=rtp";
if( ttl ) mrl.value += "{ttl="+ttl+"}"; if( ttl ) option += "{ttl="+ttl+"}";
mrl.value += ",mux="+mux+",dst="+value( 'sout_rtp_addr' ); option += ",mux="+mux+",dst="+value( 'sout_rtp_addr' );
if( value( 'sout_rtp_port' ) ) if( value( 'sout_rtp_port' ) )
mrl.value += ":"+value( 'sout_rtp_port' ); option += ":"+value( 'sout_rtp_port' );
if( checked( 'sout_sap' ) ) if( checked( 'sout_sap' ) )
{ {
mrl.value += ",sap"; option += ",sap";
if( value( 'sout_sap_group' ) != '' ) if( value( 'sout_sap_group' ) != '' )
{ {
mrl.value += ",group=\""+value( 'sout_sap_group' )+"\""; option += ",group=\""+value( 'sout_sap_group' )+"\"";
} }
mrl.value += ",name=\""+value( 'sout_sap_name' )+"\""; option += ",name=\""+value( 'sout_sap_name' )+"\"";
} }
mrl.value += "}"; option += "}";
aloo = true; aloo = true;
} }
if( checked( 'sout_udp' ) ) if( checked( 'sout_udp' ) )
{ {
if( aloo ) mrl.value += ","; if( aloo ) option += ",";
if( output > 1 ) mrl.value += "dst=" if( output > 1 ) option += "dst="
mrl.value += "std{access=udp"; option += "std{access=udp";
if( ttl ) mrl.value += "{ttl="+ttl+"}"; if( ttl ) option += "{ttl="+ttl+"}";
mrl.value += ",mux="+mux+",dst="+value( 'sout_udp_addr' ); option += ",mux="+mux+",dst="+value( 'sout_udp_addr' );
if( value('sout_udp_port' ) ) if( value('sout_udp_port' ) )
mrl.value += ":"+value( 'sout_udp_port' ); option += ":"+value( 'sout_udp_port' );
if( checked( 'sout_sap' ) ) if( checked( 'sout_sap' ) )
{ {
mrl.value += ",sap"; option += ",sap";
if( value( 'sout_sap_group' ) != '' ) if( value( 'sout_sap_group' ) != '' )
{ {
mrl.value += ",group=\""+value( 'sout_sap_group' )+"\""; option += ",group=\""+value( 'sout_sap_group' )+"\"";
} }
mrl.value += ",name=\""+value( 'sout_sap_name' )+"\""; option += ",name=\""+value( 'sout_sap_name' )+"\"";
} }
mrl.value += "}"; option += "}";
aloo = true; aloo = true;
} }
if( output > 1 ) mrl.value += "}"; if( output > 1 ) option += "}";
} }
if( option != "" )
input_options.push( option );
if( ( transcode || output ) && checked( 'sout_all' ) ) if( ( transcode || output ) && checked( 'sout_all' ) )
mrl.value += " :sout-all"; input_options.push( ":sout-all" );
/*var mrl = document.getElementById( 'sout_mrl' );
mrl.value = input_options.join( " " )*/
refresh_input_options_list();
} }
/* reset sout mrl value */ /* reset sout mrl value */
...@@ -1032,6 +1053,63 @@ function save_sout() ...@@ -1032,6 +1053,63 @@ function save_sout()
document.getElementById('sout_old_mrl').value = value('sout_mrl'); document.getElementById('sout_old_mrl').value = value('sout_mrl');
} }
function refresh_input_options_list()
{
var iol = document.getElementById( 'input_options_list' );
clear_children( iol );
input_options.sort();
for( i in input_options )
{
var o = document.createElement( 'div' );
var ot = document.createElement( 'input' );
ot.setAttribute( 'type', 'text' );
ot.setAttribute( 'size', '60' );
ot.setAttribute( 'value', input_options[i] );
ot.setAttribute( 'id', 'input_option_item_'+i );
ot.setAttribute( 'onchange', 'javascript:save_input_option('+i+',this.value);' );
ot.setAttribute( 'onfocus', 'if( this.value == ":option=value" ) this.value = ":";' );
ot.setAttribute( 'onblur', 'if( this.value == ":" ) this.value = ":option=value";' );
o.appendChild( ot );
var od = document.createElement( 'a' );
od.setAttribute( 'href', 'javascript:delete_input_option('+i+');' );
var delimg = document.createElement( "img" );
delimg.setAttribute( 'src', 'images/delete_small.png' );
delimg.setAttribute( 'alt', '(delete)' );
od.appendChild( delimg );
o.appendChild( od );
iol.appendChild( o );
}
}
function delete_input_option( i )
{
input_options.splice(i,1);
refresh_input_options_list();
}
function save_input_option( i, value )
{
input_options[i] = value;
refresh_input_options_list();
}
function add_input_option( value )
{
input_options.push( value );
refresh_input_options_list();
}
function remove_input_options( prefix )
{
for( i in input_options )
if( input_options[i].substring( 0, prefix.length ) == prefix )
{
delete input_options[i];
i--;
}
}
/********************************************************************** /**********************************************************************
* Browser dialog functions * Browser dialog functions
*********************************************************************/ *********************************************************************/
......
...@@ -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