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 @@