v1.0.0 바이너리 실행 방식에서 파이썬 임베딩 방식으로 변경

바이너리 실행 방식에서 파이썬 임베딩 방식으로 변경
SJVA 시작 시 자동으로 youtube-dl 업데이트
목록에서 진행률 표시 추가
This commit is contained in:
joyfuI
2020-02-09 18:51:58 +09:00
parent 7951973ddf
commit 47b3f615eb
8 changed files with 264 additions and 199 deletions

View File

@@ -25,9 +25,10 @@
<tr>
<th style="width:5%">IDX</th>
<th style="width:10%">시작시간</th>
<th style="width:56%">파일명</th>
<th style="width:11%">타입</th>
<th style="width:35%">제목</th>
<th style="width:8%">상태</th>
<th style="width:5%">길이</th>
<th style="width:15%">진행률</th>
<th style="width:8%">진행시간</th>
<th style="width:8%">Action</th>
</tr>
@@ -76,14 +77,19 @@
function make_item(data) {
var str = '<tr style="cursor: pointer;" data-toggle="collapse" data-target="#collapse_' + data.index + '" aria-expanded="true">';
str += '<td scope="col" style="width:5%">' + (data.index + 1) + '</td>';
str += '<td scope="col" style="width:10%">' + data.start_time + '</td>';
str += '<td scope="col" style="width:56%">' + data.filename + '</td>';
str += '<td id="status_' + data.index + '" scope="col" style="width:8%">' + data.status_ko + '</td>';
str += '<td scope="col" style="width:5%">' + data.duration_str + '</td>';
str += '<td id="download_time_' + data.index + '" scope="col" style="width:8%">' + data.download_time + '</td>';
str += '<td id="button_' + data.index + '" scope="col" style="width:8%" class="tableRowHoverOff">';
if (data.status_str == 'START') {
str += '<td scope="col">' + (data.index + 1) + '</td>';
str += '<td scope="col">' + data.start_time + '</td>';
str += '<td scope="col">' + data.extractor + '</td>';
str += '<td scope="col">' + data.title + '</td>';
str += '<td id="status_' + data.index + '" scope="col">' + data.status_ko + '</td>';
var visi = 'hidden';
if (parseInt(data.percent) > 0 && data.status_str != 'STOP') {
visi = 'visible';
}
str += '<td scope="col"><div class="progress"><div id="progress_' + data.index + '" class="progress-bar" style="visibility: ' + visi + '; width:' + data.percent + '%">' + data.percent + '%</div></div></td>';
str += '<td id="download_time_' + data.index + '" scope="col">' + data.download_time + '</td>';
str += '<td id="button_' + data.index + '" scope="col" class="tableRowHoverOff">';
if (data.status_str == 'START' || data.status_str == 'DOWNLOADING' || data.status_str == 'FINISHED') {
str += '<button id="stop" class="align-middle btn btn-outline-danger btn-sm" data-index="' + data.index + '">중지</button>';
}
str += '</td>';
@@ -99,15 +105,22 @@
}
function get_detail(data) {
var str = info_html('URL', data.url);
str += info_html('임시경로', data.temp_path + '/' + data.filename);
str += info_html('저장경로', data.save_path + '/' + data.filename);
var str = info_html('URL', data.url, data.url);
str += info_html('업로더', data.uploader, data.uploader_url);
str += info_html('임시폴더', data.temp_path);
str += info_html('저장폴더', data.save_path);
str += info_html('종료시간', data.end_time);
str += info_html('포맷', data.format);
if (data.status_str == 'DOWNLOADING') {
str += info_html('', '<b>현재 다운로드 중인 파일에 대한 정보</b>');
str += info_html('파일명', data.filename);
str += info_html('진행률(current/total)', data.percent + '% (' + data.downloaded_bytes_str + ' / ' + data.total_bytes_str + ')');
str += info_html('남은 시간', data.eta + '초');
str += info_html('다운 속도', data.speed_str);
}
return str;
}
function info_html(left, right) {
function info_html(left, right, option) {
var str = '<div class="row">';
str += '<div class="col-sm-2">';
str += '<b>' + left + '</b>';
@@ -115,11 +128,11 @@
str += '<div class="col-sm-10">';
str += '<div class="input-group col-sm-9">';
str += '<span class="text-left" style="padding-left:10px; padding-top:3px">';
if (left == 'URL') {
str += '<a href="' + right + '" target="_blank">';
if (left == 'URL' || left == '업로더') {
str += '<a href="' + option + '" target="_blank">';
}
str += right;
if (left == 'URL') {
if (left == 'URL' || left == '업로더') {
str += '</a>';
}
str += '</span></div></div></div>';

View File

@@ -2,13 +2,11 @@
{% block content %}
<div>
{{ macros.setting_input_text_and_buttons('youtube_dl_path', 'youtube-dl 경로', [['youtube_dl_version', '버전확인']], value=arg['youtube_dl_path']) }}
{{ macros.setting_input_text('youtube_dl_version', 'youtube-dl 버전', value=arg['youtube_dl_version']) }}
<form id="setting">
{{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], placeholder='임시 폴더 경로', desc='다운로드 파일이 임시로 저장될 폴더 입니다.') }}
{{ macros.setting_input_text('save_path', '저장 폴더', value=arg['save_path'], placeholder='저장 폴더 경로', desc='정상적으로 완료된 파일이 이동할 폴더 입니다.') }}
{{ macros.setting_button([['setting_save', '저장']]) }}
{{ macros.m_hr() }}
{{ macros.setting_button([['youtube_dl_update', '업데이트']], left='youtube-dl 업데이트', desc=['혹시 정상적으로 동영상 주소를 입력했는데 다운로드에 실패한다면 업데이트를 해보세요.']) }}
</form>
</div>
@@ -40,40 +38,6 @@
});
return false;
});
// 버전
$('#youtube_dl_version').click(function (e) {
$.ajax({
url: '/' + package_name + '/ajax/youtube_dl_version',
type: 'POST',
cache: false,
data: { },
dataType: 'json',
success: function (ret) {
$('#modal_title').html('youtube-dl --version');
$('#modal_body').html(ret);
$('#large_modal').modal();
}
});
return false;
});
// 버전
$('#youtube_dl_update').click(function (e) {
$.ajax({
url: '/' + package_name + '/ajax/youtube_dl_update',
type: 'POST',
cache: false,
data: { },
dataType: 'json',
success: function (ret) {
$.notify('<strong>youtube-dl 업데이트 완료</strong>', {
type: 'success'
});
}
});
return false;
});
});
</script>