This commit is contained in:
joyfuI
2020-03-07 12:01:06 +09:00
parent ef6c8e3066
commit a9165a78be
5 changed files with 54 additions and 50 deletions

View File

@@ -130,6 +130,8 @@ API에선 직접 비트레이트를 설정할 수 있습니다.
물론 해당 정보가 없으면 null입니다. 물론 해당 정보가 없으면 null입니다.
## Changelog ## Changelog
v1.3.1
v1.3.0 v1.3.0
* 후처리 기능 추가 * 후처리 기능 추가
이제 비디오 변환이나 오디오 추출이 가능합니다. 이제 비디오 변환이나 오디오 추출이 가능합니다.

View File

@@ -1 +1 @@
{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "1.3.0", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} {"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "1.3.1", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}

View File

@@ -111,28 +111,24 @@ class Logic(object):
@staticmethod @staticmethod
def get_postprocessor_list(): def get_postprocessor_list():
postprocessor_list = [ postprocessor_list = [
['', '후처리 안함'], ['', '후처리 안함', None],
['_optgroup', '비디오 변환'], ['mp4', 'MP4', '비디오 변환'],
['mp4', 'MP4'], ['flv', 'FLV', '비디오 변환'],
['flv', 'FLV'], ['webm', 'WebM', '비디오 변환'],
['webm', 'WebM'], ['ogg', 'Ogg', '비디오 변환'],
['ogg', 'Ogg'], ['mkv', 'MKV', '비디오 변환'],
['mkv', 'MKV'], ['ts', 'TS', '비디오 변환'],
['ts', 'TS'], ['avi', 'AVI', '비디오 변환'],
['avi', 'AVI'], ['wmv', 'WMV', '비디오 변환'],
['wmv', 'WMV'], ['mov', 'MOV', '비디오 변환'],
['mov', 'MOV'], ['gif', 'GIF', '비디오 변환'],
['gif', 'GIF'], ['mp3', 'MP3', '오디오 추출'],
['_optgroup', ''], ['aac', 'AAC', '오디오 추출'],
['_optgroup', '오디오 추출'], ['flac', 'FLAC', '오디오 추출'],
['mp3', 'MP3'], ['m4a', 'M4A', '오디오 추출'],
['aac', 'AAC'], ['opus', 'Opus', '오디오 추출'],
['flac', 'FLAC'], ['vorbis', 'Vorbis', '오디오 추출'],
['m4a', 'M4A'], ['wav', 'WAV', '오디오 추출']
['opus', 'Opus'],
['vorbis', 'Vorbis'],
['wav', 'WAV'],
['_optgroup', '']
] ]
return postprocessor_list return postprocessor_list
@@ -140,16 +136,10 @@ class Logic(object):
def get_postprocessor(): def get_postprocessor():
video_convertor = [] video_convertor = []
extract_audio = [] extract_audio = []
optgroup = None
for i in Logic.get_postprocessor_list(): for i in Logic.get_postprocessor_list():
if i[0] == '_optgroup': if i[2] == '비디오 변환':
if i[1] != '': # optgroup 태그 열기
optgroup = i[1]
else: # optgroup 태그 닫기
optgroup = None
elif optgroup == '비디오 변환':
video_convertor.append(i[0]) video_convertor.append(i[0])
elif optgroup == '오디오 추출': elif i[2] == '오디오 추출':
extract_audio.append(i[0]) extract_audio.append(i[0])
return video_convertor, extract_audio return video_convertor, extract_audio

View File

@@ -36,7 +36,7 @@ menu = {
} }
plugin_info = { plugin_info = {
'version': '1.3.0', 'version': '1.3.1',
'name': 'youtube-dl', 'name': 'youtube-dl',
'category_name': 'vod', 'category_name': 'vod',
'developer': 'joyfuI', 'developer': 'joyfuI',

View File

@@ -1,3 +1,32 @@
{% macro setting_select2(id, title, options, col='9', desc=None, value=None) %}
{{ macros.setting_top(title) }}
<div class="input-group col-sm-{{ col }}">
<select id="{{ id }}" name="{{ id }}" class="form-control form-control-sm">
{% set ns = namespace(optgroup=none) %}
{% for item in options %}
{% if ns.optgroup != item[2] %}
{% if ns.optgroup is not none %}
</optgroup>
{% endif %}
{% if item[2] is not none %}
<optgroup label="{{ item[2] }}">
{% endif %}
{% set ns.optgroup = item[2] %}
{% endif %}
{% if value is not none and value == item[0] %}
<option value="{{ item[0] }}" selected>{{ item[1] }}</option>
{% else %}
<option value="{{ item[0] }}">{{ item[1] }}</option>
{% endif %}
{% endfor %}
{% if ns.optgroup is not none %}
</optgroup>
{% endif %}
</select>
</div>
{{ macros.setting_bottom(desc) }}
{% endmacro %}
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
@@ -6,7 +35,7 @@
{{ macros.setting_input_text('filename', '파일명', value=arg['file_name'], desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고') }} {{ macros.setting_input_text('filename', '파일명', value=arg['file_name'], desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고') }}
{{ macros.setting_select('preset', '동영상 포맷 프리셋', arg['preset_list'], col='3') }} {{ macros.setting_select('preset', '동영상 포맷 프리셋', arg['preset_list'], col='3') }}
{{ macros.setting_input_text('format', '동영상 포맷', desc=['포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고', '빈칸으로 두면 최고 화질로 다운로드합니다.']) }} {{ macros.setting_input_text('format', '동영상 포맷', desc=['포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고', '빈칸으로 두면 최고 화질로 다운로드합니다.']) }}
{{ macros.setting_select('postprocessor', '후처리', arg['postprocessor_list'], col='3', desc='다운로드 후 FFmpeg로 후처리합니다.') }} {{ setting_select2('postprocessor', '후처리', arg['postprocessor_list'], col='3', desc='다운로드 후 FFmpeg로 후처리합니다.') }}
{{ macros.setting_button([['download_start', '다운로드']]) }} {{ macros.setting_button([['download_start', '다운로드']]) }}
</div> </div>
@@ -15,23 +44,6 @@
var package_name = '{{ arg["package_name"] }}'; var package_name = '{{ arg["package_name"] }}';
$(function () { $(function () {
// 후처리 목록
var optgroup = null;
$('#postprocessor > option').map(function () {
var i = $(this);
if (i.val() === '_optgroup') {
if (i.text() !== '') { // optgroup 태그 열기
optgroup = $('<optgroup label="' + i.text() + '"></optgroup>');
i.before(optgroup).remove();
} else { // optgroup 태그 닫기
optgroup = null;
i.remove();
}
} else if (optgroup !== null) { // optgroup 태그로 이동
optgroup.append(i);
}
});
// 프리셋 변경 // 프리셋 변경
$('#preset').change(function (e) { $('#preset').change(function (e) {
if ($(this).val() === '_custom') { if ($(this).val() === '_custom') {