📄 functions.js
字号:
if( type != "cdda" ) { if( subs != '' ) add_input_option( ":sub-track="+subs ); if( audio != '' ) add_input_option( ":audio-track="+audio ); }}/* update the input MRL using data from the input network helper */function update_input_net(){ var mrl = document.getElementById( 'input_mrl' ); var type = radio_value( "input_net_type" ); check_and_replace_int( 'input_net_udp_port', 1234 ); check_and_replace_int( 'input_net_udpmcast_port', 1234 ); mrl.value = ""; if( type == "udp" ) { mrl.value += "udp://"; if( checked( 'input_net_udp_forceipv6' ) ) mrl.value += "[::]"; if( value( 'input_net_udp_port' ) ) mrl.value += ":"+value( 'input_net_udp_port' ); } else if( type == "udpmcast" ) { mrl.value += "udp://@"+value( 'input_net_udpmcast_address'); if( value( 'input_net_udpmcast_port' ) ) mrl.value += ":"+value( 'input_net_udpmcast_port' ); } else if( type == "http" ) { var url = value( 'input_net_http_url' ); if( url.substring(0,7) != "http://" && url.substring(0,8) != "https://" && url.substring(0,6) != "ftp://" && url.substring(0,6) != "mms://" && url.substring(0,7) != "mmsh://" ) mrl.value += "http://"; mrl.value += url; } else if( type == "rtsp" ) { var url = value( 'input_net_rtsp_url' ); if( url.substring(0,7) != "rtsp://" ) mrl.value += "rtsp://"; mrl.value += url; } remove_input_options( ':access-filter' ); if( checked( "input_net_timeshift" ) ) add_input_option( ":access-filter=timeshift" );}/* update the input MRL using data from the input fake helper */function update_input_fake(){ remove_input_options( ":fake" ); var mrl = document.getElementById( 'input_mrl' ); mrl.value = "fake://"; add_input_option( ":fake-file=" + value( "input_fake_filename" ) ); if( value( "input_fake_width" ) ) add_input_option( ":fake-width=" + value( "input_fake_width" ) ); if( value( "input_fake_height" ) ) add_input_option( ":fake-height=" + value( "input_fake_height" ) ); if( value( "input_fake_ar" ) ) add_input_option( ":fake-ar=" + value( "input_fake_ar" ) );}/********************************************************************** * Sout dialog functions *********************************************************************//* toggle show the full sout interface */function toggle_show_sout_helper(){ var element = document.getElementById( "sout_helper" ); if( element.style.display == 'block' ) { element.style.display = 'none'; document.getElementById( "sout_helper_toggle" ).value = 'Full sout interface'; } else { element.style.display = 'block'; document.getElementById( "sout_helper_toggle" ).value = 'Hide sout interface'; }}/* update the sout MRL using data from the sout_helper */function update_sout(){ var option = ""; /* 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_mmsh_port', 8080 ); check_and_replace_int( 'sout_rtp_port', 1234 ); check_and_replace_int( 'sout_udp_port', 1234 ); check_and_replace_int( 'sout_ttl', 1 ); if( checked( 'sout_soverlay' ) ) { disable( 'sout_scodec' ); disable( 'sout_sub' ); } else { enable( 'sout_scodec' ); enable( 'sout_sub' ); } var transcode = checked( 'sout_vcodec_s' ) || checked( 'sout_acodec_s' ) || checked( 'sout_sub' ) || checked( 'sout_soverlay' ); if( transcode ) { option = ":sout=#transcode{"; var alot = false; /* alot == at least one transcode */ if( checked( 'sout_vcodec_s' ) ) { option += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' ); alot = true; } if( checked( 'sout_acodec_s' ) ) { if( alot ) option += ","; option += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' ); if( value( 'sout_channels' ) ) option += ",channels="+value( 'sout_channels' ); alot = true; } if( checked( 'sout_soverlay' ) ) { if( alot ) option += ","; option += "soverlay"; alot = true; } else if( checked( 'sout_sub' ) ) { if( alot ) option += ","; option += "scodec="+value( 'sout_scodec' ); alot = true; } option += value( 'sout_transcode_extra' ); option += "}"; } var output = checked( 'sout_display' ) + checked( 'sout_file' ) + checked( 'sout_http' ) + checked( 'sout_mmsh' ) + checked( 'sout_rtp' ) + checked( 'sout_udp' ); if( output ) { if( transcode ) option += ":"; else option += ":sout=#"; var aloo = false; /* aloo == at least one output */ var mux = radio_value( 'sout_mux' ); var ttl = parseInt( value( 'sout_ttl' ) ); if( output > 1 ) option += "duplicate{"; if( checked( 'sout_display' ) ) { if( output > 1 ) option += "dst=" option += "display"; aloo = true; } if( checked( 'sout_file' ) ) { if( aloo ) option += ","; if( output > 1 ) option += "dst=" option += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}"; aloo = true; } if( checked( 'sout_http' ) ) { if( aloo ) option += ","; if( output > 1 ) option += "dst=" option += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' ); if( value( 'sout_http_port' ) ) option += ":"+value( 'sout_http_port' ); option += "}"; aloo = true; } if( checked( 'sout_mmsh' ) ) { if( aloo ) option += ","; if( output > 1 ) option += "dst=" option += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' ); if( value( 'sout_mmsh_port' ) ) option += ":"+value( 'sout_mmsh_port' ); option += "}"; aloo = true; } if( checked( 'sout_rtp' ) ) { if( aloo ) option += ","; if( output > 1 ) option += "dst=" option += "std{access=rtp"; if( ttl ) option += "{ttl="+ttl+"}"; option += ",mux="+mux+",dst="+value( 'sout_rtp_addr' ); if( value( 'sout_rtp_port' ) ) option += ":"+value( 'sout_rtp_port' ); if( checked( 'sout_sap' ) ) { option += ",sap"; if( value( 'sout_sap_group' ) != '' ) { option += ",group=\""+value( 'sout_sap_group' )+"\""; } option += ",name=\""+value( 'sout_sap_name' )+"\""; } option += "}"; aloo = true; } if( checked( 'sout_udp' ) ) { if( aloo ) option += ","; if( output > 1 ) option += "dst=" option += "std{access=udp"; if( ttl ) option += "{ttl="+ttl+"}"; option += ",mux="+mux+",dst="+value( 'sout_udp_addr' ); if( value('sout_udp_port' ) ) option += ":"+value( 'sout_udp_port' ); if( checked( 'sout_sap' ) ) { option += ",sap"; if( value( 'sout_sap_group' ) != '' ) { option += ",group=\""+value( 'sout_sap_group' )+"\""; } option += ",name=\""+value( 'sout_sap_name' )+"\""; } option += "}"; aloo = true; } if( output > 1 ) option += "}"; } if( option != "" ) input_options.push( option ); if( ( transcode || output ) && checked( '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 */function reset_sout(){ document.getElementById('sout_mrl').value = value('sout_old_mrl');}/* save sout mrl value */function save_sout(){ 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 *********************************************************************//* only browse() should be called directly */function browse( dest ){ document.getElementById( 'browse_dest' ).value = dest; document.getElementById( 'browse_lastdir' ).value; browse_dir( document.getElementById( 'browse_lastdir' ).value ); show( 'browse' );}function browse_dir( dir ){ document.getElementById( 'browse_lastdir' ).value = dir; loadXMLDoc( 'requests/browse.xml?dir='+encodeURIComponent(dir), parse_browse_dir );}function browse_path( p ){ document.getElementById( value( 'browse_dest' ) ).value = p; hide( 'browse' ); document.getElementById( value( 'browse_dest' ) ).focus();}function refresh_albumart( force ){ if( albumart_id != pl_cur_id || force ) { var now = new Date(); var albumart = document.getElementById( 'albumart' ); albumart.src = '/art?timestamp=' + now.getTime(); albumart_id = pl_cur_id; }}/********************************************************************** * Periodically update stuff in the interface *********************************************************************/function loop_refresh_status(){ setTimeout( 'loop_refresh_status()', 1000 ); update_status();}function loop_refresh_playlist(){ /* setTimeout( 'loop_refresh_playlist()', 10000 ); */ update_playlist();}function loop_refresh_albumart(){ setTimeout( 'loop_refresh_albumart()', 1000 ); refresh_albumart( false );}function loop_refresh(){ setTimeout( 'loop_refresh_status()', 1 ); setTimeout( 'loop_refresh_playlist()', 1 ); setTimeout( 'loop_refresh_albumart()', 1 );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -