v1.0.1 로그 좀 더 상세히 찍도록 수정
This commit is contained in:
@@ -15,7 +15,6 @@ v1.0.0
|
|||||||
* 목록에서 진행률 표시 추가
|
* 목록에서 진행률 표시 추가
|
||||||
|
|
||||||
v0.1.1
|
v0.1.1
|
||||||
* ~~윈도우 환경 지원 추가~~
|
|
||||||
* 다운로드 실패 시 임시파일 삭제가 안 되는 문제 수정
|
* 다운로드 실패 시 임시파일 삭제가 안 되는 문제 수정
|
||||||
|
|
||||||
v0.1.0
|
v0.1.0
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"more": "", "version": "1.0.0", "name": "youtube-dl", "developer": "joyfuI", "home": "https://github.com/joyfuI/youtube-dl", "description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "icon": "", "category_name": "vod"}
|
{"more": "", "version": "1.0.1", "name": "youtube-dl", "developer": "joyfuI", "home": "https://github.com/joyfuI/youtube-dl", "description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "icon": "", "category_name": "vod"}
|
||||||
@@ -78,28 +78,32 @@ class Youtube_dl(object):
|
|||||||
self.status = Status.START
|
self.status = Status.START
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
info_dict = Youtube_dl.get_info_dict(self.url) # 동영상 정보 가져오기
|
try:
|
||||||
if info_dict is None: # 가져오기 실패
|
info_dict = Youtube_dl.get_info_dict(self.url) # 동영상 정보 가져오기
|
||||||
self.status = Status.ERROR
|
if info_dict is None: # 가져오기 실패
|
||||||
return
|
self.status = Status.ERROR
|
||||||
self.extractor = info_dict['extractor']
|
return
|
||||||
self.title = info_dict['title']
|
self.extractor = info_dict['extractor']
|
||||||
self.uploader = info_dict['uploader']
|
self.title = info_dict['title']
|
||||||
self.uploader_url = info_dict['uploader_url']
|
self.uploader = info_dict['uploader']
|
||||||
ydl_opts = {
|
self.uploader_url = info_dict['uploader_url']
|
||||||
'logger': MyLogger(),
|
ydl_opts = {
|
||||||
'progress_hooks': [self.my_hook],
|
'logger': MyLogger(),
|
||||||
# 'match_filter': self.match_filter_func,
|
'progress_hooks': [self.my_hook],
|
||||||
'outtmpl': os.path.join(self.temp_path, self.filename)
|
# 'match_filter': self.match_filter_func,
|
||||||
}
|
'outtmpl': os.path.join(self.temp_path, self.filename)
|
||||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
}
|
||||||
ydl.download([self.url])
|
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||||
if self.status == Status.FINISHED: # 다운로드 성공
|
ydl.download([self.url])
|
||||||
for i in glob.glob(self.temp_path + '/*'):
|
if self.status == Status.FINISHED: # 다운로드 성공
|
||||||
shutil.move(i, self.save_path) # 파일 이동
|
for i in glob.glob(self.temp_path + '/*'):
|
||||||
self.status = Status.COMPLETED
|
shutil.move(i, self.save_path) # 파일 이동
|
||||||
shutil.rmtree(self.temp_path) # 임시폴더 삭제
|
self.status = Status.COMPLETED
|
||||||
self.end_time = datetime.now()
|
shutil.rmtree(self.temp_path) # 임시폴더 삭제
|
||||||
|
self.end_time = datetime.now()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Exception:%s', e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.status = Status.STOP
|
self.status = Status.STOP
|
||||||
@@ -120,6 +124,8 @@ class Youtube_dl(object):
|
|||||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||||
ydl.download([url])
|
ydl.download([url])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.error('Exception:%s', e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
return None
|
return None
|
||||||
return json.loads(Youtube_dl._last_msg)
|
return json.loads(Youtube_dl._last_msg)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user