기본 파일명 설정 관련 수정
This commit is contained in:
@@ -19,6 +19,10 @@ class LogicNormal(object):
|
|||||||
def get_youtube_dl_version():
|
def get_youtube_dl_version():
|
||||||
return MyYoutubeDL.get_version()
|
return MyYoutubeDL.get_version()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_default_filename():
|
||||||
|
return MyYoutubeDL.DEFAULT_FILENAME
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_preset_list():
|
def get_preset_list():
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ class Status(Enum):
|
|||||||
|
|
||||||
|
|
||||||
class MyYoutubeDL(object):
|
class MyYoutubeDL(object):
|
||||||
|
DEFAULT_FILENAME = '%(title)s-%(id)s.%(ext)s'
|
||||||
|
|
||||||
__index = 0
|
__index = 0
|
||||||
_last_msg = ''
|
_last_msg = ''
|
||||||
|
|
||||||
|
|||||||
@@ -68,11 +68,12 @@ def first_menu(sub):
|
|||||||
if sub == 'setting':
|
if sub == 'setting':
|
||||||
arg.update(ModelSetting.to_dict())
|
arg.update(ModelSetting.to_dict())
|
||||||
arg['youtube_dl_version'] = LogicNormal.get_youtube_dl_version()
|
arg['youtube_dl_version'] = LogicNormal.get_youtube_dl_version()
|
||||||
|
arg['DEFAULT_FILENAME'] = LogicNormal.get_default_filename()
|
||||||
return render_template('%s_%s.html' % (package_name, sub), arg=arg)
|
return render_template('%s_%s.html' % (package_name, sub), arg=arg)
|
||||||
|
|
||||||
elif sub == 'download':
|
elif sub == 'download':
|
||||||
default_filename = ModelSetting.get('default_filename')
|
default_filename = ModelSetting.get('default_filename')
|
||||||
arg['file_name'] = default_filename if default_filename else '%(title)s-%(id)s.%(ext)s'
|
arg['file_name'] = default_filename if default_filename else LogicNormal.get_default_filename()
|
||||||
arg['preset_list'] = LogicNormal.get_preset_list()
|
arg['preset_list'] = LogicNormal.get_preset_list()
|
||||||
arg['postprocessor_list'] = LogicNormal.get_postprocessor_list()
|
arg['postprocessor_list'] = LogicNormal.get_postprocessor_list()
|
||||||
return render_template('%s_%s.html' % (package_name, sub), arg=arg)
|
return render_template('%s_%s.html' % (package_name, sub), arg=arg)
|
||||||
@@ -201,6 +202,8 @@ def api(sub):
|
|||||||
return LogicNormal.abort(ret, 2) # 잘못된 동영상 주소
|
return LogicNormal.abort(ret, 2) # 잘못된 동영상 주소
|
||||||
if preferredcodec not in (None, 'best', 'mp3', 'aac', 'flac', 'm4a', 'opus', 'vorbis', 'wav'):
|
if preferredcodec not in (None, 'best', 'mp3', 'aac', 'flac', 'm4a', 'opus', 'vorbis', 'wav'):
|
||||||
return LogicNormal.abort(ret, 5) # 허용되지 않은 값이 있음
|
return LogicNormal.abort(ret, 5) # 허용되지 않은 값이 있음
|
||||||
|
if filename:
|
||||||
|
filename = LogicNormal.get_default_filename()
|
||||||
youtube_dl = LogicNormal.download(plugin=plugin,
|
youtube_dl = LogicNormal.download(plugin=plugin,
|
||||||
url=url,
|
url=url,
|
||||||
filename=filename,
|
filename=filename,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% macro setting_select2(id, title, options, col='9', desc=None, value=None) %}
|
{% macro setting_select2(id, title, options, col='9', desc=None, value=None) %}
|
||||||
{{ macros.setting_top(title) }}
|
{{ macros.setting_top(title) }}
|
||||||
<div class="input-group col-sm-{{ col }}">
|
<div class="input-group col-sm-{{ col }}">
|
||||||
@@ -27,7 +29,6 @@
|
|||||||
{{ macros.setting_bottom(desc) }}
|
{{ macros.setting_bottom(desc) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
{{ macros.setting_input_text_and_buttons('ffmpeg_path', 'FFmpeg 경로', [['ffmpeg_version', '버전확인']], value=arg['ffmpeg_path'], placeholder='ffmpeg', desc='SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다.') }}
|
{{ macros.setting_input_text_and_buttons('ffmpeg_path', 'FFmpeg 경로', [['ffmpeg_version', '버전확인']], value=arg['ffmpeg_path'], placeholder='ffmpeg', desc='SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다.') }}
|
||||||
{{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], desc='다운로드 파일이 임시로 저장될 폴더입니다.') }}
|
{{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], desc='다운로드 파일이 임시로 저장될 폴더입니다.') }}
|
||||||
{{ macros.setting_input_text('save_path', '저장 폴더', value=arg['save_path'], desc='정상적으로 완료된 파일이 이동할 폴더입니다.') }}
|
{{ macros.setting_input_text('save_path', '저장 폴더', value=arg['save_path'], desc='정상적으로 완료된 파일이 이동할 폴더입니다.') }}
|
||||||
{{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder='%(title)s-%(id)s.%(ext)s', desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고') }}
|
{{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder=arg['DEFAULT_FILENAME'], desc='템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고') }}
|
||||||
{{ macros.setting_input_text('proxy', '프록시', value=arg['proxy'], desc=['HTTP/HTTPS/SOCKS를 지원합니다. 예) socks5://127.0.0.1:1080/', '빈칸으로 두면 프록시를 사용하지 않습니다.']) }}
|
{{ macros.setting_input_text('proxy', '프록시', value=arg['proxy'], desc=['HTTP/HTTPS/SOCKS를 지원합니다. 예) socks5://127.0.0.1:1080/', '빈칸으로 두면 프록시를 사용하지 않습니다.']) }}
|
||||||
{{ macros.setting_checkbox('activate_cors', 'CORS 허용', value=arg['activate_cors'], desc='API로의 크로스 도메인 요청을 허용합니다. 설정 저장 후 재시작이 필요합니다.') }}
|
{{ macros.setting_checkbox('activate_cors', 'CORS 허용', value=arg['activate_cors'], desc='API로의 크로스 도메인 요청을 허용합니다. 설정 저장 후 재시작이 필요합니다.') }}
|
||||||
{{ macros.setting_button([['global_setting_save_btn', '저장']]) }}
|
{{ macros.setting_button([['global_setting_save_btn', '저장']]) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user