139 lines
3.8 KiB
HTML
Executable File
139 lines
3.8 KiB
HTML
Executable File
{% extends "base.html" %}
|
|
{% block content %}
|
|
|
|
<div width="100%">
|
|
{{ macros.m_button_group([['reset_btn', '초기화'], ['delete_completed_btn', '완료 목록 삭제'], ['go_ffmpeg_btn', 'Go FFMPEG']])}}
|
|
|
|
{{ macros.m_row_start('0') }}
|
|
{{ macros.m_row_end() }}
|
|
|
|
{{ macros.m_hr_head_top() }}
|
|
{{ macros.m_row_start('0') }}
|
|
{{ macros.m_col(1, macros.m_strong('Idx')) }}
|
|
{{ macros.m_col(2, macros.m_strong('CreatedTime')) }}
|
|
{{ macros.m_col(4, macros.m_strong('Filename (Title)')) }}
|
|
<!-- {{ macros.m_col(3, macros.m_strong('ProgramTitle')) }}-->
|
|
{{ macros.m_col(3, macros.m_strong('Status')) }}
|
|
{{ macros.m_col(1, macros.m_strong('Action')) }}
|
|
{{ macros.m_row_end() }}
|
|
{{ macros.m_hr_head_bottom() }}
|
|
<div id="download_list_div"></div>
|
|
</div> <!--전체-->
|
|
|
|
|
|
<script type="text/javascript">
|
|
const package_name = 'linkkf-yommi';
|
|
let current_data = null;
|
|
|
|
$(document).ready(function(){
|
|
const protocol = window.location.protocol;
|
|
const socket = io.connect(protocol + "//" + document.domain + ":" + location.port + "/" + package_name);
|
|
|
|
socket.on('on_connect', function(data){
|
|
if (data != null) {
|
|
on_start(data);
|
|
}
|
|
});
|
|
|
|
socket.on('status', function(data){
|
|
on_status(data)
|
|
});
|
|
|
|
socket.on('list_refresh', function(data){
|
|
on_start(data)
|
|
});
|
|
});
|
|
|
|
function on_start(data) {
|
|
make_download_list(data)
|
|
}
|
|
|
|
function on_status(data) {
|
|
// console.log(data)
|
|
let tmp = document.getElementById("progress_"+data.plugin_id)
|
|
if (tmp != null) {
|
|
document.getElementById("progress_"+data.plugin_id).style.width = data.data.percent+ '%';
|
|
document.getElementById("progress_"+data.plugin_id+"_label").innerHTML = data.status + "(" + data.data.percent + "%)" + ' x' + ((data.data != null)?data.data.current_speed:'');
|
|
}
|
|
}
|
|
|
|
function make_download_list(data) {
|
|
str = '';
|
|
for (i in data) {
|
|
str += m_row_start();
|
|
str += m_col(1, data[i].entity_id);
|
|
str += m_col(2, data[i].created_time);
|
|
tmp_filename = '<b>' + data[i].info.program_title + '</b><br />' + data[i].info.filename
|
|
str += m_col(4, tmp_filename);
|
|
// str += m_col(3, data[i].info.program_title);
|
|
|
|
label = data[i].ffmpeg_status_kor
|
|
if (data[i].ffmpeg_percent != 0) {
|
|
label += '(' + data[i].ffmpeg_percent + '%)'
|
|
}
|
|
tmp = m_progress('progress_'+data[i].entity_id, data[i].ffmpeg_percent, label)
|
|
str += m_col(3, tmp);
|
|
|
|
tmp = m_button('program_cancel_btn', '취소', [{'key':'id', 'value':data[i].entity_id}]);
|
|
tmp = m_button_group(tmp)
|
|
str += m_col(1, tmp)
|
|
str += m_row_end();
|
|
if (i != data.length -1) str += m_hr(0);
|
|
}
|
|
document.getElementById("download_list_div").innerHTML = str;
|
|
}
|
|
|
|
$("body").on('click', '#program_cancel_btn', function(e){
|
|
e.preventDefault();
|
|
entity_id = $(this).data('id')
|
|
send_data = {'command':'cancel', 'entity_id':entity_id}
|
|
program_auto_command(send_data)
|
|
});
|
|
|
|
$("body").on('click', '#reset_btn', function(e){
|
|
e.preventDefault();
|
|
entity_id = $(this).data('id')
|
|
send_data = {'command':'reset', 'entity_id':-1}
|
|
program_auto_command(send_data)
|
|
});
|
|
|
|
$("body").on('click', '#delete_completed_btn', function(e){
|
|
e.preventDefault();
|
|
entity_id = $(this).data('id')
|
|
send_data = {'command':'delete_completed', 'entity_id':-1}
|
|
program_auto_command(send_data)
|
|
});
|
|
|
|
|
|
function program_auto_command(data) {
|
|
$.ajax({
|
|
url: '/' + package_name + '/ajax/program_auto_command',
|
|
type: "POST",
|
|
cache: false,
|
|
data: data,
|
|
dataType: "json",
|
|
success: function (ret) {
|
|
if (ret.ret == 'notify') {
|
|
$.notify('<strong>'+ ret.log +'</strong>', {
|
|
type: 'warning'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$("body").on('click', '#go_ffmpeg_btn', function(e){
|
|
e.preventDefault();
|
|
$(location).attr('href', '/ffmpeg')
|
|
});
|
|
|
|
</script>
|
|
<style>
|
|
@media (min-width: 576px) {
|
|
.container {
|
|
max-width: 98%;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|