v0.1.0 최초 공개
This commit is contained in:
43
templates/youtube-dl_download.html
Normal file
43
templates/youtube-dl_download.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{{ macros.setting_input_text('url', 'URL', placeholder='http:// 주소', desc='유튜브, 네이버TV 등 동영상 주소') }}
|
||||
{{ macros.setting_input_text('filename', '파일명', value=arg['file_name']) }}
|
||||
{{ macros.setting_button([['download_start', '다운로드']]) }}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
var package_name = '{{ arg["package_name"] }}';
|
||||
|
||||
$(function () {
|
||||
// 다운로드
|
||||
$('#download_start').click(function (e) {
|
||||
if ($('#url').val().startsWith('http') == false) {
|
||||
$.notify('<strong>URL을 입력하세요.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/download',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
data: {
|
||||
url: $('#url').val(),
|
||||
filename: $('#filename').val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.notify('<strong>분석중..</strong>', {
|
||||
type: 'info'
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
130
templates/youtube-dl_list.html
Normal file
130
templates/youtube-dl_list.html
Normal file
@@ -0,0 +1,130 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<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>
|
||||
|
||||
<table id="result_table" class="table table-sm tableRowHover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:5%">IDX</th>
|
||||
<th style="width:10%">시작시간</th>
|
||||
<th style="width:56%">파일명</th>
|
||||
<th style="width:8%">상태</th>
|
||||
<th style="width:5%">길이</th>
|
||||
<th style="width:8%">진행시간</th>
|
||||
<th style="width:8%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="list"></tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
$(function () {
|
||||
var package_name = '{{ arg["package_name"] }}';
|
||||
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/list',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
data: { },
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#list').html('');
|
||||
var str = '';
|
||||
for (var i in data) {
|
||||
str += make_item(data[i]);
|
||||
}
|
||||
$('#list').html(str);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '#stop', function (e) {
|
||||
var index = $(this).data('index');
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/stop',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
data: {
|
||||
index: index
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
location.reload(); // 새로고침
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
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 += '<button id="stop" class="align-middle btn btn-outline-danger btn-sm" data-index="' + data.index + '">중지</button>';
|
||||
}
|
||||
str += '</td>';
|
||||
str += '</tr>';
|
||||
str += '<tr class="collapse tableRowHoverOff" style="cursor: pointer;" id="collapse_' + data.index + '">';
|
||||
str += '<td colspan="8">';
|
||||
str += '<div id="detail_' + data.index + '">';
|
||||
str += get_detail(data);
|
||||
str += '</div>';
|
||||
str += '</td>';
|
||||
str += '</tr>';
|
||||
return str;
|
||||
}
|
||||
|
||||
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);
|
||||
str += info_html('종료시간', data.end_time);
|
||||
str += info_html('포맷', data.format);
|
||||
return str;
|
||||
}
|
||||
|
||||
function info_html(left, right) {
|
||||
var str = '<div class="row">';
|
||||
str += '<div class="col-sm-2">';
|
||||
str += '<b>' + left + '</b>';
|
||||
str += '</div>';
|
||||
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">';
|
||||
}
|
||||
str += right;
|
||||
if (left == 'URL') {
|
||||
str += '</a>';
|
||||
}
|
||||
str += '</span></div></div></div>';
|
||||
return str;
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
80
templates/youtube-dl_setting.html
Normal file
80
templates/youtube-dl_setting.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{{ macros.setting_input_text_and_buttons('youtube_dl_path', 'youtube-dl 경로', [['youtube_dl_version', '버전확인']], value=arg['youtube_dl_path']) }}
|
||||
<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>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
var package_name = '{{ arg["package_name"] }}';
|
||||
|
||||
$(function () {
|
||||
// 설정 저장
|
||||
$('#setting_save').click(function (e) {
|
||||
var formData = get_formdata('#setting');
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/setting_save',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>설정을 저장하지 못하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
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>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user