LSP: conversion tab

[NOTE: changes *untested* as no Mistcontroller build was available.]
This commit is contained in:
Cat 2013-06-09 11:46:35 +02:00 committed by Thulinma
parent b69997d968
commit 149fe75b1c
4 changed files with 1548 additions and 1322 deletions

View file

@ -23,6 +23,7 @@
<li>protocols</li> <li>protocols</li>
<li>streams</li> <li>streams</li>
<li class='LTSonly'>limits</li> <li class='LTSonly'>limits</li>
<li>conversion</li>
<li>logs</li> <li>logs</li>
<li>server stats</li> <li>server stats</li>
<li id='logoutbutton'>disconnect</li> <li id='logoutbutton'>disconnect</li>

View file

@ -157,7 +157,8 @@
{ {
"streams": {}, "streams": {},
"capabilities": {}, "capabilities": {},
"statistics": {} "statistics": {},
"conversion": {}
}, d); }, d);
//IE breaks if the console isn't opened, so keep commented when committing //IE breaks if the console isn't opened, so keep commented when committing
@ -393,7 +394,8 @@
"streams": {}, "streams": {},
"capabilities": {}, "capabilities": {},
"log": {}, "log": {},
"statistics": {} "statistics": {},
"conversion": {}
}, d) }, d)
if (settings.settings.LTS == 1) { if (settings.settings.LTS == 1) {
$('.LTSonly').show(); $('.LTSonly').show();
@ -723,6 +725,23 @@ function buildLogsTable(){
return $table; return $table;
} }
/**
* At the conversion page, does a directory query to obtain input files
@params: - query: the directory query
*/
function conversionDirQuery(query) {
getData(function(data){
var c = data.conversion.arrayoffilenamesreturnedbyquery
//todo change this ^
for (var i in c) {
$('#conv-edit-input').append(
$('<option>').value(c[i])
);
}
});
}
/** /**
* Tooltip creator - creates a tooltip near the cursor * Tooltip creator - creates a tooltip near the cursor
@params: - position: the object returned by the hover or click event @params: - position: the object returned by the hover or click event

View file

@ -1,12 +1,12 @@
/** /**
* Local settings page * Local settings page
* DDVTECH * DDVTECH
* for more information, see http://mistserver.org/index.php?title=Stand-alone_Configuration_Page * for more information, see http://mistserver.org/index.php?title=Stand-alone_Configuration_Page
*/ */
/** /**
* Store a local copy of the data send by the server. * Store a local copy of the data send by the server.
* server is the URL, credentials hold the username, password and authstring and settings is the local copy. * server is the URL, credentials hold the username, password and authstring and settings is the local copy.
*/ */
@ -23,7 +23,7 @@
}; };
/** /**
* Table for long/short limit names * Table for long/short limit names
*/ */
var ltypes = var ltypes =
@ -42,7 +42,7 @@
/* /*
/** /**
* When the page loads, fix the menu and show the correct tab * When the page loads, fix the menu and show the correct tab
*/ */
$(document).ready(function() $(document).ready(function()
@ -87,7 +87,7 @@
// used on the overview page to decide then to ask the controller for an update check // used on the overview page to decide then to ask the controller for an update check
var updatelastchecked; var updatelastchecked;
/** /**
* Display a certain page. It contains a (giant) switch-statement, that builds a page depending on the tab requested * Display a certain page. It contains a (giant) switch-statement, that builds a page depending on the tab requested
* @param name the name of the tab * @param name the name of the tab
* @param streamname only used when editing streams or protocols, the name of the edited (or new) stream/protocol. Also used with the 'embed' tab * @param streamname only used when editing streams or protocols, the name of the edited (or new) stream/protocol. Also used with the 'embed' tab
@ -337,7 +337,8 @@
tr.append( $('<td>').text( protocol.connector ) ); tr.append( $('<td>').text( protocol.connector ) );
tr.append( $('<td>').html( formatStatus( protocol.online ) ) ); //tr.append( $('<td>').html( formatStatus( protocol.online ) ) );
tr.append( $('<td>').html(formatStatus()));
s = ""; s = "";
for (option in protocol) for (option in protocol)
@ -780,6 +781,7 @@
$tr.append( $('<td>').text( cstr.name ) ); $tr.append( $('<td>').text( cstr.name ) );
/*
if (cstr.error) if (cstr.error)
{ {
$tr.append( $('<td>').html( formatStatus( cstr.online, cstr.error ) ) ); $tr.append( $('<td>').html( formatStatus( cstr.online, cstr.error ) ) );
@ -787,7 +789,8 @@
else else
{ {
$tr.append( $('<td>').html( formatStatus( cstr.online ) ) ); $tr.append( $('<td>').html( formatStatus( cstr.online ) ) );
} }*/
$tr.append( $('<td>').html( formatStatus() ) );
var cviewers = 0; var cviewers = 0;
@ -1194,6 +1197,208 @@
break; break;
case 'conversion':
var convs = settings.settings.conversion;
$('#page').append(
$('<p>').text('Current conversions:')
);
if ((convs.convert) && (convs.convert.length() > 0)) {
var tb = $('<tbody>');
for (var i in convs.convert) {
var c = convs.convert[i];
var tr = $('<tr>').data('convertindex',i);
tr.append(
$('<td>').text(c.input)
).append(
$('<td>').text(c.output)
).append(
$('<td>').text(c.encoder)
);
var txt = 'No video';
if (c.video) {
if (c.video.codec) {
txt = 'codec: '+c.video.codec;
}
else {
txt = 'codec: current';
}
if (c.video.fpks) {
//is it 1000 frames per sec or frames per 1000 sec?
txt = txt+', fps: '+c.video.fpks+'000';
}
else {
txt = txt+', fps: default';
}
if (c.video.width) {
txt = txt+', size: '+c.video.width+' by '+c.video.height+'px';
}
else {
txt = txt+', size: current';
}
}
tr.append(
$('<td>').text(txt)
);
var txt = 'No audio';
if (c.audio) {
if (c.audio.codec) {
txt = 'codec: '+c.audio.codec;
}
else {
txt = 'codec: current';
}
if (c.audio.samplerate) {
txt = txt+', samplerate: '+c.audio.samplerate;
}
else {
txt = txt+', samplerate: default';
}
}
tr.append(
$('<td>').text(txt)
);
tb.append(tr);
}
$('<table>').append(
$('<thead>').append(
$('<tr>').append(
$('<th>').text('Input file')
).append(
$('<th>').text('Output file')
).append(
$('<th>').text('Encoder')
).append(
$('<th>').text('Video')
).append(
$('<th>').text('Audio')
)
)
).append(tb);
}
else {
$('#page').append(
$('<p>').text('None.')
);
}
$('#page').append(
$('<button>').text('Add').click(function(){
loadSettings(function(){
showTab('addconversion','new');
});
})
).append(
' '
).append(
$('<button>').text('Clear all').click(function(){
if(confirmDelete('Are you sure you want to clear all conversions?') == true) {
convs.clear = true;
loadSettings();
}
})
);
break;
case 'addconversion':
var c = settings.settings.conversion;
$('#page').append(
$('<label>').attr('for', 'conv-edit-query').text('Directory').append(
$('<input>').attr('type', 'text').attr('id', 'conv-edit-query').attr('value','./')
)
).append(
$('<button>').text('search for input files').click(function(){
conversionDirQuery($('#conv-edit-query').value);
})
).append(
$('<div>').attr('id', 'editconversion')
);
$('#editconversion').append(
$('<label>').attr('for', 'conv-edit-input').text('Input file').append(
$('<select>').attr('id', 'conv-edit-input').width(237).change(function(){
//get the input filename, remove the extension, add the dtsc extension
var filename = $(this).value().split();
filename.pop();
filename = filename.join('.');
filename += '.dtsc';
$('#conv-edit-output').text(filename);
})
)
).append(
$('<label>').attr('for', 'conv-edit-output').text('Output file').append(
$('<input>').attr('type', 'text').attr('id', 'conv-edit-output')
)
).append(
$('<label>').attr('for', 'conv-edit-encoder').text('Encoder').append(
$('<select>').attr('id', 'conv-edit-encoder').width(237)
)
).append(
$('<label>').attr('for', 'conv-edit-video-codec').text('Video codec').append(
$('<select>').attr('id', 'conv-edit-video-codec').width(237)
)
).append(
$('<label>').attr('for', 'conv-edit-video-fps').text('Video fps').append(
$('<input>').attr('type', 'text').attr('placeholder', 'default').attr('id', 'conv-edit-video-fps')
)
).append(
$('<label>').attr('for', 'conv-edit-video-fps').text('Video size').append(
$('<input>').attr('type', 'text').attr('placeholder', 'width').attr('id', 'conv-edit-video-width').width(100)
).append(
$('<span>').text('x').width(13).css('text-align','center')
).append(
$('<input>').attr('type', 'text').attr('placeholder', 'height').attr('id', 'conv-edit-video-height').width(100)
)
).append(
$('<label>').attr('for', 'conv-edit-audio-codec').text('Audio codec').append(
$('<select>').attr('id', 'conv-edit-audio-codec').width(237)
)
).append(
$('<label>').attr('for', 'conv-edit-audio-samplerate').text('Audio samplerate').append(
$('<input>').attr('type', 'text').attr('placeholder', 'default').attr('id', 'conv-edit-audio-samplerate')
)
);
conversionDirQuery(c.query);
for (var i in c.encoders) {
$('#conv-edit-encoder').append(
$('<option>').value(c.encoders[i])
);
}
//todo: allowed codecs for video/audio
$('#page').append(
$('<button>').text('Save').click(function(){
var cobj = {}; //he object we will save
cobj.input = $('#conv-edit-input').value();
cobj.output = $('#conv-edit-output').value();
cobj.encoder = $('#conv-edit-encoder').value();
cobj.video.codec = $('#conv-edit-video-codec').value();
cobj.video.fpks = $('#conv-edit-video-fps').value() * 1000; //todo: is this correct?
cobj.video.width = $('#conv-edit-video-width').value();
cobj.video.height = $('#conv-edit-video-height').value();
cobj.audio.codec = $('#conv-edit-audio-codec').value();
cobj.audio.samplerate = $('#conv-edit-audio-samplerate').value();
c.convert.push(cobj);
loadSettings(function(){
showTab('conversion');
});
})
).append(' ').append(
$('<button>').text('Cancel').click(function(){
showTab('conversion');
})
);
break;
case 'logs': case 'logs':
$('#page').append( $('#page').append(
$('<input>').attr('type','checkbox').addClass('logs_refresh') $('<input>').attr('type','checkbox').addClass('logs_refresh')

View file

@ -39,6 +39,7 @@
<li>protocols</li> <li>protocols</li>
<li>streams</li> <li>streams</li>
<li class='LTSonly'>limits</li> <li class='LTSonly'>limits</li>
<li>conversion</li>
<li>logs</li> <li>logs</li>
<li>server stats</li> <li>server stats</li>
<li id='logoutbutton'>disconnect</li> <li id='logoutbutton'>disconnect</li>