From 480f0be4aaa9f2787e0fb338a9b9bc45a41197a6 Mon Sep 17 00:00:00 2001 From: joyfuI Date: Sat, 1 Aug 2020 16:38:13 +0900 Subject: [PATCH] =?UTF-8?q?v1.6.5=20info=5Fdict=20API=EA=B0=80=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++ info.json | 2 +- logic_normal.py | 2 +- my_youtube_dl.py | 47 +++++++++++++++++------------- plugin.py | 2 +- templates/youtube-dl_download.html | 2 +- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 4dbd9c7..38d2125 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,9 @@ API에선 직접 비트레이트를 설정할 수 있습니다. 물론 해당 정보가 없으면 null입니다. ## Changelog +v1.6.5 +* info_dict API가 동작하지 않는 문제 수정 + v1.6.4 * FFmpeg 경로 설정 추가 SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다. diff --git a/info.json b/info.json index 9226df5..c6d4f37 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.6.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.6.5", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file diff --git a/logic_normal.py b/logic_normal.py index 775e5ba..5c46b91 100644 --- a/logic_normal.py +++ b/logic_normal.py @@ -147,7 +147,7 @@ class LogicNormal(object): @staticmethod def get_info_dict(url, proxy): - MyYoutubeDL.get_info_dict(url, proxy) + return MyYoutubeDL.get_info_dict(url, proxy) @staticmethod def human_readable_size(size, suffix=''): diff --git a/my_youtube_dl.py b/my_youtube_dl.py index 9ca8d5c..61e1119 100644 --- a/my_youtube_dl.py +++ b/my_youtube_dl.py @@ -63,24 +63,26 @@ class MyYoutubeDL(object): self.__status = Status.READY self.__thread = None self.key = None - self.start_time = None # 시작 시간 - self.end_time = None # 종료 시간 - self.info_dict = { # info_dict에서 얻는 정보 - 'extractor': None, # 타입 - 'title': None, # 제목 - 'uploader': None, # 업로더 - 'uploader_url': None # 업로더 주소 + self.start_time = None # 시작 시간 + self.end_time = None # 종료 시간 + # info_dict에서 얻는 정보 + self.info_dict = { + 'extractor': None, # 타입 + 'title': None, # 제목 + 'uploader': None, # 업로더 + 'uploader_url': None # 업로더 주소 } # info_dict에서 얻는 정보(entries) # self.info_dict['playlist_index'] = None - # self.info_dict['duration'] = None # 길이 - # self.info_dict['format'] = None # 포맷 - # self.info_dict['thumbnail'] = None # 썸네일 - self.progress_hooks = { # progress_hooks에서 얻는 정보 - 'downloaded_bytes': None, # 다운로드한 크기 - 'total_bytes': None, # 전체 크기 - 'eta': None, # 예상 시간(s) - 'speed': None # 다운로드 속도(bytes/s) + # self.info_dict['duration'] = None # 길이 + # self.info_dict['format'] = None # 포맷 + # self.info_dict['thumbnail'] = None # 썸네일 + # progress_hooks에서 얻는 정보 + self.progress_hooks = { + 'downloaded_bytes': None, # 다운로드한 크기 + 'total_bytes': None, # 전체 크기 + 'eta': None, # 예상 시간(s) + 'speed': None # 다운로드 속도(bytes/s) } def start(self): @@ -96,8 +98,9 @@ class MyYoutubeDL(object): try: self.start_time = datetime.now() self.status = Status.START - info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy')) # 동영상 정보 가져오기 - if info_dict is None: # 가져오기 실패 + # 동영상 정보 가져오기 + info_dict = MyYoutubeDL.get_info_dict(self.url, self.opts.get('proxy')) + if info_dict is None: self.status = Status.ERROR return self.info_dict['extractor'] = info_dict['extractor'] @@ -122,14 +125,15 @@ class MyYoutubeDL(object): if not os.path.isdir(path): os.mkdir(path) continue - celery_shutil.move(i, path) # 파일 이동 + celery_shutil.move(i, path) self.status = Status.COMPLETED except Exception as e: self.status = Status.ERROR logger.error('Exception:%s', e) logger.error(traceback.format_exc()) finally: - celery_shutil.rmtree(self.temp_path) # 임시폴더 삭제 + # 임시폴더 삭제 + celery_shutil.rmtree(self.temp_path) if self.status != Status.STOP: self.end_time = datetime.now() @@ -170,7 +174,7 @@ class MyYoutubeDL(object): self.status = { 'downloading': Status.DOWNLOADING, 'error': Status.ERROR, - 'finished': Status.FINISHED # 다운로드 완료. 변환 시작 + 'finished': Status.FINISHED # 다운로드 완료. 변환 시작 }[d['status']] if d['status'] != 'error': self.filename = os.path.basename(d.get('filename')) @@ -201,7 +205,8 @@ class MyLogger(object): def debug(self, msg): MyYoutubeDL._last_msg = msg if msg.find('') != -1 or msg.find('{') != -1: - return # 과도한 로그 방지 + # 과도한 로그 방지 + return logger.debug(msg) def warning(self, msg): diff --git a/plugin.py b/plugin.py index 41849db..abb3a5a 100644 --- a/plugin.py +++ b/plugin.py @@ -34,7 +34,7 @@ menu = { } plugin_info = { - 'version': '1.6.4', + 'version': '1.6.5', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', diff --git a/templates/youtube-dl_download.html b/templates/youtube-dl_download.html index 5bc4d51..2d7fa9c 100644 --- a/templates/youtube-dl_download.html +++ b/templates/youtube-dl_download.html @@ -69,7 +69,7 @@ $.notify('URL을 입력하세요.', { type: 'warning' }); - return; + return false; } $.ajax({ url: `/${package_name}/ajax/download`,