v1.6.5 info_dict API가 동작하지 않는 문제 수정

This commit is contained in:
joyfuI
2020-08-01 16:38:13 +09:00
committed by GitHub
parent 33b70e3ec7
commit 480f0be4aa
6 changed files with 33 additions and 25 deletions

View File

@@ -131,6 +131,9 @@ API에선 직접 비트레이트를 설정할 수 있습니다.
물론 해당 정보가 없으면 null입니다. 물론 해당 정보가 없으면 null입니다.
## Changelog ## Changelog
v1.6.5
* info_dict API가 동작하지 않는 문제 수정
v1.6.4 v1.6.4
* FFmpeg 경로 설정 추가 * FFmpeg 경로 설정 추가
SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다. SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다.

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

View File

@@ -147,7 +147,7 @@ class LogicNormal(object):
@staticmethod @staticmethod
def get_info_dict(url, proxy): def get_info_dict(url, proxy):
MyYoutubeDL.get_info_dict(url, proxy) return MyYoutubeDL.get_info_dict(url, proxy)
@staticmethod @staticmethod
def human_readable_size(size, suffix=''): def human_readable_size(size, suffix=''):

View File

@@ -63,24 +63,26 @@ class MyYoutubeDL(object):
self.__status = Status.READY self.__status = Status.READY
self.__thread = None self.__thread = None
self.key = None self.key = None
self.start_time = None # 시작 시간 self.start_time = None # 시작 시간
self.end_time = None # 종료 시간 self.end_time = None # 종료 시간
self.info_dict = { # info_dict에서 얻는 정보 # info_dict에서 얻는 정보
'extractor': None, # 타입 self.info_dict = {
'title': None, # 제목 'extractor': None, # 타입
'uploader': None, # 업로더 'title': None, # 제목
'uploader_url': None # 업로더 주소 'uploader': None, # 업로더
'uploader_url': None # 업로더 주소
} }
# info_dict에서 얻는 정보(entries) # info_dict에서 얻는 정보(entries)
# self.info_dict['playlist_index'] = None # self.info_dict['playlist_index'] = None
# self.info_dict['duration'] = None # 길이 # self.info_dict['duration'] = None # 길이
# self.info_dict['format'] = None # 포맷 # self.info_dict['format'] = None # 포맷
# self.info_dict['thumbnail'] = None # 썸네일 # self.info_dict['thumbnail'] = None # 썸네일
self.progress_hooks = { # progress_hooks에서 얻는 정보 # progress_hooks에서 얻는 정보
'downloaded_bytes': None, # 다운로드한 크기 self.progress_hooks = {
'total_bytes': None, # 전체 크기 'downloaded_bytes': None, # 다운로드한 크기
'eta': None, # 예상 시간(s) 'total_bytes': None, # 전체 크기
'speed': None # 다운로드 속도(bytes/s) 'eta': None, # 예상 시간(s)
'speed': None # 다운로드 속도(bytes/s)
} }
def start(self): def start(self):
@@ -96,8 +98,9 @@ class MyYoutubeDL(object):
try: try:
self.start_time = datetime.now() self.start_time = datetime.now()
self.status = Status.START 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 self.status = Status.ERROR
return return
self.info_dict['extractor'] = info_dict['extractor'] self.info_dict['extractor'] = info_dict['extractor']
@@ -122,14 +125,15 @@ class MyYoutubeDL(object):
if not os.path.isdir(path): if not os.path.isdir(path):
os.mkdir(path) os.mkdir(path)
continue continue
celery_shutil.move(i, path) # 파일 이동 celery_shutil.move(i, path)
self.status = Status.COMPLETED self.status = Status.COMPLETED
except Exception as e: except Exception as e:
self.status = Status.ERROR self.status = Status.ERROR
logger.error('Exception:%s', e) logger.error('Exception:%s', e)
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
finally: finally:
celery_shutil.rmtree(self.temp_path) # 임시폴더 삭제 # 임시폴더 삭제
celery_shutil.rmtree(self.temp_path)
if self.status != Status.STOP: if self.status != Status.STOP:
self.end_time = datetime.now() self.end_time = datetime.now()
@@ -170,7 +174,7 @@ class MyYoutubeDL(object):
self.status = { self.status = {
'downloading': Status.DOWNLOADING, 'downloading': Status.DOWNLOADING,
'error': Status.ERROR, 'error': Status.ERROR,
'finished': Status.FINISHED # 다운로드 완료. 변환 시작 'finished': Status.FINISHED # 다운로드 완료. 변환 시작
}[d['status']] }[d['status']]
if d['status'] != 'error': if d['status'] != 'error':
self.filename = os.path.basename(d.get('filename')) self.filename = os.path.basename(d.get('filename'))
@@ -201,7 +205,8 @@ class MyLogger(object):
def debug(self, msg): def debug(self, msg):
MyYoutubeDL._last_msg = msg MyYoutubeDL._last_msg = msg
if msg.find('') != -1 or msg.find('{') != -1: if msg.find('') != -1 or msg.find('{') != -1:
return # 과도한 로그 방지 # 과도한 로그 방지
return
logger.debug(msg) logger.debug(msg)
def warning(self, msg): def warning(self, msg):

View File

@@ -34,7 +34,7 @@ menu = {
} }
plugin_info = { plugin_info = {
'version': '1.6.4', 'version': '1.6.5',
'name': 'youtube-dl', 'name': 'youtube-dl',
'category_name': 'vod', 'category_name': 'vod',
'developer': 'joyfuI', 'developer': 'joyfuI',

View File

@@ -69,7 +69,7 @@
$.notify('<strong>URL을 입력하세요.</strong>', { $.notify('<strong>URL을 입력하세요.</strong>', {
type: 'warning' type: 'warning'
}); });
return; return false;
} }
$.ajax({ $.ajax({
url: `/${package_name}/ajax/download`, url: `/${package_name}/ajax/download`,