first commit
This commit is contained in:
39
plugin/ffmpeg/templates/ffmpeg_download.html
Executable file
39
plugin/ffmpeg/templates/ffmpeg_download.html
Executable file
@@ -0,0 +1,39 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{{ macros.setting_input_text('url', 'URL', placeholder='http:// 주소', desc='비디오 파일 주소 or m3u8 주소') }}
|
||||
{{ macros.setting_input_text('filename', '파일명', value=arg['temp_filename']) }}
|
||||
{{ macros.setting_button([['download_start', '다운로드']]) }}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var package_name = "{{arg['package_name'] }}";
|
||||
|
||||
$(document).ready(function(){
|
||||
});
|
||||
|
||||
//다운로드시작
|
||||
$("#download_start").click(function(e) {
|
||||
e.preventDefault();
|
||||
if ($("#url").val().startsWith('http') == false) {
|
||||
$.notify('<strong>URL을 입력하세요.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/ffmpeg/ajax/download',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {url: $("#url").val(), filename: $("#filename").val()},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$.notify('<strong>분석중..</strong>', {
|
||||
type: 'info'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
237
plugin/ffmpeg/templates/ffmpeg_list.html
Executable file
237
plugin/ffmpeg/templates/ffmpeg_list.html
Executable file
@@ -0,0 +1,237 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<!--<div class="d-inline-block"></div>-->
|
||||
<!--<div id="accordion">-->
|
||||
<style>
|
||||
.row>div { padding-top: 3px; padding-bottom:3px; }
|
||||
.row { align-items: center; word-break:break-all;}
|
||||
.row>div:nth-child(odd) { align-items: right; text-align: right; }
|
||||
.row>div:nth-child(even) { align-items: left; text-align: left; }
|
||||
</style>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.6/socket.io.js"></script>
|
||||
<table id="result_table" class="table table-sm tableRowHover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:5%">IDX</th>
|
||||
<th style="width:8%">Plugin</th>
|
||||
<th style="width:10%">시작시간</th>
|
||||
<th style="width:20%">파일명</th>
|
||||
<th style="width:8%">상태</th>
|
||||
<th style="width:15%">진행률</th>
|
||||
<th style="width:5%">길이</th>
|
||||
<th style="width:5%">PF</th>
|
||||
<th style="width:8%">배속</th>
|
||||
<th style="width:8%">진행시간</th>
|
||||
<th style="width:8%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="list" >
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
var package_name = 'ffmpeg';
|
||||
var protocol = window.location.protocol;
|
||||
var socket = io.connect(protocol + "//" + document.domain + ":" + location.port + "/" + package_name)
|
||||
//var socket = io.connect("http://" + document.domain + ":" + location.port + "/ffmpeg", {transports:['websocket']}, {'force new connection': true});
|
||||
|
||||
//socket.emit("start");
|
||||
|
||||
|
||||
socket.on('add', function(data){
|
||||
str = make_item(data)
|
||||
document.getElementById("list").innerHTML += str;
|
||||
//document.getElementById("log_"+data.idx).scrollTop = document.getElementById("log_"+data.idx).scrollHeight ;
|
||||
});
|
||||
|
||||
// 화면을 켜놓고, 스케쥴러에 의해 시작될때 add전에 로그가온다.
|
||||
/*
|
||||
socket.on('log', function(data){
|
||||
if (document.getElementById("log_"+data.idx) != null) {
|
||||
document.getElementById("log_"+data.idx).innerHTML += data.line;
|
||||
document.getElementById("log_"+data.idx).scrollTop = document.getElementById("log_"+data.idx).scrollHeight;
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
|
||||
socket.on('status_change', function(data) {
|
||||
button_html(data);
|
||||
});
|
||||
|
||||
socket.on('status', function(data){
|
||||
status_html(data);
|
||||
});
|
||||
|
||||
socket.on('last', function(data){
|
||||
status_html(data);
|
||||
button_html(data);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/list',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
document.getElementById("list").innerHTML = '';
|
||||
str = ''
|
||||
for(i in data) {
|
||||
str += make_item(data[i])
|
||||
}
|
||||
document.getElementById("list").innerHTML = str;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#stop', function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var idx = $(this).data('idx')
|
||||
$.ajax({
|
||||
url: '/ffmpeg/ajax/stop',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{ idx : idx},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#play', function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var idx = $(this).data('idx')
|
||||
$.ajax({
|
||||
url: '/ffmpeg/ajax/play',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{ idx : idx},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if (data.startsWith('/')) {
|
||||
var url = '/open_file' + data;
|
||||
} else {
|
||||
var url = '/open_file/' + data;
|
||||
}
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function make_item(data) {
|
||||
//if (document.getElementById("log_"+data.idx) != null) return;
|
||||
str = '<tr style="cursor: pointer;" data-toggle="collapse" data-target="#collapse_'+ data.idx + '" aria-expanded="true" >';
|
||||
str += '<td scope="col" style="width:5%">'+ data.idx + '</td>';
|
||||
str += '<td scope="col" style="width:8%">'+ data.call_plugin + '</td>';
|
||||
str += '<td scope="col" style="width:10%">'+ data.start_time + '</td>';
|
||||
str += '<td scope="col" style="width:20%">'+ data.filename + '</td>';
|
||||
str += '<td id="status_'+data.idx+'" scope="col" style="width:8%">'+ data.status_kor + '</td>';
|
||||
var visi = 'hidden';
|
||||
if (parseInt(data.percent) > 0) {
|
||||
visi = 'visible';
|
||||
}
|
||||
str += '<td scope="col" style="width:20%"><div class="progress"><div id="progress_'+data.idx+'" class="progress-bar" style="visibility: '+visi+'; width:'+data.percent+'%">'+data.percent +'%</div></div></td>';
|
||||
str += '<td scope="col" style="width:5%">'+ data.duration_str + '</td>';
|
||||
str += '<td id="current_pf_count_'+data.idx+'" scope="col" style="width:5%">'+ data.current_pf_count + '</td>';
|
||||
str += '<td id="current_speed_'+data.idx+'" scope="col" style="width:8%">'+ data.current_speed + '</td>';
|
||||
str += '<td id="download_time_'+data.idx+'" scope="col" style="width:8%">'+ data.download_time + '</td>';
|
||||
str += '<td id="button_'+data.idx+'" scope="col" style="width:8%" class="tableRowHoverOff">';
|
||||
if (data.status_str == 'DOWNLOADING') {
|
||||
str += '<button id="stop" class="align-middle btn btn-outline-danger btn-sm" data-idx="'+data.idx+'">중지</button>';
|
||||
} else if (data.status_str == 'COMPLETED' && data.exist) {
|
||||
str += '<button id="play" class="align-middle btn btn-outline-info btn-sm" data-idx="'+data.idx+'">재생</button>';
|
||||
}
|
||||
str += '</td>'
|
||||
str += '</tr>'
|
||||
str += '<tr class="collapse tableRowHoverOff" style="cursor: pointer;" id="collapse_' + data.idx + '">';
|
||||
str += '<td colspan="11">';
|
||||
str += '<div id="detail_'+data.idx+'">';
|
||||
str += get_detail(data);
|
||||
str += '</div>';
|
||||
/*
|
||||
str += '<div><textarea class="form-control" id="log_'+data.idx+'" rows="20">';
|
||||
for (var i = 0; i < data.log.length; i++) {
|
||||
str += data.log[i] + '\n';
|
||||
}
|
||||
str += '</textarea></div>';
|
||||
*/
|
||||
str += '</td>';
|
||||
str += '</tr>'
|
||||
return str
|
||||
}
|
||||
|
||||
function info_html($left, $right) {
|
||||
var str = '<div class="row">' +
|
||||
'<div class="col-sm-2">' +
|
||||
'<strong>'+ $left +'</strong>' +
|
||||
'</div>' +
|
||||
'<div class="col-sm-10">' +
|
||||
'<div class="input-group col-sm-9">' +
|
||||
'<span class="text-left" style="padding-left:10px; padding-top:3px">';
|
||||
if ($left == 'URL') {
|
||||
str += '<a href="/hls?url=' + $right + '" target="_blank">';
|
||||
}
|
||||
str += $right;
|
||||
if ($left == 'URL') {
|
||||
str += '</a>';
|
||||
}
|
||||
str += '</span>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
return str;
|
||||
}
|
||||
|
||||
function get_detail(data) {
|
||||
var str = info_html('URL', data.url);
|
||||
str += info_html('임시경로', data.temp_fullpath);
|
||||
str += info_html('저장경로', data.save_fullpath);
|
||||
str += info_html('진행률(current/total)', data.percent+ '% (' + data.current_duration + ' / ' + data.duration + ')');
|
||||
str += info_html('현재 비트레이트', data.current_bitrate);
|
||||
str += info_html('종료시간', data.end_time);
|
||||
str += info_html('허용 Packet Fail 수', data.max_pf_count);
|
||||
str += info_html('파일 Exist', data.exist);
|
||||
if (data.status_str == 'COMPLETED') {
|
||||
str += info_html('파일 크기', data.filesize_str);
|
||||
str += info_html('다운 속도', data.download_speed);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function button_html(data) {
|
||||
if (data.status_str == 'DOWNLOADING') {
|
||||
document.getElementById("button_" + data.idx).innerHTML =
|
||||
'<button id="stop" class="align-middle btn btn-outline-danger btn-sm" data-idx="'+data.idx+'">중지</button>';
|
||||
} else if (data.status_str == 'COMPLETED' && data.exist) {
|
||||
document.getElementById("button_" + data.idx).innerHTML = '<button id="play" class="align-middle btn btn-outline-info btn-sm" data-idx="'+data.idx+'">재생</button>';
|
||||
} else {
|
||||
document.getElementById("button_" + data.idx).innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
function status_html(data) {
|
||||
var progress = document.getElementById("progress_" + data.idx);
|
||||
progress.style.width = data.percent+ '%';
|
||||
progress.innerHTML = data.percent+ '%';
|
||||
progress.style.visibility = 'visible';
|
||||
document.getElementById("status_" + data.idx).innerHTML = data.status_kor;
|
||||
document.getElementById("current_pf_count_" + data.idx).innerHTML = data.current_pf_count;
|
||||
document.getElementById("current_speed_" + data.idx).innerHTML = data.current_speed;
|
||||
document.getElementById("download_time_" + data.idx).innerHTML = data.download_time;
|
||||
//document.getElementById("log").innerHTML += str + '\r\n';
|
||||
document.getElementById("detail_" + data.idx).innerHTML = get_detail(data);
|
||||
}
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
79
plugin/ffmpeg/templates/ffmpeg_setting.html
Executable file
79
plugin/ffmpeg/templates/ffmpeg_setting.html
Executable file
@@ -0,0 +1,79 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{{ macros.m_button_group([['global_setting_save_btn', '설정 저장']])}}
|
||||
{{ macros.m_row_start('5') }}
|
||||
{{ macros.m_row_end() }}
|
||||
<nav>
|
||||
{{ macros.m_tab_head_start() }}
|
||||
{{ macros.m_tab_head2('normal', '기본', true) }}
|
||||
{{ macros.m_tab_head_end() }}
|
||||
</nav >
|
||||
<form id='setting' name='setting'>
|
||||
<div class="tab-content" id="nav-tabContent">
|
||||
{{ macros.m_tab_content_start('normal', true) }}
|
||||
{{ macros.setting_input_text_and_buttons('ffmpeg_path', 'FFMPEG 경로', [['ffmpeg_version', '버전확인'], ['select_binary_path_btn', '파일 선택']], value=arg['ffmpeg_path']) }}
|
||||
{{ macros.setting_input_text_and_buttons('temp_path', '임시 폴더', [['select_temp_path_btn', '경로 선택']], value=arg['temp_path'], desc=['다운로드 파일이 임시로 저장될 폴더 입니다.']) }}
|
||||
|
||||
{{ macros.setting_input_text_and_buttons('save_path', '저장 폴더', [['select_save_path_btn', '경로 선택']], value=arg['save_path'], placeholder='저장 폴더 경로', desc='정상적으로 완료된 파일이 이동할 폴더 입니다.') }}
|
||||
{{ macros.setting_input_int('max_pf_count', '허용 Packet Fail 수', value=arg['max_pf_count'], min='0', placeholder='0', desc=['이 값보다 Packet Fail 횟수가 더 많으면 실패처리 합니다.', '0일 경우 Packet Fail이 발생하면 바로 실패처리.']) }}
|
||||
|
||||
{{ macros.setting_checkbox('if_fail_remove_tmp_file', '임시 파일', arg['if_fail_remove_tmp_file'], desc='On : 실패시 임시 파일 자동 삭제') }}
|
||||
{{ macros.setting_input_int('timeout_minute', '타임아웃 시간', value=arg['timeout_minute'], desc=['이 시간 안에 완료가 되지 않으면 시간초과 에러를 발생합니다.', '속도가 느린 경우 값을 올려 설정하세요. 분 단위']) }}
|
||||
{{ macros.m_tab_content_end() }}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var package_name = "{{arg['package_name'] }}";
|
||||
|
||||
$(document).ready(function(){
|
||||
});
|
||||
|
||||
//버전
|
||||
$("#ffmpeg_version").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/ffmpeg/ajax/ffmpeg_version',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{ },
|
||||
dataType: "json",
|
||||
success: function (list) {
|
||||
var str = '';
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
str += "<div>" + list[i] + "</div>";
|
||||
}
|
||||
document.getElementById("modal_title").innerHTML = "ffmpeg -version";
|
||||
document.getElementById("modal_body").innerHTML = str;
|
||||
$("#large_modal").modal();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("body").on('click', '#select_temp_path_btn', function(e){
|
||||
e.preventDefault();
|
||||
m_select_local_file_modal("임시 저장 경로 선택", $('#temp_path').val().trim(), true, function(result){
|
||||
document.getElementById("temp_path").value = result;
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#select_save_path_btn', function(e){
|
||||
e.preventDefault();
|
||||
m_select_local_file_modal("저장 경로 선택", $('#save_path').val().trim(), true, function(result){
|
||||
document.getElementById("save_path").value = result;
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#select_binary_path_btn', function(e){
|
||||
e.preventDefault();
|
||||
m_select_local_file_modal("실행 파일 선택", '/', false, function(result){
|
||||
document.getElementById("ffmpeg_path").value = result;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user