From d5f60846647ef6641af95a7f75b3ceeba303eb70 Mon Sep 17 00:00:00 2001 From: joyfuI Date: Tue, 10 Mar 2020 18:33:43 +0900 Subject: [PATCH] =?UTF-8?q?v1.3.3=20API=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- info.json | 2 +- plugin.py | 8 +++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bd38506..4dcddc3 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ API에선 직접 비트레이트를 설정할 수 있습니다. * `1` - 필수 요청 변수가 없음 * `2` - 잘못된 동영상 주소 * `3` - 인덱스 범위를 벗어남 -* `4` - 키가 일치하지 않음 +* `4` - 키 값이 일치하지 않음 +* `5` - 허용되지 않은 값이 있음 * `10` - 실패. 요청은 성공하였으나 실행 결과가 실패 #### Status 타입 상태를 나타냄 @@ -72,7 +73,7 @@ API에선 직접 비트레이트를 설정할 수 있습니다. `format_code` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection 참고. 미지정 시 최고 화질 | X | String `preferedformat` | 변환할 비디오 포맷. 가능한 포맷은 https://ffmpeg.org/general.html#File-Formats 참고. 미지정 시 변환하지 않음 | X | String `preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String -`preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `"192"` | X | String +`preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean #### Response 키 | 설명 | 타입 @@ -130,6 +131,9 @@ API에선 직접 비트레이트를 설정할 수 있습니다. 물론 해당 정보가 없으면 null입니다. ## Changelog +v1.3.3 +* API 변경 + v1.3.2 * 파일명에 경로 지정 시 이미 존재하는 경로면 에러가 발생하는 문제 수정 * celery 적용 diff --git a/info.json b/info.json index da68468..23571c9 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.3.2", "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.3.3", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file diff --git a/plugin.py b/plugin.py index a776461..d91f3c5 100644 --- a/plugin.py +++ b/plugin.py @@ -36,7 +36,7 @@ menu = { } plugin_info = { - 'version': '1.3.2', + 'version': '1.3.3', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', @@ -177,7 +177,7 @@ def api(sub): format_code = request.form.get('format_code', None) preferedformat = request.form.get('preferedformat', None) preferredcodec = request.form.get('preferredcodec', None) - preferredquality = request.form.get('preferredquality', '192') + preferredquality = request.form.get('preferredquality', 192) start = request.form.get('start', False) ret = { 'errorCode': 0, @@ -194,10 +194,12 @@ def api(sub): 'preferedformat': preferedformat }) if preferredcodec is not None: + if preferredcodec not in ('best', 'mp3', 'aac', 'flac', 'm4a', 'opus', 'vorbis', 'wav'): + return Logic.abort(ret, 5) # 허용되지 않은 값이 있음 postprocessor.append({ 'key': 'FFmpegExtractAudio', 'preferredcodec': preferredcodec, - 'preferredquality': preferredquality + 'preferredquality': str(preferredquality) }) youtube_dl = Youtube_dl(plugin, url, filename, temp_path, save_path, format_code, postprocessor) youtube_dl._key = key