From 8a9f08d9dbea60488946bdafe796ea28191c5f69 Mon Sep 17 00:00:00 2001 From: joyfuI Date: Thu, 5 Mar 2020 13:15:44 +0900 Subject: [PATCH] =?UTF-8?q?v1.2.5=20=EA=B8=B0=EB=B3=B8=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기본 파일명 설정 추가 API에서 일부 키를 선택으로 변경 --- README.md | 12 ++++++++---- info.json | 2 +- logic.py | 3 ++- plugin.py | 12 ++++++------ templates/youtube-dl_setting.html | 1 + 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1e21b93..3c8142a 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,10 @@ SJVA에서 "시스템 → 플러그인 → 플러그인 수동 설치" 칸에 `plugin` | 플러그인 이름 | O | String `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String `url` | 동영상 주소 | O | String -`filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고 | O | String -`temp_path` | 임시 폴더 경로 | O | String -`save_path` | 저장 폴더 경로 | O | String -`format_code` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 지정하지 않으면 최고 화질로 다운로드됨 | X | String +`filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고. 기본값: 사용자 설정 | X | String +`temp_path` | 임시 폴더 경로. 기본값: 사용자 설정 | X | String +`save_path` | 저장 폴더 경로. 기본값: 사용자 설정 | X | String +`format_code` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 기본값: 최고 화질 | X | String `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: false | X | Boolean #### Response 키 | 설명 | 타입 @@ -124,6 +124,10 @@ SJVA에서 "시스템 → 플러그인 → 플러그인 수동 설치" 칸에 물론 해당 정보가 없으면 null입니다. ## Changelog +v1.2.5 +* 기본 파일명 설정 추가 +* API에서 일부 키를 선택으로 변경 + v1.2.4 * API Key 기능 추가 diff --git a/info.json b/info.json index 685d4e6..d3037d7 100644 --- a/info.json +++ b/info.json @@ -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"} \ No newline at end of file +{"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"} \ No newline at end of file diff --git a/logic.py b/logic.py index 256cb0e..f7d816a 100644 --- a/logic.py +++ b/logic.py @@ -24,7 +24,8 @@ from .my_youtube_dl import Status class Logic(object): db_default = { '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 diff --git a/plugin.py b/plugin.py index 91fa499..f4400c6 100644 --- a/plugin.py +++ b/plugin.py @@ -36,7 +36,7 @@ menu = { } plugin_info = { - 'version': '1.2.4', + 'version': '1.2.5', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', @@ -71,7 +71,7 @@ def detail(sub): return render_template('%s_setting.html' % package_name, arg=arg) 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() return render_template('%s_download.html' % package_name, arg=arg) @@ -157,16 +157,16 @@ def api(sub): elif sub == 'download': key = request.form.get('key') url = request.form.get('url') - filename = request.form.get('filename') - temp_path = request.form.get('temp_path') - save_path = request.form.get('save_path') + filename = request.form.get('filename', Logic.get_setting_value('default_filename')) + temp_path = request.form.get('temp_path', Logic.get_setting_value('temp_path')) + save_path = request.form.get('save_path', Logic.get_setting_value('save_path')) format_code = request.form.get('format_code', None) start = request.form.get('start', False) ret = { 'errorCode': 0, 'index': None } - if None in (key, url, filename, temp_path, save_path): + if None in (key, url): return Logic.abort(ret, 1) # 필수 요청 변수가 없음 if not url.startswith('http'): return Logic.abort(ret, 2) # 잘못된 동영상 주소 diff --git a/templates/youtube-dl_setting.html b/templates/youtube-dl_setting.html index 71170ae..156c30f 100644 --- a/templates/youtube-dl_setting.html +++ b/templates/youtube-dl_setting.html @@ -6,6 +6,7 @@
{{ 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('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', '저장']]) }}