v1.2.5 기본 파일명 설정 추가

기본 파일명 설정 추가
API에서 일부 키를 선택으로 변경
This commit is contained in:
joyfuI
2020-03-05 13:15:44 +09:00
parent 352c2eb73b
commit 8a9f08d9db
5 changed files with 18 additions and 12 deletions

View File

@@ -63,10 +63,10 @@ SJVA에서 "시스템 → 플러그인 → 플러그인 수동 설치" 칸에
`plugin` | 플러그인 이름 | O | String `plugin` | 플러그인 이름 | O | String
`key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String
`url` | 동영상 주소 | O | String `url` | 동영상 주소 | O | String
`filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고 | O | String `filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고. 기본값: 사용자 설정 | X | String
`temp_path` | 임시 폴더 경로 | O | String `temp_path` | 임시 폴더 경로. 기본값: 사용자 설정 | X | String
`save_path` | 저장 폴더 경로 | O | String `save_path` | 저장 폴더 경로. 기본값: 사용자 설정 | X | String
`format_code` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 지정하지 않으면 최고 화질로 다운로드됨 | X | String `format_code` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 기본값: 최고 화질 | X | String
`start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: false | X | Boolean `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: false | X | Boolean
#### Response #### Response
키 | 설명 | 타입 키 | 설명 | 타입
@@ -124,6 +124,10 @@ SJVA에서 "시스템 → 플러그인 → 플러그인 수동 설치" 칸에
물론 해당 정보가 없으면 null입니다. 물론 해당 정보가 없으면 null입니다.
## Changelog ## Changelog
v1.2.5
* 기본 파일명 설정 추가
* API에서 일부 키를 선택으로 변경
v1.2.4 v1.2.4
* API Key 기능 추가 * API Key 기능 추가

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.2.4", "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.2.5", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}

View File

@@ -24,7 +24,8 @@ from .my_youtube_dl import Status
class Logic(object): class Logic(object):
db_default = { db_default = {
'temp_path': os.path.join(path_data, 'download_tmp'), 'temp_path': os.path.join(path_data, 'download_tmp'),
'save_path': os.path.join(path_data, 'download') 'save_path': os.path.join(path_data, 'download'),
'default_filename': '%(title)s-%(id)s.%(ext)s'
} }
@staticmethod @staticmethod

View File

@@ -36,7 +36,7 @@ menu = {
} }
plugin_info = { plugin_info = {
'version': '1.2.4', 'version': '1.2.5',
'name': 'youtube-dl', 'name': 'youtube-dl',
'category_name': 'vod', 'category_name': 'vod',
'developer': 'joyfuI', 'developer': 'joyfuI',
@@ -71,7 +71,7 @@ def detail(sub):
return render_template('%s_setting.html' % package_name, arg=arg) return render_template('%s_setting.html' % package_name, arg=arg)
elif sub == 'download': elif sub == 'download':
arg['file_name'] = '%(title)s-%(id)s.%(ext)s' arg['file_name'] = Logic.get_setting_value('default_filename')
arg['preset_list'] = Logic.get_preset_list() arg['preset_list'] = Logic.get_preset_list()
return render_template('%s_download.html' % package_name, arg=arg) return render_template('%s_download.html' % package_name, arg=arg)
@@ -157,16 +157,16 @@ def api(sub):
elif sub == 'download': elif sub == 'download':
key = request.form.get('key') key = request.form.get('key')
url = request.form.get('url') url = request.form.get('url')
filename = request.form.get('filename') filename = request.form.get('filename', Logic.get_setting_value('default_filename'))
temp_path = request.form.get('temp_path') temp_path = request.form.get('temp_path', Logic.get_setting_value('temp_path'))
save_path = request.form.get('save_path') save_path = request.form.get('save_path', Logic.get_setting_value('save_path'))
format_code = request.form.get('format_code', None) format_code = request.form.get('format_code', None)
start = request.form.get('start', False) start = request.form.get('start', False)
ret = { ret = {
'errorCode': 0, 'errorCode': 0,
'index': None 'index': None
} }
if None in (key, url, filename, temp_path, save_path): if None in (key, url):
return Logic.abort(ret, 1) # 필수 요청 변수가 없음 return Logic.abort(ret, 1) # 필수 요청 변수가 없음
if not url.startswith('http'): if not url.startswith('http'):
return Logic.abort(ret, 2) # 잘못된 동영상 주소 return Logic.abort(ret, 2) # 잘못된 동영상 주소

View File

@@ -6,6 +6,7 @@
<form id="setting"> <form id="setting">
{{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], placeholder='임시 폴더 경로', desc='다운로드 파일이 임시로 저장될 폴더 입니다.') }} {{ 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_input_text('save_path', '저장 폴더', value=arg['save_path'], placeholder='저장 폴더 경로', desc='정상적으로 완료된 파일이 이동할 폴더 입니다.') }}
{{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder='저장 폴더 경로', desc=['템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고', '기본값은 "%(title)s-%(id)s.%(ext)s"입니다.']) }}
{{ macros.setting_button([['setting_save', '저장']]) }} {{ macros.setting_button([['setting_save', '저장']]) }}
</form> </form>
</div> </div>