2020-02-05 20:54:30 +09:00
|
|
|
import os
|
|
|
|
|
import traceback
|
2022-07-24 21:56:46 +09:00
|
|
|
import json
|
2020-02-05 20:54:30 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
from flask import Blueprint, request, jsonify, abort
|
2020-02-05 20:54:30 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
from framework import app, path_data
|
2021-05-02 00:36:04 +09:00
|
|
|
from framework.logger import get_logger
|
2022-07-10 23:22:28 +09:00
|
|
|
from framework.util import Util
|
|
|
|
|
from framework.common.plugin import (
|
|
|
|
|
get_model_setting,
|
|
|
|
|
Logic,
|
|
|
|
|
default_route_single_module,
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
2020-04-07 13:41:03 +09:00
|
|
|
|
2020-02-05 20:54:30 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
class Plugin:
|
|
|
|
|
package_name = __name__.split(".", maxsplit=1)[0]
|
|
|
|
|
logger = get_logger(package_name)
|
|
|
|
|
blueprint = Blueprint(
|
|
|
|
|
package_name,
|
|
|
|
|
package_name,
|
|
|
|
|
url_prefix=f"/{package_name}",
|
|
|
|
|
template_folder=os.path.join(os.path.dirname(__file__), "templates"),
|
|
|
|
|
static_folder=os.path.join(os.path.dirname(__file__), "static"),
|
|
|
|
|
)
|
2021-02-11 18:08:47 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
# 메뉴 정의
|
|
|
|
|
menu = {
|
|
|
|
|
"main": [package_name, "youtube-dl"],
|
|
|
|
|
"sub": [
|
|
|
|
|
["setting", "설정"],
|
|
|
|
|
["download", "다운로드"],
|
|
|
|
|
["thumbnail", "썸네일 다운로드"],
|
|
|
|
|
["sub", "자막 다운로드"],
|
|
|
|
|
["list", "목록"],
|
|
|
|
|
["log", "로그"],
|
|
|
|
|
],
|
|
|
|
|
"category": "vod",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plugin_info = {
|
|
|
|
|
"version": "4.0.0",
|
|
|
|
|
"name": package_name,
|
|
|
|
|
"category_name": "vod",
|
|
|
|
|
"developer": "joyfuI",
|
|
|
|
|
"description": "유튜브, 네이버TV 등 동영상 사이트에서 동영상 다운로드",
|
|
|
|
|
"home": f"https://github.com/joyfuI/{package_name}",
|
|
|
|
|
"more": "",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ModelSetting = get_model_setting(package_name, logger)
|
|
|
|
|
logic = None
|
|
|
|
|
module_list = None
|
|
|
|
|
home_module = "list" # 기본모듈
|
|
|
|
|
|
|
|
|
|
youtube_dl_packages = ["youtube-dl", "yt-dlp"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize():
|
2020-07-23 23:00:02 +09:00
|
|
|
try:
|
2022-07-10 23:22:28 +09:00
|
|
|
app.config["SQLALCHEMY_BINDS"][
|
|
|
|
|
Plugin.package_name
|
|
|
|
|
] = f"sqlite:///{os.path.join(path_data, 'db', f'{Plugin.package_name}.db')}"
|
|
|
|
|
Util.save_from_dict_to_json(
|
|
|
|
|
Plugin.plugin_info, os.path.join(os.path.dirname(__file__), "info.json")
|
|
|
|
|
)
|
2021-04-27 21:54:48 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
# 로드할 모듈 정의
|
|
|
|
|
from .main import LogicMain
|
2020-02-05 20:54:30 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
Plugin.module_list = [LogicMain(Plugin)]
|
2020-10-11 12:23:38 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
Plugin.logic = Logic(Plugin)
|
|
|
|
|
default_route_single_module(Plugin)
|
2022-05-05 22:04:46 +09:00
|
|
|
except Exception as error:
|
2022-07-10 23:22:28 +09:00
|
|
|
Plugin.logger.error("Exception:%s", error)
|
|
|
|
|
Plugin.logger.error(traceback.format_exc())
|
2020-02-05 20:54:30 +09:00
|
|
|
|
2021-02-11 18:08:47 +09:00
|
|
|
|
2020-02-14 00:49:47 +09:00
|
|
|
# API 명세는 https://github.com/joyfuI/youtube-dl#api
|
2022-07-10 23:22:28 +09:00
|
|
|
@Plugin.blueprint.route("/api/<sub>", methods=["GET", "POST"])
|
2020-02-05 20:54:30 +09:00
|
|
|
def api(sub):
|
2022-07-10 23:22:28 +09:00
|
|
|
from .main import LogicMain
|
|
|
|
|
from .abort import LogicAbort
|
|
|
|
|
|
2020-07-23 23:00:02 +09:00
|
|
|
try:
|
2022-07-10 23:22:28 +09:00
|
|
|
Plugin.logger.debug("API: %s, %s", sub, request.values)
|
|
|
|
|
plugin = request.values.get("plugin")
|
|
|
|
|
if not plugin: # 요청한 플러그인명이 빈문자열이거나 None면
|
|
|
|
|
abort(403) # 403 에러(거부)
|
|
|
|
|
|
2020-07-23 23:00:02 +09:00
|
|
|
# 동영상 정보를 반환하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
if sub == "info_dict":
|
|
|
|
|
url = request.values.get("url")
|
|
|
|
|
ret = {"errorCode": 0, "info_dict": None}
|
2020-07-23 23:00:02 +09:00
|
|
|
if None in (url,):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2022-04-30 18:57:23 +09:00
|
|
|
if not url.startswith("http"):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 2) # 잘못된 동영상 주소
|
|
|
|
|
info_dict = LogicMain.get_info_dict(url, Plugin.ModelSetting.get("proxy"))
|
2020-07-23 23:00:02 +09:00
|
|
|
if info_dict is None:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["info_dict"] = info_dict
|
2020-02-14 00:49:47 +09:00
|
|
|
|
2021-04-25 17:27:27 +09:00
|
|
|
# 비디오 다운로드 준비를 요청하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "download":
|
|
|
|
|
key = request.values.get("key")
|
|
|
|
|
url = request.values.get("url")
|
2022-04-28 00:55:38 +09:00
|
|
|
filename = request.values.get(
|
2022-07-10 23:22:28 +09:00
|
|
|
"filename", Plugin.ModelSetting.get("default_filename")
|
|
|
|
|
)
|
|
|
|
|
save_path = request.values.get(
|
|
|
|
|
"save_path", Plugin.ModelSetting.get("save_path")
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
|
|
|
|
format_code = request.values.get("format", None)
|
|
|
|
|
preferedformat = request.values.get("preferedformat", None)
|
|
|
|
|
preferredcodec = request.values.get("preferredcodec", None)
|
|
|
|
|
preferredquality = request.values.get("preferredquality", 192)
|
|
|
|
|
dateafter = request.values.get("dateafter", None)
|
|
|
|
|
playlist = request.values.get("playlist", None)
|
|
|
|
|
archive = request.values.get("archive", None)
|
|
|
|
|
start = request.values.get("start", False)
|
|
|
|
|
cookiefile = request.values.get("cookiefile", None)
|
2022-07-24 21:56:46 +09:00
|
|
|
headers = request.values.get("headers", None)
|
2022-04-30 18:57:23 +09:00
|
|
|
ret = {"errorCode": 0, "index": None}
|
2020-07-23 23:00:02 +09:00
|
|
|
if None in (key, url):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2022-04-30 18:57:23 +09:00
|
|
|
if not url.startswith("http"):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 2) # 잘못된 동영상 주소
|
2022-04-30 18:57:23 +09:00
|
|
|
if preferredcodec not in (
|
|
|
|
|
None,
|
|
|
|
|
"best",
|
|
|
|
|
"mp3",
|
|
|
|
|
"aac",
|
|
|
|
|
"flac",
|
|
|
|
|
"m4a",
|
|
|
|
|
"opus",
|
|
|
|
|
"vorbis",
|
|
|
|
|
"wav",
|
|
|
|
|
):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 5) # 허용되지 않은 값이 있음
|
2020-10-09 19:16:22 +09:00
|
|
|
if not filename:
|
2022-07-10 23:22:28 +09:00
|
|
|
filename = LogicMain.get_default_filename()
|
|
|
|
|
youtube_dl = LogicMain.download(
|
2022-04-30 18:57:23 +09:00
|
|
|
plugin=plugin,
|
|
|
|
|
url=url,
|
|
|
|
|
filename=filename,
|
2022-07-10 23:22:28 +09:00
|
|
|
temp_path=Plugin.ModelSetting.get("temp_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
save_path=save_path,
|
|
|
|
|
format=format_code,
|
|
|
|
|
preferedformat=preferedformat,
|
|
|
|
|
preferredcodec=preferredcodec,
|
|
|
|
|
preferredquality=preferredquality,
|
|
|
|
|
dateafter=dateafter,
|
|
|
|
|
playlist=playlist,
|
|
|
|
|
archive=archive,
|
2022-07-10 23:22:28 +09:00
|
|
|
proxy=Plugin.ModelSetting.get("proxy"),
|
|
|
|
|
ffmpeg_path=Plugin.ModelSetting.get("ffmpeg_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
key=key,
|
|
|
|
|
cookiefile=cookiefile,
|
2022-07-24 21:56:46 +09:00
|
|
|
headers=json.loads(headers),
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
2020-11-08 22:58:35 +09:00
|
|
|
if youtube_dl is None:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["index"] = youtube_dl.index
|
2020-07-23 23:00:02 +09:00
|
|
|
if start:
|
|
|
|
|
youtube_dl.start()
|
2022-07-10 23:22:28 +09:00
|
|
|
LogicMain.socketio_emit("add", youtube_dl)
|
2020-02-14 00:49:47 +09:00
|
|
|
|
2021-04-25 17:27:27 +09:00
|
|
|
# 썸네일 다운로드 준비를 요청하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "thumbnail":
|
|
|
|
|
key = request.values.get("key")
|
|
|
|
|
url = request.values.get("url")
|
2022-04-28 00:55:38 +09:00
|
|
|
filename = request.values.get(
|
2022-07-10 23:22:28 +09:00
|
|
|
"filename", Plugin.ModelSetting.get("default_filename")
|
|
|
|
|
)
|
|
|
|
|
save_path = request.values.get(
|
|
|
|
|
"save_path", Plugin.ModelSetting.get("save_path")
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
|
|
|
|
all_thumbnails = request.values.get("all_thumbnails", False)
|
|
|
|
|
dateafter = request.values.get("dateafter", None)
|
|
|
|
|
playlist = request.values.get("playlist", None)
|
|
|
|
|
archive = request.values.get("archive", None)
|
|
|
|
|
start = request.values.get("start", False)
|
|
|
|
|
cookiefile = request.values.get("cookiefile", None)
|
2022-07-24 21:56:46 +09:00
|
|
|
headers = request.values.get("headers", None)
|
2022-04-30 18:57:23 +09:00
|
|
|
ret = {"errorCode": 0, "index": None}
|
2021-04-25 17:27:27 +09:00
|
|
|
if None in (key, url):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2022-04-30 18:57:23 +09:00
|
|
|
if not url.startswith("http"):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 2) # 잘못된 동영상 주소
|
2021-04-25 17:27:27 +09:00
|
|
|
if not filename:
|
2022-07-10 23:22:28 +09:00
|
|
|
filename = LogicMain.get_default_filename()
|
|
|
|
|
youtube_dl = LogicMain.thumbnail(
|
2022-04-30 18:57:23 +09:00
|
|
|
plugin=plugin,
|
|
|
|
|
url=url,
|
|
|
|
|
filename=filename,
|
2022-07-10 23:22:28 +09:00
|
|
|
temp_path=Plugin.ModelSetting.get("temp_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
save_path=save_path,
|
|
|
|
|
all_thumbnails=all_thumbnails,
|
|
|
|
|
dateafter=dateafter,
|
|
|
|
|
playlist=playlist,
|
|
|
|
|
archive=archive,
|
2022-07-10 23:22:28 +09:00
|
|
|
proxy=Plugin.ModelSetting.get("proxy"),
|
|
|
|
|
ffmpeg_path=Plugin.ModelSetting.get("ffmpeg_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
key=key,
|
|
|
|
|
cookiefile=cookiefile,
|
2022-07-24 21:56:46 +09:00
|
|
|
headers=json.loads(headers),
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
2021-04-25 17:27:27 +09:00
|
|
|
if youtube_dl is None:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["index"] = youtube_dl.index
|
2021-04-25 17:27:27 +09:00
|
|
|
if start:
|
|
|
|
|
youtube_dl.start()
|
2022-07-10 23:22:28 +09:00
|
|
|
LogicMain.socketio_emit("add", youtube_dl)
|
2021-04-25 17:27:27 +09:00
|
|
|
|
2021-04-27 21:54:48 +09:00
|
|
|
# 자막 다운로드 준비를 요청하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "sub":
|
|
|
|
|
key = request.values.get("key")
|
|
|
|
|
url = request.values.get("url")
|
2022-04-28 00:55:38 +09:00
|
|
|
filename = request.values.get(
|
2022-07-10 23:22:28 +09:00
|
|
|
"filename", Plugin.ModelSetting.get("default_filename")
|
|
|
|
|
)
|
|
|
|
|
save_path = request.values.get(
|
|
|
|
|
"save_path", Plugin.ModelSetting.get("save_path")
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
|
|
|
|
all_subs = request.values.get("all_subs", False)
|
|
|
|
|
sub_lang = request.values.get("sub_lang", "ko")
|
|
|
|
|
auto_sub = request.values.get("all_subs", False)
|
|
|
|
|
dateafter = request.values.get("dateafter", None)
|
|
|
|
|
playlist = request.values.get("playlist", None)
|
|
|
|
|
archive = request.values.get("archive", None)
|
|
|
|
|
start = request.values.get("start", False)
|
|
|
|
|
cookiefile = request.values.get("cookiefile", None)
|
2022-07-24 21:56:46 +09:00
|
|
|
headers = request.values.get("headers", None)
|
2022-04-30 18:57:23 +09:00
|
|
|
ret = {"errorCode": 0, "index": None}
|
2021-04-27 21:54:48 +09:00
|
|
|
if None in (key, url):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2022-04-30 18:57:23 +09:00
|
|
|
if not url.startswith("http"):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 2) # 잘못된 동영상 주소
|
2021-04-27 21:54:48 +09:00
|
|
|
if not filename:
|
2022-07-10 23:22:28 +09:00
|
|
|
filename = LogicMain.get_default_filename()
|
|
|
|
|
youtube_dl = LogicMain.sub(
|
2022-04-30 18:57:23 +09:00
|
|
|
plugin=plugin,
|
|
|
|
|
url=url,
|
|
|
|
|
filename=filename,
|
2022-07-10 23:22:28 +09:00
|
|
|
temp_path=Plugin.ModelSetting.get("temp_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
save_path=save_path,
|
|
|
|
|
all_subs=all_subs,
|
|
|
|
|
sub_lang=sub_lang,
|
|
|
|
|
auto_sub=auto_sub,
|
|
|
|
|
dateafter=dateafter,
|
|
|
|
|
playlist=playlist,
|
|
|
|
|
archive=archive,
|
2022-07-10 23:22:28 +09:00
|
|
|
proxy=Plugin.ModelSetting.get("proxy"),
|
|
|
|
|
ffmpeg_path=Plugin.ModelSetting.get("ffmpeg_path"),
|
2022-04-30 18:57:23 +09:00
|
|
|
key=key,
|
|
|
|
|
cookiefile=cookiefile,
|
2022-07-24 21:56:46 +09:00
|
|
|
headers=json.loads(headers),
|
2022-04-30 18:57:23 +09:00
|
|
|
)
|
2021-04-27 21:54:48 +09:00
|
|
|
if youtube_dl is None:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["index"] = youtube_dl.index
|
2021-04-27 21:54:48 +09:00
|
|
|
if start:
|
|
|
|
|
youtube_dl.start()
|
2022-07-10 23:22:28 +09:00
|
|
|
LogicMain.socketio_emit("add", youtube_dl)
|
2021-04-27 21:54:48 +09:00
|
|
|
|
2020-07-23 23:00:02 +09:00
|
|
|
# 다운로드 시작을 요청하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "start":
|
|
|
|
|
index = request.values.get("index")
|
|
|
|
|
key = request.values.get("key")
|
|
|
|
|
ret = {"errorCode": 0, "status": None}
|
2020-07-23 23:00:02 +09:00
|
|
|
if None in (index, key):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2020-07-23 23:00:02 +09:00
|
|
|
index = int(index)
|
2022-07-10 23:22:28 +09:00
|
|
|
if not 0 <= index < len(LogicMain.youtube_dl_list):
|
|
|
|
|
return LogicAbort.abort(ret, 3) # 인덱스 범위를 벗어남
|
|
|
|
|
youtube_dl = LogicMain.youtube_dl_list[index]
|
2020-07-23 23:00:02 +09:00
|
|
|
if youtube_dl.key != key:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 4) # 키가 일치하지 않음
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["status"] = youtube_dl.status.name
|
2020-07-23 23:00:02 +09:00
|
|
|
if not youtube_dl.start():
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2020-02-14 00:49:47 +09:00
|
|
|
|
2020-07-23 23:00:02 +09:00
|
|
|
# 다운로드 중지를 요청하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "stop":
|
|
|
|
|
index = request.values.get("index")
|
|
|
|
|
key = request.values.get("key")
|
|
|
|
|
ret = {"errorCode": 0, "status": None}
|
2020-07-23 23:00:02 +09:00
|
|
|
if None in (index, key):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2020-07-23 23:00:02 +09:00
|
|
|
index = int(index)
|
2022-07-10 23:22:28 +09:00
|
|
|
if not 0 <= index < len(LogicMain.youtube_dl_list):
|
|
|
|
|
return LogicAbort.abort(ret, 3) # 인덱스 범위를 벗어남
|
|
|
|
|
youtube_dl = LogicMain.youtube_dl_list[index]
|
2020-07-23 23:00:02 +09:00
|
|
|
if youtube_dl.key != key:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 4) # 키가 일치하지 않음
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["status"] = youtube_dl.status.name
|
2020-07-23 23:00:02 +09:00
|
|
|
if not youtube_dl.stop():
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 10) # 실패
|
2020-02-14 00:49:47 +09:00
|
|
|
|
2020-07-23 23:00:02 +09:00
|
|
|
# 현재 상태를 반환하는 API
|
2022-04-30 18:57:23 +09:00
|
|
|
elif sub == "status":
|
|
|
|
|
index = request.values.get("index")
|
|
|
|
|
key = request.values.get("key")
|
2020-07-23 23:00:02 +09:00
|
|
|
ret = {
|
2022-04-30 18:57:23 +09:00
|
|
|
"errorCode": 0,
|
|
|
|
|
"status": None,
|
|
|
|
|
"type": None,
|
|
|
|
|
"start_time": None,
|
|
|
|
|
"end_time": None,
|
|
|
|
|
"temp_path": None,
|
|
|
|
|
"save_path": None,
|
2020-07-23 23:00:02 +09:00
|
|
|
}
|
|
|
|
|
if None in (index, key):
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 1) # 필수 요청 변수가 없음
|
2020-07-23 23:00:02 +09:00
|
|
|
index = int(index)
|
2022-07-10 23:22:28 +09:00
|
|
|
if not 0 <= index < len(LogicMain.youtube_dl_list):
|
|
|
|
|
return LogicAbort.abort(ret, 3) # 인덱스 범위를 벗어남
|
|
|
|
|
youtube_dl = LogicMain.youtube_dl_list[index]
|
2020-07-23 23:00:02 +09:00
|
|
|
if youtube_dl.key != key:
|
2022-07-10 23:22:28 +09:00
|
|
|
return LogicAbort.abort(ret, 4) # 키가 일치하지 않음
|
2022-04-30 18:57:23 +09:00
|
|
|
ret["status"] = youtube_dl.status.name
|
|
|
|
|
ret["type"] = youtube_dl.type
|
|
|
|
|
ret["start_time"] = (
|
|
|
|
|
youtube_dl.start_time.strftime("%Y-%m-%dT%H:%M:%S")
|
|
|
|
|
if youtube_dl.start_time is not None
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
ret["end_time"] = (
|
|
|
|
|
youtube_dl.end_time.strftime("%Y-%m-%dT%H:%M:%S")
|
|
|
|
|
if youtube_dl.end_time is not None
|
|
|
|
|
else None
|
|
|
|
|
)
|
|
|
|
|
ret["temp_path"] = youtube_dl.temp_path
|
|
|
|
|
ret["save_path"] = youtube_dl.save_path
|
2022-07-10 23:22:28 +09:00
|
|
|
|
|
|
|
|
return jsonify(ret)
|
2022-05-05 22:04:46 +09:00
|
|
|
except Exception as error:
|
2022-07-10 23:22:28 +09:00
|
|
|
Plugin.logger.error("Exception:%s", error)
|
|
|
|
|
Plugin.logger.error(traceback.format_exc())
|
2021-02-11 18:08:47 +09:00
|
|
|
|
2020-03-01 01:34:59 +09:00
|
|
|
|
2022-07-10 23:22:28 +09:00
|
|
|
logger = Plugin.logger
|
|
|
|
|
initialize()
|