인프런 업로드
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"version": "0.3.1.0",
|
"version": "0.0.1.0",
|
||||||
"name": "linkkf-yommi",
|
"name": "inflearn",
|
||||||
"category_name": "vod",
|
"category_name": "vod",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"developer": "projectdx && persuade",
|
"developer": "projectdx",
|
||||||
"description": "linkkf 사이트에서 애니 다운로드",
|
"description": "인프런 강좌 사이트 에서 강좌 다운로드",
|
||||||
"home": "https://github.com/projectdx75/linkkf-yommi",
|
"home": "https://github.com/projectdx75/linkkf-yommi",
|
||||||
"more": "",
|
"more": "",
|
||||||
"category": "vod"
|
"category": "vod"
|
||||||
|
|||||||
2
logic.py
2
logic.py
@@ -30,7 +30,7 @@ logger = get_logger(package_name)
|
|||||||
|
|
||||||
class Logic(object):
|
class Logic(object):
|
||||||
db_default = {
|
db_default = {
|
||||||
"inflearn_url": "https://www.inflearn.com/",
|
"inflearn_url": "https://www.inflearn.com",
|
||||||
"download_path": os.path.join(path_data, "inflearn"),
|
"download_path": os.path.join(path_data, "inflearn"),
|
||||||
"inflearn_auto_make_folder": "True",
|
"inflearn_auto_make_folder": "True",
|
||||||
"inflearn_auto_make_season_folder": "True",
|
"inflearn_auto_make_season_folder": "True",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ for package in packages:
|
|||||||
import requests
|
import requests
|
||||||
from lxml import html, etree
|
from lxml import html, etree
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
# import snoop
|
# import snoop
|
||||||
# from snoop import spy
|
# from snoop import spy
|
||||||
@@ -43,7 +44,7 @@ from framework.logger import get_logger
|
|||||||
# 패키지
|
# 패키지
|
||||||
# from .plugin import package_name, logger
|
# from .plugin import package_name, logger
|
||||||
# from anime_downloader.logic_ohli24 import ModelOhli24Item
|
# from anime_downloader.logic_ohli24 import ModelOhli24Item
|
||||||
from .model import ModelSetting, ModelLinkkf, ModelLinkkfProgram
|
from .model import ModelSetting, ModelInflearn, ModelInflearnProgram
|
||||||
from .logic_queue import LogicQueue
|
from .logic_queue import LogicQueue
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -62,6 +63,7 @@ class LogicInflearn(object):
|
|||||||
session = None
|
session = None
|
||||||
referer = None
|
referer = None
|
||||||
current_data = None
|
current_data = None
|
||||||
|
season = "1"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_html(url):
|
def get_html(url):
|
||||||
@@ -182,7 +184,7 @@ class LogicInflearn(object):
|
|||||||
ret = {}
|
ret = {}
|
||||||
if LogicInflearn.current_data is not None:
|
if LogicInflearn.current_data is not None:
|
||||||
program = (
|
program = (
|
||||||
db.session.query(ModelLinkkfProgram)
|
db.session.query(ModelInflearnProgram)
|
||||||
.filter_by(programcode=LogicInflearn.current_data["code"])
|
.filter_by(programcode=LogicInflearn.current_data["code"])
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
@@ -219,7 +221,7 @@ class LogicInflearn(object):
|
|||||||
season = int(new_season)
|
season = int(new_season)
|
||||||
if LogicInflearn.current_data is not None:
|
if LogicInflearn.current_data is not None:
|
||||||
program = (
|
program = (
|
||||||
db.session.query(ModelLinkkfProgram)
|
db.session.query(ModelInflearnProgram)
|
||||||
.filter_by(programcode=LogicInflearn.current_data["code"])
|
.filter_by(programcode=LogicInflearn.current_data["code"])
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
@@ -292,9 +294,9 @@ class LogicInflearn(object):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_airing_info():
|
def get_lecture_list():
|
||||||
try:
|
try:
|
||||||
url = f"{ModelSetting.get('inflearn_url')}/airing"
|
url = f"{ModelSetting.get('inflearn_url')}/curation/latest?page=1"
|
||||||
html_content = LogicInflearn.get_html(url)
|
html_content = LogicInflearn.get_html(url)
|
||||||
download_path = ModelSetting.get("download_path")
|
download_path = ModelSetting.get("download_path")
|
||||||
tree = html.fromstring(html_content)
|
tree = html.fromstring(html_content)
|
||||||
@@ -386,45 +388,66 @@ class LogicInflearn(object):
|
|||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_anime_list_info(cate, page):
|
def get_lecture_list_info(cate, page):
|
||||||
try:
|
try:
|
||||||
if cate == "ing":
|
url = ""
|
||||||
url = f"{ModelSetting.get('inflearn_url')}/airing/page/{page}"
|
if cate == "recent":
|
||||||
elif cate == "complete":
|
# url = f"{ModelSetting.get('inflearn_url')}/curation/latest?page={page}&order={cate}"
|
||||||
url = f"{ModelSetting.get('inflearn_url')}/anime-list/page/{page}"
|
url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
logger.debug(f"get_anime_list_info():url >> {url}")
|
elif cate == "rating":
|
||||||
|
url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
elif cate == "popular":
|
||||||
|
url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
elif cate == "seq":
|
||||||
|
url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
logger.debug(f"get_lecture_list_info():url >> {url}")
|
||||||
|
|
||||||
html_content = LogicInflearn.get_html(url)
|
html_content = LogicInflearn.get_html(url)
|
||||||
download_path = ModelSetting.get("download_path")
|
# logger.debug("html_content: %s", html_content)
|
||||||
|
|
||||||
tree = html.fromstring(html_content)
|
tree = html.fromstring(html_content)
|
||||||
tmp_items = tree.xpath('//div[@class="item"]')
|
tmp_items = tree.xpath(
|
||||||
# logger.info('tmp_items:::', tmp_items)
|
'//div[contains(@class, "courses_card_list_body")]/div'
|
||||||
|
)
|
||||||
|
# logger.info("tmp_items::: %s", tmp_items)
|
||||||
|
|
||||||
data = {"ret": "success", "page": page}
|
data = {
|
||||||
|
"ret": "success",
|
||||||
data["total_page"] = tree.xpath('//*[@id="wp_page"]//text()')[-1]
|
"page": page,
|
||||||
data["episode_count"] = len(tmp_items)
|
"total_page": 100,
|
||||||
data["episode"] = []
|
"episode_count": len(tmp_items),
|
||||||
|
"episode": [],
|
||||||
|
}
|
||||||
|
|
||||||
for item in tmp_items:
|
for item in tmp_items:
|
||||||
entity = {}
|
entity = {}
|
||||||
entity["link"] = item.xpath(".//a/@href")[0]
|
entity["link"] = item.xpath(".//a/@href")[0]
|
||||||
entity["code"] = re.search(r"[0-9]+", entity["link"]).group()
|
entity["code"] = entity["link"].split("/")[-1]
|
||||||
entity["title"] = item.xpath('.//span[@class="name-film"]//text()')[
|
entity["_code"] = item.xpath("/div/@data-productid")
|
||||||
|
# logger.debug(item)
|
||||||
|
# entity["code"] = 1
|
||||||
|
entity["title"] = item.xpath('.//p[@class="course_title"]/text()')[
|
||||||
0
|
0
|
||||||
].strip()
|
].strip()
|
||||||
entity["image_link"] = item.xpath(
|
entity["teacher"] = item.xpath('.//div[@class="instructor"]/text()')[
|
||||||
'.//img[@class="photo"]/@data-lazy-src'
|
0
|
||||||
)[0]
|
].strip()
|
||||||
entity["chapter"] = item.xpath(".//a/button/span//text()")[0]
|
# entity["price"] = item.xpath(
|
||||||
|
# './/div[@class="price"]//span[@class="pay_price"]/text()'
|
||||||
|
# )[0].strip()
|
||||||
|
entity["price"] = item.xpath('.//div[@class="price"]/text()')
|
||||||
|
entity["image_link"] = item.xpath('.//img[@class="swiper-lazy"]/@src')
|
||||||
|
entity["chapter"] = entity["price"]
|
||||||
|
# entity["chapter"] = item.xpath(".//a/button/span//text()")[0]
|
||||||
# logger.info('entity:::', entity['title'])
|
# logger.info('entity:::', entity['title'])
|
||||||
data["episode"].append(entity)
|
data["episode"].append(entity)
|
||||||
|
|
||||||
json_file_path = os.path.join(download_path, "airing_list.json")
|
# json_file_path = os.path.join(download_path, "airing_list.json")
|
||||||
logger.debug("json_file_path:: %s", json_file_path)
|
# logger.debug("json_file_path:: %s", json_file_path)
|
||||||
|
|
||||||
with open(json_file_path, "w") as outfile:
|
# with open(json_file_path, "w") as outfile:
|
||||||
json.dump(data, outfile)
|
# json.dump(data, outfile)
|
||||||
|
# logger.debug("data:: %s", data)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@@ -432,6 +455,73 @@ class LogicInflearn(object):
|
|||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
# @staticmethod
|
||||||
|
# def get_lecture_list_info(cate, page):
|
||||||
|
# try:
|
||||||
|
# url = ""
|
||||||
|
# if cate == "recent":
|
||||||
|
# # url = f"{ModelSetting.get('inflearn_url')}/curation/latest?page={page}&order={cate}"
|
||||||
|
# url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
# elif cate == "rating":
|
||||||
|
# url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
# elif cate == "popular":
|
||||||
|
# url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
# elif cate == "seq":
|
||||||
|
# url = f"{ModelSetting.get('inflearn_url')}/courses?page={page}&order={cate}"
|
||||||
|
# logger.debug(f"get_lecture_list_info():url >> {url}")
|
||||||
|
#
|
||||||
|
# html_content = LogicInflearn.get_html(url)
|
||||||
|
# # logger.debug("html_content: %s", html_content)
|
||||||
|
#
|
||||||
|
# tree = html.fromstring(html_content)
|
||||||
|
# tmp_items = tree.xpath(
|
||||||
|
# '//ul[@class="tag-courses__list e-tag-courses__list"]/li'
|
||||||
|
# )
|
||||||
|
# # logger.info("tmp_items::: %s", tmp_items)
|
||||||
|
#
|
||||||
|
# data = {
|
||||||
|
# "ret": "success",
|
||||||
|
# "page": page,
|
||||||
|
# "total_page": 100,
|
||||||
|
# "episode_count": len(tmp_items),
|
||||||
|
# "episode": [],
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# for item in tmp_items:
|
||||||
|
# entity = {}
|
||||||
|
# entity["link"] = item.xpath(".//a/@href")[0]
|
||||||
|
# entity["code"] = entity["link"].split("/")[-1]
|
||||||
|
# entity["_code"] = item.attrib["data-id"]
|
||||||
|
# # logger.debug(item)
|
||||||
|
# # entity["code"] = 1
|
||||||
|
# entity["title"] = item.xpath('.//div[@class="info__basic"]//h3/text()')[
|
||||||
|
# 0
|
||||||
|
# ].strip()
|
||||||
|
# entity["teacher"] = item.xpath(
|
||||||
|
# './/div[@class="info__basic"]//h4/text()'
|
||||||
|
# )[0].strip()
|
||||||
|
# entity["price"] = item.xpath(
|
||||||
|
# './/div[@class="course-card__price"]/dd/text()'
|
||||||
|
# )[0].strip()
|
||||||
|
# entity["image_link"] = item.xpath('.//img[@class="swiper-lazy"]/@src')
|
||||||
|
# entity["chapter"] = entity["price"]
|
||||||
|
# # entity["chapter"] = item.xpath(".//a/button/span//text()")[0]
|
||||||
|
# # logger.info('entity:::', entity['title'])
|
||||||
|
# data["episode"].append(entity)
|
||||||
|
#
|
||||||
|
# # json_file_path = os.path.join(download_path, "airing_list.json")
|
||||||
|
# # logger.debug("json_file_path:: %s", json_file_path)
|
||||||
|
#
|
||||||
|
# # with open(json_file_path, "w") as outfile:
|
||||||
|
# # json.dump(data, outfile)
|
||||||
|
# # logger.debug("data:: %s", data)
|
||||||
|
#
|
||||||
|
# return data
|
||||||
|
#
|
||||||
|
# except Exception as e:
|
||||||
|
# logger.error("Exception:%s", e)
|
||||||
|
# logger.error(traceback.format_exc())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_screen_movie_info(page):
|
def get_screen_movie_info(page):
|
||||||
try:
|
try:
|
||||||
@@ -473,246 +563,168 @@ class LogicInflearn(object):
|
|||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_complete_anilist_info(page):
|
|
||||||
try:
|
|
||||||
url = f"{ModelSetting.get('inflearn_url')}/anime-list/page/{page}"
|
|
||||||
|
|
||||||
html_content = LogicInflearn.get_html(url)
|
|
||||||
download_path = ModelSetting.get("download_path")
|
|
||||||
tree = html.fromstring(html_content)
|
|
||||||
tmp_items = tree.xpath('//div[@class="item"]')
|
|
||||||
# logger.info('tmp_items:::', tmp_items)
|
|
||||||
|
|
||||||
data = {"ret": "success", "page": page}
|
|
||||||
|
|
||||||
data["episode_count"] = len(tmp_items)
|
|
||||||
data["episode"] = []
|
|
||||||
|
|
||||||
if tree.xpath('//*[@id="wp_page"]//text()'):
|
|
||||||
data["total_page"] = tree.xpath('//*[@id="wp_page"]//text()')[-1]
|
|
||||||
else:
|
|
||||||
data["total_page"] = 0
|
|
||||||
|
|
||||||
for item in tmp_items:
|
|
||||||
entity = {}
|
|
||||||
entity["link"] = item.xpath(".//a/@href")[0]
|
|
||||||
entity["code"] = re.search(r"[0-9]+", entity["link"]).group()
|
|
||||||
entity["title"] = item.xpath('.//span[@class="name-film"]//text()')[
|
|
||||||
0
|
|
||||||
].strip()
|
|
||||||
entity["image_link"] = item.xpath(
|
|
||||||
'.//img[@class="photo"]/@data-lazy-src'
|
|
||||||
)[0]
|
|
||||||
# logger.info('entity:::', entity['title'])
|
|
||||||
data["episode"].append(entity)
|
|
||||||
|
|
||||||
json_file_path = os.path.join(download_path, "airing_list.json")
|
|
||||||
logger.debug("json_file_path:: %s", json_file_path)
|
|
||||||
|
|
||||||
with open(json_file_path, "w") as outfile:
|
|
||||||
json.dump(data, outfile)
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("Exception:%s", e)
|
|
||||||
logger.error(traceback.format_exc())
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_title_info(code):
|
def get_title_info(code):
|
||||||
try:
|
try:
|
||||||
if (
|
# if (
|
||||||
LogicInflearn.current_data is not None
|
# LogicInflearn.current_data is not None
|
||||||
and LogicInflearn.current_data["code"] == code
|
# and LogicInflearn.current_data["code"] == code
|
||||||
and LogicInflearn.current_data["ret"]
|
# and LogicInflearn.current_data["ret"]
|
||||||
):
|
# ):
|
||||||
return LogicInflearn.current_data
|
# return LogicInflearn.current_data
|
||||||
url = "%s/%s" % (ModelSetting.get("inflearn_url"), code)
|
url = "%s/course/%s" % (ModelSetting.get("inflearn_url"), parse.quote(code))
|
||||||
# logger.info(url)
|
logger.info(url)
|
||||||
html_content = LogicInflearn.get_html(url)
|
html_content = LogicInflearn.get_html(url)
|
||||||
sys.setrecursionlimit(10**7)
|
sys.setrecursionlimit(10**7)
|
||||||
# logger.info(html_content)
|
# logger.info(html_content)
|
||||||
tree = html.fromstring(html_content)
|
# tree = html.fromstring(html_content)
|
||||||
# tree = etree.fromstring(
|
# tree = etree.fromstring(
|
||||||
# html_content, parser=etree.XMLParser(huge_tree=True)
|
# html_content, parser=etree.XMLParser(huge_tree=True)
|
||||||
# )
|
# )
|
||||||
# tree1 = BeautifulSoup(html_content, "lxml")
|
# tree1 = BeautifulSoup(html_content, "lxml")
|
||||||
|
|
||||||
soup = BeautifulSoup(html_content, "html.parser")
|
|
||||||
# tree = etree.HTML(str(soup))
|
# tree = etree.HTML(str(soup))
|
||||||
# logger.info(tree)
|
# logger.info(tree)
|
||||||
|
|
||||||
data = {"code": code, "ret": False}
|
data = {"code": code, "ret": False}
|
||||||
# //*[@id="body"]/div/div[1]/article/center/strong
|
|
||||||
# tmp = tree.xpath('/html/body/div[2]/div/div/article/center/strong'
|
|
||||||
# )[0].text_content().strip().encode('utf8')
|
|
||||||
# tmp = tree.xpath('//*[@id="body"]/div/div[1]/article/center/strong')[0].text_content().strip()
|
|
||||||
# logger.info('tmp::>', tree.xpath('//div[@class="hrecipe"]/article/center/strong'))
|
|
||||||
# tmp1 = tree.xpath("//div[contains(@id, 'related')]/ul/a")
|
|
||||||
# tmp = tree1.find_element(By.Xpath, "//ul/a")
|
|
||||||
tmp = soup.select("ul > a")
|
|
||||||
|
|
||||||
# logger.debug(f"tmp1 size:=> {str(len(tmp))}")
|
soup = BeautifulSoup(html_content, "html.parser")
|
||||||
|
# logger.debug(soup.select_one("div.cd-header__thumbnail-cover"))
|
||||||
try:
|
data["poster_url"] = soup.select_one(
|
||||||
tmp = (
|
"div.cd-header__thumbnail-cover div img"
|
||||||
tree.xpath('//div[@class="hrecipe"]/article/center/strong')[0]
|
)["src"]
|
||||||
.text_content()
|
data["title"] = soup.select_one("div.cd-header__title").text
|
||||||
.strip()
|
main_title = soup.select_one("div.cd-header__title").text
|
||||||
)
|
# data["item_id"] = soup.select_one('meta[property="dable:item_id"]')[
|
||||||
except IndexError:
|
# "content"
|
||||||
tmp = tree.xpath("//article/center/strong")[0].text_content().strip()
|
# ]
|
||||||
|
# item_id = data["item_id"]
|
||||||
# print(tmp)
|
data["save_folder"] = data["title"]
|
||||||
# logger.info(tmp)
|
|
||||||
match = re.compile(r"(?P<season>\d+)기").search(tmp)
|
|
||||||
if match:
|
|
||||||
data["season"] = match.group("season")
|
|
||||||
else:
|
|
||||||
data["season"] = "1"
|
data["season"] = "1"
|
||||||
|
|
||||||
# replace_str = f'({data["season"]}기)'
|
# tmp = soup.select("ul > a")
|
||||||
# logger.info(replace_str)
|
|
||||||
data["_id"] = str(code)
|
|
||||||
data["title"] = tmp.replace(data["season"] + "기", "").strip()
|
|
||||||
data["title"] = data["title"].replace("()", "").strip()
|
|
||||||
data["title"] = (
|
|
||||||
Util.change_text_for_use_filename(data["title"])
|
|
||||||
.replace("OVA", "")
|
|
||||||
.strip()
|
|
||||||
)
|
|
||||||
# logger.info(f"title:: {data['title']}")
|
|
||||||
try:
|
|
||||||
# data['poster_url'] = tree.xpath(
|
|
||||||
# '//*[@id="body"]/div/div/div[1]/center/img'
|
|
||||||
# )[0].attrib['data-src']
|
|
||||||
|
|
||||||
data["poster_url"] = tree.xpath(
|
# logger.debug(f"tmp1 size:=> {str(len(tmp))}")
|
||||||
'//*[@id="body"]/div/div[1]/div[1]/center/img'
|
curriculum_content = soup.find_all("a", {"class": "cd-accordion__unit"})
|
||||||
)[0].attrib["data-lazy-src"]
|
preview_path = []
|
||||||
data["detail"] = [
|
for i, elem in enumerate(curriculum_content):
|
||||||
{
|
# print(elem)
|
||||||
"info": tree.xpath("/html/body/div[2]/div/div[1]/div[1]")[0]
|
preview_path.append(elem["href"])
|
||||||
.text_content()
|
# print(f"{i}. {elem['href']}")
|
||||||
.strip()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
except Exception as e:
|
|
||||||
data["detail"] = [{"정보없음": ""}]
|
|
||||||
data["poster_url"] = None
|
|
||||||
|
|
||||||
data["rate"] = tree.xpath('span[@class="tag-score"]')
|
# 미리보기 가능 1번 동영상 뷰 페이지로 이동
|
||||||
# tag_score = tree.xpath('//span[@class="taq-score"]').text_content().strip()
|
# self.getVideoInfo(preview_path[0])
|
||||||
tag_score = tree.xpath('//span[@class="taq-score"]')[0].text_content()
|
base_url = "https://www.inflearn.com"
|
||||||
# logger.debug(tag_score)
|
url = base_url + parse.quote(preview_path[0])
|
||||||
tag_count = (
|
logger.debug(f"url::::: {url}")
|
||||||
tree.xpath('//span[contains(@class, "taq-count")]')[0]
|
|
||||||
.text_content()
|
|
||||||
.strip()
|
|
||||||
)
|
|
||||||
data_rate = tree.xpath('//div[@class="rating"]/div/@data-rate')
|
|
||||||
# logger.debug("data_rate::> %s", data_rate)
|
|
||||||
# tmp = tree.xpath('//*[@id="relatedpost"]/ul/li')
|
|
||||||
# tmp = tree.xpath('//article/a')
|
|
||||||
# 수정된
|
|
||||||
# tmp = tree.xpath("//ul/a")
|
|
||||||
tmp = soup.select("ul > a")
|
|
||||||
|
|
||||||
# logger.debug(f"tmp size:=> {str(len(tmp))}")
|
resData = requests.get(url, timeout=20)
|
||||||
# logger.info(tmp)
|
|
||||||
if tmp is not None:
|
|
||||||
data["episode_count"] = str(len(tmp))
|
|
||||||
else:
|
|
||||||
data["episode_count"] = "0"
|
|
||||||
|
|
||||||
data["episode"] = []
|
if resData.url != url:
|
||||||
# tags = tree.xpath(
|
# redirect occurred; likely symbol doesn't exist or cannot be found.
|
||||||
# '//*[@id="syno-nsc-ext-gen3"]/article/div[1]/article/a')
|
raise requests.TooManyRedirects()
|
||||||
# tags = tree.xpath("//ul/a")
|
|
||||||
tags = soup.select("ul > a")
|
|
||||||
|
|
||||||
# logger.info("tags", tags)
|
resData.raise_for_status()
|
||||||
# re1 = re.compile(r'\/(?P<code>\d+)')
|
|
||||||
re1 = re.compile(r"\-([^-])+\.")
|
|
||||||
|
|
||||||
data["save_folder"] = data["title"]
|
# soup = BeautifulSoup(resData.text, "html.parser")
|
||||||
# logger.debug(f"save_folder::> {data['save_folder']}")
|
soup = BeautifulSoup(resData.text, "html.parser")
|
||||||
|
|
||||||
|
items = soup.find_all("div", attrs={"class": "unit-el"})
|
||||||
|
# print(len(items))
|
||||||
|
lecture_list = []
|
||||||
|
|
||||||
|
# create xlsx file
|
||||||
|
# wb = Workbook()
|
||||||
|
# ws = wb.active # create xlsx sheet
|
||||||
|
# ws.append(
|
||||||
|
# ["title", "data_id", "run_time", "api_url", "file_name", "hlsUrl"]
|
||||||
|
# )
|
||||||
|
|
||||||
|
temp = []
|
||||||
|
|
||||||
|
# print(type(items))
|
||||||
program = (
|
program = (
|
||||||
db.session.query(ModelLinkkfProgram).filter_by(programcode=code).first()
|
db.session.query(ModelInflearnProgram)
|
||||||
|
.filter_by(programcode=code)
|
||||||
|
.first()
|
||||||
)
|
)
|
||||||
|
|
||||||
if program is None:
|
if program is None:
|
||||||
program = ModelLinkkfProgram(data)
|
program = ModelInflearnProgram(data)
|
||||||
db.session.add(program)
|
db.session.add(program)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
else:
|
else:
|
||||||
data["save_folder"] = program.save_folder
|
data["save_folder"] = program.save_folder
|
||||||
data["season"] = program.season
|
data["season"] = program.season
|
||||||
|
|
||||||
idx = 1
|
for idx, item in enumerate(items):
|
||||||
for t in tags:
|
#
|
||||||
entity = {
|
temp1 = {}
|
||||||
"_id": data["code"],
|
print("idx::", idx)
|
||||||
"program_code": data["code"],
|
data_id = item["data-id"]
|
||||||
"program_title": data["title"],
|
|
||||||
"save_folder": Util.change_text_for_use_filename(
|
run_time = ""
|
||||||
|
title = item.find("div", attrs={"class": "title"}).get_text()
|
||||||
|
if item.find("span", {"class": "runtime"}) is not None:
|
||||||
|
run_time = item.find("span", {"class": "runtime"}).get_text()
|
||||||
|
api_url = f"{base_url}/api/course/{code}/lecture/{data_id}"
|
||||||
|
|
||||||
|
temp1["season"] = "1"
|
||||||
|
LogicInflearn.season = "1"
|
||||||
|
# logger.debug(api_url)
|
||||||
|
m3u8_info = LogicInflearn.getM3u8_info(
|
||||||
|
api_url, LogicInflearn.season, idx
|
||||||
|
)
|
||||||
|
# print(api_url)
|
||||||
|
# print('type::::', type(m3u8_url))
|
||||||
|
logger.debug(m3u8_info)
|
||||||
|
# ws.append(
|
||||||
|
# [
|
||||||
|
# title,
|
||||||
|
# data_id,
|
||||||
|
# run_time,
|
||||||
|
# api_url,
|
||||||
|
# m3u8_info["name"],
|
||||||
|
# m3u8_info["hlsUrl"],
|
||||||
|
# ]
|
||||||
|
# )
|
||||||
|
|
||||||
|
# temp.append(title, data_id, run_time, api_url,m3u8_info['name'], m3u8_info['hlsUrl'])
|
||||||
|
# temp1['title'] = title
|
||||||
|
temp1["save_folder"] = Util.change_text_for_use_filename(
|
||||||
data["save_folder"]
|
data["save_folder"]
|
||||||
),
|
)
|
||||||
"title": t.text.strip(),
|
|
||||||
# "title": t.text_content().strip(),
|
|
||||||
}
|
|
||||||
# entity['code'] = re1.search(t.attrib['href']).group('code')
|
|
||||||
|
|
||||||
# logger.debug(f"title ::>{entity['title']}")
|
# logger.debug(temp1["save_folder"])
|
||||||
|
|
||||||
# 고유id임을 알수 없는 말도 안됨..
|
|
||||||
# 에피소드 코드가 고유해야 상태값 갱신이 제대로 된 값에 넣어짐
|
|
||||||
p = re.compile(r"([0-9]+)화?")
|
|
||||||
m_obj = p.match(entity["title"])
|
|
||||||
# logger.info(m_obj.group())
|
|
||||||
# entity['code'] = data['code'] + '_' +str(idx)
|
|
||||||
|
|
||||||
episode_code = None
|
|
||||||
# logger.debug(f"m_obj::> {m_obj}")
|
|
||||||
if m_obj is not None:
|
|
||||||
episode_code = m_obj.group(1)
|
|
||||||
entity["code"] = data["code"] + episode_code.zfill(4)
|
|
||||||
else:
|
|
||||||
entity["code"] = data["code"]
|
|
||||||
|
|
||||||
# logger.info('episode_code', episode_code)
|
|
||||||
# entity["url"] = t.attrib["href"]
|
|
||||||
entity["url"] = t["href"]
|
|
||||||
entity["season"] = data["season"]
|
|
||||||
|
|
||||||
# 저장경로 저장
|
|
||||||
tmp_save_path = ModelSetting.get("download_path")
|
tmp_save_path = ModelSetting.get("download_path")
|
||||||
if ModelSetting.get("auto_make_folder") == "True":
|
if ModelSetting.get("auto_make_folder") == "True":
|
||||||
program_path = os.path.join(tmp_save_path, entity["save_folder"])
|
program_path = os.path.join(tmp_save_path, temp1["save_folder"])
|
||||||
entity["save_path"] = program_path
|
temp1["save_path"] = program_path
|
||||||
if ModelSetting.get("inflearn_auto_make_season_folder"):
|
if ModelSetting.get("inflearn_auto_make_season_folder"):
|
||||||
entity["save_path"] = os.path.join(
|
temp1["save_path"] = os.path.join(
|
||||||
entity["save_path"], "Season %s" % int(entity["season"])
|
temp1["save_path"], "Season %s" % int(temp1["season"])
|
||||||
)
|
)
|
||||||
|
|
||||||
data["episode"].append(entity)
|
temp1["title"] = title
|
||||||
entity["image"] = data["poster_url"]
|
temp1["data_id"] = data_id
|
||||||
|
temp1["item_id"] = m3u8_info["data_id"]
|
||||||
|
temp1["code"] = temp1["item_id"]
|
||||||
|
temp1["run_time"] = run_time
|
||||||
|
temp1["api_url"] = api_url
|
||||||
|
temp1["name"] = m3u8_info["name"]
|
||||||
|
temp1["filename"] = m3u8_info["filename"]
|
||||||
|
# logger.debug(temp1["name"])
|
||||||
|
# logger.debug(temp1["filename"])
|
||||||
|
temp1["url"] = m3u8_info["hlsUrl"]
|
||||||
|
# temp1["url"] = m3u8_info["hlsUrl"]
|
||||||
|
temp1["size"] = m3u8_info["size"]
|
||||||
|
temp.append(temp1)
|
||||||
|
|
||||||
# entity['title'] = t.text_content().strip().encode('utf8')
|
# print(temp)
|
||||||
|
|
||||||
# entity['season'] = data['season']
|
|
||||||
# logger.debug(f"save_folder::2> {data['save_folder']}")
|
|
||||||
entity["filename"] = LogicInflearn.get_filename(
|
|
||||||
data["save_folder"], data["season"], entity["title"]
|
|
||||||
)
|
|
||||||
idx = idx + 1
|
|
||||||
data["ret"] = True
|
|
||||||
# logger.info('data', data)
|
# logger.info('data', data)
|
||||||
|
# LogicInflearn.current_data = temp
|
||||||
|
data["episode"] = temp
|
||||||
LogicInflearn.current_data = data
|
LogicInflearn.current_data = data
|
||||||
|
# logger.debug(data)
|
||||||
# srt 파일 처리
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -728,6 +740,79 @@ class LogicInflearn(object):
|
|||||||
data["ret"] = "error"
|
data["ret"] = "error"
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getM3u8_info(url, season, idx):
|
||||||
|
data_id = ""
|
||||||
|
m3u8_url = ""
|
||||||
|
name = ""
|
||||||
|
size = ""
|
||||||
|
duration = ""
|
||||||
|
filename = ""
|
||||||
|
title = ""
|
||||||
|
res_data = LogicInflearn.getHtml(url, "json").json()
|
||||||
|
|
||||||
|
# logger.info(f"getM3u8_info()::url => {url}")
|
||||||
|
logger.info(f"getM3u8_info::url => {url}")
|
||||||
|
# logger.debug("resData::: %s", res_data)
|
||||||
|
try:
|
||||||
|
if res_data["course"]["id"] is not None:
|
||||||
|
data_id = res_data["course"]["id"]
|
||||||
|
if res_data["course"]["id"] is not None:
|
||||||
|
title = res_data["course"]["title"]
|
||||||
|
if res_data["newBOX"]["video"]["name"] is not None:
|
||||||
|
name = res_data["newBOX"]["video"]["name"]
|
||||||
|
filename = f"{title}.{name.split('.')[0]}.S{season.zfill(2)}.E{str(idx).zfill(3)}.{name.split('.')[-1]}"
|
||||||
|
if res_data["newBOX"]["video"]["vod_info"]["hlsUrl"] is not None:
|
||||||
|
# logger.debug(res_data["newBOX"]["video"]["vod_info"]["hlsUrl"])
|
||||||
|
m3u8_url = res_data["newBOX"]["video"]["vod_info"]["hlsUrl"]
|
||||||
|
size = res_data["newBOX"]["video"]["vod_info"]["size"]
|
||||||
|
duration = res_data["newBOX"]["video"]["vod_info"]["duration"]
|
||||||
|
# return {
|
||||||
|
# "name": name,
|
||||||
|
# "hlsUrl": m3u8_url,
|
||||||
|
# "size": size,
|
||||||
|
# "duration": duration,
|
||||||
|
# }
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
# name = ""
|
||||||
|
# m3u8_url = ""
|
||||||
|
# size = None
|
||||||
|
return {
|
||||||
|
"data_id": data_id,
|
||||||
|
"title": title,
|
||||||
|
"name": name,
|
||||||
|
"hlsUrl": m3u8_url,
|
||||||
|
"size": size,
|
||||||
|
"duration": duration,
|
||||||
|
"filename": filename,
|
||||||
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getHtml(url, header):
|
||||||
|
o = parse.urlparse(url)
|
||||||
|
# print(o)
|
||||||
|
tmp_url = f"{o.scheme}://{o.netloc}{parse.quote(o.path)}"
|
||||||
|
# print('tmp_url', tmp_url)
|
||||||
|
|
||||||
|
# if (header == 'json'):
|
||||||
|
# resData = requests.get(tmp_url).json()
|
||||||
|
# else:
|
||||||
|
# resData = requests.get(tmp_url)
|
||||||
|
|
||||||
|
resData = requests.get(tmp_url)
|
||||||
|
|
||||||
|
# print('resData:::', resData)
|
||||||
|
if (
|
||||||
|
resData.url != tmp_url
|
||||||
|
): # redirect occurred; likely symbol doesn't exist or cannot be found.
|
||||||
|
raise requests.TooManyRedirects()
|
||||||
|
# print(resHtml.text)
|
||||||
|
|
||||||
|
resData.raise_for_status()
|
||||||
|
|
||||||
|
return resData
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_filename(maintitle, season, title):
|
def get_filename(maintitle, season, title):
|
||||||
try:
|
try:
|
||||||
@@ -763,12 +848,13 @@ class LogicInflearn(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_info_by_code(code):
|
def get_info_by_code(code):
|
||||||
logger.error("get_info_by_code: %s", code)
|
logger.info(f"get_info_by_code: {code}")
|
||||||
|
# logger.debug(LogicInflearn.current_data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if LogicInflearn.current_data is not None:
|
if LogicInflearn.current_data is not None:
|
||||||
for t in LogicInflearn.current_data["episode"]:
|
for t in LogicInflearn.current_data["episode"]:
|
||||||
if t["code"] == code:
|
if t["data_id"] == code:
|
||||||
return t
|
return t
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
@@ -790,8 +876,8 @@ class LogicInflearn(object):
|
|||||||
for code in whitelist_programs:
|
for code in whitelist_programs:
|
||||||
logger.info("auto download start : %s", code)
|
logger.info("auto download start : %s", code)
|
||||||
downloaded = (
|
downloaded = (
|
||||||
db.session.query(ModelLinkkf)
|
db.session.query(ModelInflearn)
|
||||||
.filter(ModelLinkkf.completed.is_(True))
|
.filter(ModelInflearn.completed.is_(True))
|
||||||
.filter_by(programcode=code)
|
.filter_by(programcode=code)
|
||||||
.with_for_update()
|
.with_for_update()
|
||||||
.all()
|
.all()
|
||||||
@@ -815,8 +901,39 @@ class LogicInflearn(object):
|
|||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def download(form):
|
||||||
|
try:
|
||||||
|
ret = {}
|
||||||
|
logger.debug("download call")
|
||||||
|
# ret = None
|
||||||
|
# options = {
|
||||||
|
# "save_path": form["save_path"],
|
||||||
|
# "filename": form["filename"],
|
||||||
|
# "format": form["format"],
|
||||||
|
# }
|
||||||
|
logger.debug(form)
|
||||||
|
# Todo:
|
||||||
|
# tmp = LogicQueue.add_queue(form.to_dict())
|
||||||
|
tmp = LogicQueue.add_youtube_queue(form.to_dict())
|
||||||
|
|
||||||
|
logger.debug("add_queue : tmp >> %s", tmp)
|
||||||
|
# ret["ret"] = "success" if tmp else "fail"
|
||||||
|
ret["ret"] = tmp
|
||||||
|
return ret
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Exception:%s", e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def reset_db() -> bool:
|
def reset_db() -> bool:
|
||||||
db.session.query(ModelLinkkf).delete()
|
db.session.query(ModelInflearn).delete()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_excel_info():
|
||||||
|
_path_dir = "/WD/Users/yommi/Work/fastapi/app/inflearn_xlsx"
|
||||||
|
file_list = os.listdir(_path_dir)
|
||||||
|
# logger.debug(file_list)
|
||||||
|
return file_list
|
||||||
|
|||||||
292
logic_queue.py
292
logic_queue.py
@@ -16,6 +16,7 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
# third-party
|
# third-party
|
||||||
|
from .api_youtube_dl import APIYoutubeDL
|
||||||
|
|
||||||
# sjva 공용
|
# sjva 공용
|
||||||
from framework import db, scheduler, path_data
|
from framework import db, scheduler, path_data
|
||||||
@@ -26,7 +27,7 @@ from framework.logger import get_logger
|
|||||||
# 패키지
|
# 패키지
|
||||||
# from .plugin import package_name, logger
|
# from .plugin import package_name, logger
|
||||||
import system
|
import system
|
||||||
from .model import ModelSetting, ModelLinkkf
|
from .model import ModelSetting, ModelInflearn
|
||||||
|
|
||||||
# from plugin import LogicModuleBase, FfmpegQueueEntity, FfmpegQueue, default_route_socketio
|
# from plugin import LogicModuleBase, FfmpegQueueEntity, FfmpegQueue, default_route_socketio
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ class QueueEntity:
|
|||||||
class LogicQueue(object):
|
class LogicQueue(object):
|
||||||
download_queue = None
|
download_queue = None
|
||||||
download_thread = None
|
download_thread = None
|
||||||
current_ffmpeg_count = 0
|
current_youtube_count = 0
|
||||||
|
|
||||||
def refresh_status(self):
|
def refresh_status(self):
|
||||||
self.module_logic.socketio_callback("status", self.as_dict())
|
self.module_logic.socketio_callback("status", self.as_dict())
|
||||||
@@ -96,22 +97,8 @@ class LogicQueue(object):
|
|||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
# @staticmethod
|
|
||||||
# def download_thread_function():
|
|
||||||
# while True:
|
|
||||||
# try:
|
|
||||||
# entity = LogicQueue.download_queue.get()
|
|
||||||
# logger.debug(
|
|
||||||
# "Queue receive item:%s %s", entity.title_id, entity.episode_id
|
|
||||||
# )
|
|
||||||
# # LogicAni.process(entity)
|
|
||||||
# LogicQueue.download_queue.task_done()
|
|
||||||
# except Exception as e:
|
|
||||||
# logger.error("Exception:%s", e)
|
|
||||||
# logger.error(traceback.format_exc())
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download_thread_function():
|
def download_thread_function() -> None:
|
||||||
headers = None
|
headers = None
|
||||||
from . import plugin
|
from . import plugin
|
||||||
|
|
||||||
@@ -119,42 +106,30 @@ class LogicQueue(object):
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if LogicQueue.current_ffmpeg_count < int(
|
if LogicQueue.current_youtube_count < int(
|
||||||
ModelSetting.get("max_ffmpeg_process_count")
|
ModelSetting.get("max_ffmpeg_process_count")
|
||||||
):
|
):
|
||||||
break
|
break
|
||||||
# logger.debug(LogicQueue.current_ffmpeg_count)
|
# logger.debug(LogicQueue.current_ffmpeg_count)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
entity = LogicQueue.download_queue.get()
|
entity = LogicQueue.download_queue.get()
|
||||||
|
logger.debug(f"entity:: {entity.info}")
|
||||||
# Todo: 고찰
|
|
||||||
# if entity.cancel:
|
|
||||||
# continue
|
|
||||||
|
|
||||||
# logger.debug(
|
|
||||||
# "download_thread_function()::entity.info['code'] >> %s", entity
|
|
||||||
# )
|
|
||||||
|
|
||||||
if entity is None:
|
if entity is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# db에 해당 에피소드가 존재하는 확인
|
# db에 해당 에피소드가 존재하는 확인
|
||||||
db_entity = ModelLinkkf.get_by_inflearn_id(entity.info["code"])
|
db_entity = ModelInflearn.get_by_inflearn_id(entity.info["code"])
|
||||||
if db_entity is None:
|
if db_entity is None:
|
||||||
episode = ModelLinkkf("auto", info=entity.info)
|
episode = ModelInflearn("auto", info=entity.info)
|
||||||
db.session.add(episode)
|
db.session.add(episode)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
else:
|
else:
|
||||||
# episode = ModelLinkkf("auto", info=entity.info)
|
|
||||||
# query = db.session.query(ModelLinkkf).filter_by(episodecode=entity.info.episodecode).with_for_update().first()
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from .logic_inflearn import LogicInflearn
|
from .logic_inflearn import LogicInflearn
|
||||||
|
|
||||||
# entity.url = LogicLinkkfYommi.get_video_url(
|
entity.url = entity.info["url"]
|
||||||
# entity.info['code'])
|
|
||||||
# logger.debug(f"entity.info[url] = {entity.info['url']}")
|
|
||||||
entity.url = LogicInflearn.get_video_url(entity.info["url"])
|
|
||||||
|
|
||||||
# logger.info('entity.info: %s', entity.info['url'])
|
# logger.info('entity.info: %s', entity.info['url'])
|
||||||
logger.debug(f"entity.url: {entity.url}")
|
logger.debug(f"entity.url: {entity.url}")
|
||||||
@@ -163,8 +138,8 @@ class LogicQueue(object):
|
|||||||
# logger.info('entity: %s', entity.__dict__)
|
# logger.info('entity: %s', entity.__dict__)
|
||||||
|
|
||||||
# logger.info('entity.url:::> %s', entity.url)
|
# logger.info('entity.url:::> %s', entity.url)
|
||||||
if entity.url[0] is None:
|
if entity.url is None:
|
||||||
self.ffmpeg_status_kor = "URL실패"
|
QueueEntity.ffmpeg_status_kor = "URL실패"
|
||||||
plugin.socketio_list_refresh()
|
plugin.socketio_list_refresh()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -187,8 +162,8 @@ class LogicQueue(object):
|
|||||||
logger.debug("program path make fail!!")
|
logger.debug("program path make fail!!")
|
||||||
|
|
||||||
# 파일 존재여부 체크
|
# 파일 존재여부 체크
|
||||||
if entity.url[1] is not None:
|
if entity.url is not None:
|
||||||
referer = entity.url[1]
|
referer = "http://www.inflearn.com"
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
|
||||||
# 'Accept':
|
# 'Accept':
|
||||||
@@ -215,7 +190,7 @@ class LogicQueue(object):
|
|||||||
# logger.debug(f"referer: {referer}")
|
# logger.debug(f"referer: {referer}")
|
||||||
|
|
||||||
f = ffmpeg.Ffmpeg(
|
f = ffmpeg.Ffmpeg(
|
||||||
entity.url[0],
|
entity.url,
|
||||||
entity.info["filename"],
|
entity.info["filename"],
|
||||||
plugin_id=entity.entity_id,
|
plugin_id=entity.entity_id,
|
||||||
listener=LogicQueue.ffmpeg_listener,
|
listener=LogicQueue.ffmpeg_listener,
|
||||||
@@ -224,36 +199,37 @@ class LogicQueue(object):
|
|||||||
call_plugin=package_name,
|
call_plugin=package_name,
|
||||||
save_path=save_path,
|
save_path=save_path,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
# proxy=f" -correct_ts_overflow 0",
|
||||||
)
|
)
|
||||||
f.start()
|
f.start()
|
||||||
|
|
||||||
LogicQueue.current_ffmpeg_count += 1
|
LogicQueue.current_youtube_count += 1
|
||||||
LogicQueue.download_queue.task_done()
|
LogicQueue.download_queue.task_done()
|
||||||
|
|
||||||
# vtt file to srt file
|
# vtt file to srt file
|
||||||
from framework.common.util import write_file, convert_vtt_to_srt
|
# from framework.common.util import write_file, convert_vtt_to_srt
|
||||||
from urllib import parse
|
# from urllib import parse
|
||||||
|
#
|
||||||
ourls = parse.urlparse(entity.url[1])
|
# ourls = parse.urlparse(entity.url[1])
|
||||||
# print(ourls)
|
# # print(ourls)
|
||||||
# logger.info('ourls:::>', ourls)
|
# # logger.info('ourls:::>', ourls)
|
||||||
base_url = f"{ourls.scheme}://{ourls.netloc}"
|
# base_url = f"{ourls.scheme}://{ourls.netloc}"
|
||||||
# logger.info('base_url:::>', base_url)
|
# # logger.info('base_url:::>', base_url)
|
||||||
|
#
|
||||||
# Todo: 임시 커밋 로직 해결하면 다시 처리
|
# # Todo: 임시 커밋 로직 해결하면 다시 처리
|
||||||
# if "linkkf.app" in base_url:
|
# # if "linkkf.app" in base_url:
|
||||||
# base_url = f"{ourls.scheme}://kfani.me"
|
# # base_url = f"{ourls.scheme}://kfani.me"
|
||||||
|
#
|
||||||
vtt_url = base_url + entity.url[2]
|
# vtt_url = base_url + entity.url[2]
|
||||||
logger.debug(f"srt:url => {vtt_url}")
|
# logger.debug(f"srt:url => {vtt_url}")
|
||||||
srt_filepath = os.path.join(
|
# srt_filepath = os.path.join(
|
||||||
save_path, entity.info["filename"].replace(".mp4", ".ko.srt")
|
# save_path, entity.info["filename"].replace(".mp4", ".ko.srt")
|
||||||
)
|
# )
|
||||||
# logger.info('srt_filepath::: %s', srt_filepath)
|
# # logger.info('srt_filepath::: %s', srt_filepath)
|
||||||
if entity.url[2] is not None and not os.path.exists(srt_filepath):
|
# if entity.url[2] is not None and not os.path.exists(srt_filepath):
|
||||||
vtt_data = requests.get(vtt_url, headers=headers).text
|
# vtt_data = requests.get(vtt_url, headers=headers).text
|
||||||
srt_data = convert_vtt_to_srt(vtt_data)
|
# srt_data = convert_vtt_to_srt(vtt_data)
|
||||||
write_file(srt_data, srt_filepath)
|
# write_file(srt_data, srt_filepath)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
@@ -269,7 +245,7 @@ class LogicQueue(object):
|
|||||||
if arg["type"] == "status_change":
|
if arg["type"] == "status_change":
|
||||||
if arg["status"] == ffmpeg.Status.DOWNLOADING:
|
if arg["status"] == ffmpeg.Status.DOWNLOADING:
|
||||||
episode = (
|
episode = (
|
||||||
db.session.query(ModelLinkkf)
|
db.session.query(ModelInflearn)
|
||||||
.filter_by(episodecode=arg["plugin_id"])
|
.filter_by(episodecode=arg["plugin_id"])
|
||||||
.with_for_update()
|
.with_for_update()
|
||||||
.first()
|
.first()
|
||||||
@@ -285,7 +261,7 @@ class LogicQueue(object):
|
|||||||
elif arg["type"] == "last":
|
elif arg["type"] == "last":
|
||||||
LogicQueue.current_ffmpeg_count += -1
|
LogicQueue.current_ffmpeg_count += -1
|
||||||
episode = (
|
episode = (
|
||||||
db.session.query(ModelLinkkf)
|
db.session.query(ModelInflearn)
|
||||||
.filter_by(episodecode=arg["plugin_id"])
|
.filter_by(episodecode=arg["plugin_id"])
|
||||||
.with_for_update()
|
.with_for_update()
|
||||||
.first()
|
.first()
|
||||||
@@ -351,6 +327,111 @@ class LogicQueue(object):
|
|||||||
# logger.error("Exception:%s", e)
|
# logger.error("Exception:%s", e)
|
||||||
# logger.error(traceback.format_exc())
|
# logger.error(traceback.format_exc())
|
||||||
# return False
|
# return False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def add_youtube_queue(info):
|
||||||
|
# logger.debug(type(info))
|
||||||
|
logger.debug(f"add_youtube_queue():info {info}")
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
_temp = info["data"]
|
||||||
|
|
||||||
|
if not isinstance(_temp, dict):
|
||||||
|
_info = json.loads(_temp.replace("'", '"'))
|
||||||
|
else:
|
||||||
|
_info = _temp
|
||||||
|
|
||||||
|
logger.debug(_info)
|
||||||
|
_info["code"] = _info["data_id"]
|
||||||
|
# _info["url"] = _info["hlsUrl"]
|
||||||
|
# _info["filename"] = _info["name"]
|
||||||
|
# while True:
|
||||||
|
# # if LogicQueue.current_youtube_count < int(
|
||||||
|
# # ModelSetting.get("max_ffmpeg_process_count")
|
||||||
|
# # ):
|
||||||
|
# if LogicQueue.current_youtube_count < 3:
|
||||||
|
# logger.debug("break!!!")
|
||||||
|
# break
|
||||||
|
# # logger.debug(LogicQueue.current_ffmpeg_count)
|
||||||
|
# time.sleep(2)
|
||||||
|
|
||||||
|
# entity = LogicQueue.download_queue.get()
|
||||||
|
# logger.debug(f"entity:: {entity}")
|
||||||
|
#
|
||||||
|
# if entity is None:
|
||||||
|
# continue
|
||||||
|
|
||||||
|
logger.debug("add_queue()::info >> %s", _info)
|
||||||
|
logger.debug(type(_info))
|
||||||
|
|
||||||
|
# episode[] code (episode_code)
|
||||||
|
db_entity = ModelInflearn.get_by_inflearn_id(_info["code"])
|
||||||
|
|
||||||
|
if db_entity is None:
|
||||||
|
# entity = QueueEntity.create(_info)
|
||||||
|
|
||||||
|
# download = APIYoutubeDL.download(
|
||||||
|
# package_name,
|
||||||
|
# db_entity.code,
|
||||||
|
# url,
|
||||||
|
# filename=entity.filename,
|
||||||
|
# save_path=entity.save_path,
|
||||||
|
# format_code=entity.format,
|
||||||
|
# preferredcodec="mp3" if entity.convert_mp3 else None,
|
||||||
|
# dateafter=date_after,
|
||||||
|
# playlist="reverse" if entity.playlistreverse else None,
|
||||||
|
# start=False,
|
||||||
|
# cookiefile=ModelSetting.get("cookiefile_path"),
|
||||||
|
# )
|
||||||
|
|
||||||
|
# LogicQueue.download_queue.put(entity)
|
||||||
|
download = APIYoutubeDL.download(
|
||||||
|
package_name,
|
||||||
|
_info["code"],
|
||||||
|
_info["url"],
|
||||||
|
filename=_info["filename"],
|
||||||
|
save_path=_info["save_path"],
|
||||||
|
format_code="mp4",
|
||||||
|
# preferredcodec="mp3" if entity.convert_mp3 else None,
|
||||||
|
preferredcodec=None,
|
||||||
|
dateafter=None,
|
||||||
|
playlist=None,
|
||||||
|
start=True,
|
||||||
|
cookiefile=None,
|
||||||
|
)
|
||||||
|
LogicQueue.current_youtube_count += 1
|
||||||
|
# download.start()
|
||||||
|
return "enqueue_db_append"
|
||||||
|
elif db_entity.status != "completed":
|
||||||
|
logger.debug(f"db_entity.status: {db_entity.status}")
|
||||||
|
# entity = QueueEntity.create(_info)
|
||||||
|
# return "Debugging"
|
||||||
|
# LogicQueue.download_queue.put(entity)
|
||||||
|
download = APIYoutubeDL.download(
|
||||||
|
package_name,
|
||||||
|
_info["code"],
|
||||||
|
_info["url"],
|
||||||
|
filename=_info["filename"],
|
||||||
|
save_path=_info["save_path"],
|
||||||
|
format_code="mp4",
|
||||||
|
# preferredcodec="mp3" if entity.convert_mp3 else None,
|
||||||
|
preferredcodec=None,
|
||||||
|
dateafter=None,
|
||||||
|
playlist=None,
|
||||||
|
start=True,
|
||||||
|
cookiefile=None,
|
||||||
|
)
|
||||||
|
download.start()
|
||||||
|
|
||||||
|
logger.debug("add_queue()::enqueue_db_exist")
|
||||||
|
return "enqueue_db_exist"
|
||||||
|
else:
|
||||||
|
return "db_completed"
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Exception:%s", e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_queue(info):
|
def add_queue(info):
|
||||||
try:
|
try:
|
||||||
@@ -358,21 +439,92 @@ class LogicQueue(object):
|
|||||||
# Todo:
|
# Todo:
|
||||||
# if is_exist(info):
|
# if is_exist(info):
|
||||||
# return 'queue_exist'
|
# return 'queue_exist'
|
||||||
# logger.debug("add_queue()::info >> %s", info)
|
|
||||||
# logger.debug("info::", info["_id"])
|
# logger.debug("info::", info["_id"])
|
||||||
|
# logger.debug()
|
||||||
|
logger.debug(info)
|
||||||
|
logger.debug(type(info))
|
||||||
|
_temp = info
|
||||||
|
|
||||||
|
_info = json.loads(_temp.replace("'", '"'))
|
||||||
|
_info["code"] = _info["data_id"]
|
||||||
|
# _info["url"] = _info["hlsUrl"]
|
||||||
|
_info["filename"] = _info["name"]
|
||||||
|
|
||||||
|
logger.debug("add_queue()::info >> %s", _info)
|
||||||
|
logger.debug(type(_info))
|
||||||
|
|
||||||
# episode[] code (episode_code)
|
# episode[] code (episode_code)
|
||||||
db_entity = ModelLinkkf.get_by_inflearn_id(info["code"])
|
db_entity = ModelInflearn.get_by_inflearn_id(_info["code"])
|
||||||
# logger.debug("add_queue:: db_entity >> %s", db_entity)
|
logger.debug("add_queue:: db_entity >> %s", db_entity)
|
||||||
|
|
||||||
if db_entity is None:
|
if db_entity is None:
|
||||||
entity = QueueEntity.create(info)
|
entity = QueueEntity.create(_info)
|
||||||
|
|
||||||
# logger.debug("add_queue()::entity >> %s", entity)
|
# logger.debug("add_queue()::entity >> %s", entity)
|
||||||
LogicQueue.download_queue.put(entity)
|
LogicQueue.download_queue.put(entity)
|
||||||
return "enqueue_db_append"
|
return "enqueue_db_append"
|
||||||
elif db_entity.status != "completed":
|
elif db_entity.status != "completed":
|
||||||
entity = QueueEntity.create(info)
|
logger.debug(f"db_entity.status: {db_entity.status}")
|
||||||
|
entity = QueueEntity.create(_info)
|
||||||
|
# return "Debugging"
|
||||||
|
LogicQueue.download_queue.put(entity)
|
||||||
|
|
||||||
|
logger.debug("add_queue()::enqueue_db_exist")
|
||||||
|
return "enqueue_db_exist"
|
||||||
|
else:
|
||||||
|
return "db_completed"
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Exception:%s", e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
return False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def add_checked_youtube_queue(info):
|
||||||
|
|
||||||
|
logger.debug(f"add_checked_youtube_queue():info {info}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
_temp = info["data"]
|
||||||
|
|
||||||
|
if not isinstance(_temp, dict):
|
||||||
|
_info = json.loads(_temp.replace("'", '"'))
|
||||||
|
else:
|
||||||
|
_info = _temp
|
||||||
|
|
||||||
|
logger.debug(_info)
|
||||||
|
_info["code"] = _info["data_id"]
|
||||||
|
|
||||||
|
logger.debug("add_queue()::info >> %s", _info)
|
||||||
|
logger.debug(type(_info))
|
||||||
|
|
||||||
|
# episode[] code (episode_code)
|
||||||
|
db_entity = ModelInflearn.get_by_inflearn_id(_info["code"])
|
||||||
|
logger.debug("add_queue:: db_entity >> %s", db_entity)
|
||||||
|
|
||||||
|
if db_entity is None:
|
||||||
|
# entity = QueueEntity.create(_info)
|
||||||
|
entity = APIYoutubeDL.download(
|
||||||
|
package_name,
|
||||||
|
_info["code"],
|
||||||
|
_info["url"],
|
||||||
|
filename=_info["filename"],
|
||||||
|
save_path=_info["save_path"],
|
||||||
|
format_code="mp4",
|
||||||
|
# preferredcodec="mp3" if entity.convert_mp3 else None,
|
||||||
|
preferredcodec=None,
|
||||||
|
dateafter=None,
|
||||||
|
playlist=None,
|
||||||
|
start=True,
|
||||||
|
cookiefile=None,
|
||||||
|
)
|
||||||
|
# logger.debug("add_queue()::entity >> %s", entity)
|
||||||
|
LogicQueue.download_queue.put(entity)
|
||||||
|
return "enqueue_db_append"
|
||||||
|
elif db_entity.status != "completed":
|
||||||
|
logger.debug(f"db_entity.status: {db_entity.status}")
|
||||||
|
entity = QueueEntity.create(_info)
|
||||||
# return "Debugging"
|
# return "Debugging"
|
||||||
LogicQueue.download_queue.put(entity)
|
LogicQueue.download_queue.put(entity)
|
||||||
|
|
||||||
|
|||||||
7
model.py
7
model.py
@@ -61,7 +61,7 @@ class ModelSetting(db.Model):
|
|||||||
# logger.error(traceback.format_exc())
|
# logger.error(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
class ModelLinkkfProgram(db.Model):
|
class ModelInflearnProgram(db.Model):
|
||||||
__tablename__ = "plugin_%s_program" % package_name
|
__tablename__ = "plugin_%s_program" % package_name
|
||||||
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
||||||
__bind_key__ = package_name
|
__bind_key__ = package_name
|
||||||
@@ -79,6 +79,7 @@ class ModelLinkkfProgram(db.Model):
|
|||||||
self.created_time = datetime.now()
|
self.created_time = datetime.now()
|
||||||
self.programcode = data["code"]
|
self.programcode = data["code"]
|
||||||
self.save_folder = data["title"]
|
self.save_folder = data["title"]
|
||||||
|
logger.debug(f"self.save_folder:: {self.save_folder}")
|
||||||
self.season = data["season"]
|
self.season = data["season"]
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -96,7 +97,7 @@ class ModelLinkkfProgram(db.Model):
|
|||||||
self.season = data["season"]
|
self.season = data["season"]
|
||||||
|
|
||||||
|
|
||||||
class ModelLinkkf(db.Model):
|
class ModelInflearn(db.Model):
|
||||||
__tablename__ = "plugin_%s_auto_episode" % package_name
|
__tablename__ = "plugin_%s_auto_episode" % package_name
|
||||||
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
__table_args__ = {"mysql_collate": "utf8_general_ci"}
|
||||||
__bind_key__ = package_name
|
__bind_key__ = package_name
|
||||||
@@ -160,7 +161,7 @@ class ModelLinkkf(db.Model):
|
|||||||
|
|
||||||
def set_info(self, data):
|
def set_info(self, data):
|
||||||
self.contents_json = data
|
self.contents_json = data
|
||||||
self.programcode = data["program_code"]
|
self.programcode = data["item_id"]
|
||||||
self.episodecode = data["code"]
|
self.episodecode = data["code"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
94
plugin.py
94
plugin.py
@@ -34,7 +34,7 @@ from system.logic import SystemLogic
|
|||||||
from .logic import Logic
|
from .logic import Logic
|
||||||
from .logic_inflearn import LogicInflearn
|
from .logic_inflearn import LogicInflearn
|
||||||
from .logic_queue import QueueEntity, LogicQueue
|
from .logic_queue import QueueEntity, LogicQueue
|
||||||
from .model import ModelSetting, ModelLinkkf
|
from .model import ModelSetting, ModelInflearn
|
||||||
|
|
||||||
# blueprint = Blueprint(package_name,
|
# blueprint = Blueprint(package_name,
|
||||||
# package_name,
|
# package_name,
|
||||||
@@ -73,6 +73,7 @@ menu = {
|
|||||||
["request", "요청"],
|
["request", "요청"],
|
||||||
["category", "검색"],
|
["category", "검색"],
|
||||||
["queue", "큐"],
|
["queue", "큐"],
|
||||||
|
["excel", "액셀"],
|
||||||
["list", "목록"],
|
["list", "목록"],
|
||||||
["log", "로그"],
|
["log", "로그"],
|
||||||
],
|
],
|
||||||
@@ -118,7 +119,7 @@ def home():
|
|||||||
return redirect("/%s/category" % package_name)
|
return redirect("/%s/category" % package_name)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/<sub>")
|
@blueprint.route("/<sub>", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def detail(sub):
|
def detail(sub):
|
||||||
# arg = {
|
# arg = {
|
||||||
@@ -134,19 +135,49 @@ def detail(sub):
|
|||||||
arg["is_running"] = str(scheduler.is_running(package_name))
|
arg["is_running"] = str(scheduler.is_running(package_name))
|
||||||
arg["template_name"] = "%s_%s" % (package_name, sub)
|
arg["template_name"] = "%s_%s" % (package_name, sub)
|
||||||
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
||||||
elif sub in ["request", "queue", "list"]:
|
elif sub == "request":
|
||||||
setting_list = db.session.query(ModelSetting).all()
|
setting_list = db.session.query(ModelSetting).all()
|
||||||
arg = Util.db_list_to_dict(setting_list)
|
arg = Util.db_list_to_dict(setting_list)
|
||||||
arg["package_name"] = package_name
|
arg["package_name"] = package_name
|
||||||
|
logger.debug(f"current_code: {LogicInflearn.current_data}")
|
||||||
arg["current_code"] = (
|
arg["current_code"] = (
|
||||||
LogicInflearn.current_data["code"]
|
LogicInflearn.current_data["code"]
|
||||||
if LogicInflearn.current_data is not None
|
if LogicInflearn.current_data is not None
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
arg["template_name"] = "%s_%s" % (package_name, sub)
|
|
||||||
|
# arg["template_name"] = "%s_%s" % (package_name, sub)
|
||||||
|
arg["template_name"] = f"{package_name}_{sub}"
|
||||||
|
|
||||||
|
logger.debug(f"arg: {arg}")
|
||||||
|
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
||||||
|
|
||||||
|
elif sub in ["queue", "list"]:
|
||||||
|
setting_list = db.session.query(ModelSetting).all()
|
||||||
|
arg = Util.db_list_to_dict(setting_list)
|
||||||
|
arg["package_name"] = package_name
|
||||||
|
logger.debug(f"current_code: {LogicInflearn.current_data}")
|
||||||
|
arg["current_code"] = (
|
||||||
|
LogicInflearn.current_data["code"]
|
||||||
|
if LogicInflearn.current_data is not None
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
# arg["template_name"] = "%s_%s" % (package_name, sub)
|
||||||
|
arg["template_name"] = f"{package_name}_{sub}"
|
||||||
|
|
||||||
|
logger.debug(f"arg: \n{arg}")
|
||||||
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
||||||
elif sub == "category":
|
elif sub == "category":
|
||||||
|
|
||||||
|
setting_list = db.session.query(ModelSetting).all()
|
||||||
|
arg = Util.db_list_to_dict(setting_list)
|
||||||
|
arg["package_name"] = package_name
|
||||||
|
arg["template_name"] = "%s_%s" % (package_name, sub)
|
||||||
|
# logger.debug(f"arg:: {arg}")
|
||||||
|
return render_template("%s_%s.html" % (package_name, sub), arg=arg)
|
||||||
|
elif sub == "excel":
|
||||||
|
|
||||||
setting_list = db.session.query(ModelSetting).all()
|
setting_list = db.session.query(ModelSetting).all()
|
||||||
arg = Util.db_list_to_dict(setting_list)
|
arg = Util.db_list_to_dict(setting_list)
|
||||||
arg["package_name"] = package_name
|
arg["package_name"] = package_name
|
||||||
@@ -186,9 +217,10 @@ def ajax(sub):
|
|||||||
code = request.form["code"]
|
code = request.form["code"]
|
||||||
data = LogicInflearn.get_title_info(code)
|
data = LogicInflearn.get_title_info(code)
|
||||||
# logger.debug("data::> %s", data)
|
# logger.debug("data::> %s", data)
|
||||||
# current_data = data
|
LogicInflearn.current_data = data
|
||||||
|
|
||||||
# return jsonify(data)
|
# return jsonify(data)
|
||||||
|
# logger.debug(data)
|
||||||
if data["ret"] == "error":
|
if data["ret"] == "error":
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
else:
|
else:
|
||||||
@@ -200,6 +232,17 @@ def ajax(sub):
|
|||||||
# logger.error("Exception:%s", e)
|
# logger.error("Exception:%s", e)
|
||||||
# logger.error(traceback.format_exc())
|
# logger.error(traceback.format_exc())
|
||||||
return jsonify({"ret": "error", "log": e})
|
return jsonify({"ret": "error", "log": e})
|
||||||
|
elif sub == "excel_list":
|
||||||
|
try:
|
||||||
|
data = LogicInflearn.get_excel_info()
|
||||||
|
logger.debug(f"data[]: {data}")
|
||||||
|
return jsonify({"ret": "success", "data": data})
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("Exception:%s", e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
return jsonify({"ret": "error", "log": e})
|
||||||
|
|
||||||
elif sub == "search":
|
elif sub == "search":
|
||||||
try:
|
try:
|
||||||
query = request.form["query"]
|
query = request.form["query"]
|
||||||
@@ -210,23 +253,26 @@ def ajax(sub):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
elif sub == "anime_list":
|
# elif sub == "anime_list":
|
||||||
|
# try:
|
||||||
|
# # logger.debug(request.form)
|
||||||
|
# page = request.form["page"]
|
||||||
|
# cate = request.form["type"]
|
||||||
|
# # data = LogicLinkkfYommi.get_screen_movie_info(page)
|
||||||
|
# data = LogicInflearn.get_lecture_list_info(cate, page)
|
||||||
|
# dummy_data = {"ret": "success", "data": data}
|
||||||
|
# return jsonify(data)
|
||||||
|
# except Exception as e:
|
||||||
|
# logger.error("Exception:%s", e)
|
||||||
|
# logger.error(traceback.format_exc())
|
||||||
|
elif sub == "get_lecture_list":
|
||||||
try:
|
try:
|
||||||
# logger.debug(request.form)
|
# logger.debug(request.form)
|
||||||
page = request.form["page"]
|
page = request.form["page"]
|
||||||
cate = request.form["type"]
|
cate = request.form["type"]
|
||||||
# data = LogicLinkkfYommi.get_screen_movie_info(page)
|
data = LogicInflearn.get_lecture_list_info(cate, page)
|
||||||
data = LogicInflearn.get_anime_list_info(cate, page)
|
|
||||||
dummy_data = {"ret": "success", "data": data}
|
|
||||||
return jsonify(data)
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("Exception:%s", e)
|
|
||||||
logger.error(traceback.format_exc())
|
|
||||||
elif sub == "airing_list":
|
|
||||||
try:
|
|
||||||
data = LogicInflearn.get_airing_info()
|
|
||||||
# dummy_data = {"ret": "success", "data": data}
|
# dummy_data = {"ret": "success", "data": data}
|
||||||
logger.debug(f"airing_list:: {data}")
|
logger.debug(f"lecture_list:: {data}")
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
@@ -285,6 +331,10 @@ def ajax(sub):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception:%s", e)
|
logger.error("Exception:%s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
elif sub == "add_download":
|
||||||
|
# logger.debug("add_download:: %s", request.form)
|
||||||
|
ret = LogicInflearn.download(request.form)
|
||||||
|
return jsonify(ret)
|
||||||
elif sub == "add_queue":
|
elif sub == "add_queue":
|
||||||
try:
|
try:
|
||||||
ret = {}
|
ret = {}
|
||||||
@@ -321,16 +371,20 @@ def ajax(sub):
|
|||||||
return jsonify(ret)
|
return jsonify(ret)
|
||||||
elif sub == "add_queue_checked_list":
|
elif sub == "add_queue_checked_list":
|
||||||
ret = {}
|
ret = {}
|
||||||
|
infos = {"code": request.form["lecture_id"]}
|
||||||
try:
|
try:
|
||||||
from .logic_queue import LogicQueue
|
from .logic_queue import LogicQueue
|
||||||
|
|
||||||
code = request.form["code"]
|
code = request.form["code"]
|
||||||
|
logger.debug("code:: %s", code)
|
||||||
code_list = code.split(",")
|
code_list = code.split(",")
|
||||||
|
logger.debug(f"code_list[]: {code_list}")
|
||||||
count = 0
|
count = 0
|
||||||
for c in code_list:
|
for c in code_list:
|
||||||
info = LogicInflearn.get_info_by_code(c)
|
info = LogicInflearn.get_info_by_code(c)
|
||||||
if info is not None:
|
if info is not None:
|
||||||
tmp = LogicQueue.add_queue(info)
|
infos["data"] = info
|
||||||
|
tmp = LogicQueue.add_checked_youtube_queue(infos)
|
||||||
count += 1
|
count += 1
|
||||||
ret["ret"] = "success"
|
ret["ret"] = "success"
|
||||||
ret["log"] = str(count)
|
ret["log"] = str(count)
|
||||||
@@ -358,13 +412,13 @@ def ajax(sub):
|
|||||||
# logger.info("db :::>", ModelLinkkf.web_list(request))
|
# logger.info("db :::>", ModelLinkkf.web_list(request))
|
||||||
data = [{}]
|
data = [{}]
|
||||||
dummy_data = {"ret": "success", "method": "web_list", "data": data}
|
dummy_data = {"ret": "success", "method": "web_list", "data": data}
|
||||||
return jsonify(ModelLinkkf.web_list(request))
|
return jsonify(ModelInflearn.web_list(request))
|
||||||
# return jsonify(dummy_data)
|
# return jsonify(dummy_data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception: %s", e)
|
logger.error("Exception: %s", e)
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
elif sub == "db_remove":
|
elif sub == "db_remove":
|
||||||
return jsonify(ModelLinkkf.delete_by_id(request.form["id"]))
|
return jsonify(ModelInflearn.delete_by_id(request.form["id"]))
|
||||||
# reset_db
|
# reset_db
|
||||||
elif sub == "reset_db":
|
elif sub == "reset_db":
|
||||||
ret = {}
|
ret = {}
|
||||||
|
|||||||
201
static/css/inflearn_excel.css
Normal file
201
static/css/inflearn_excel.css
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
button.code-button {
|
||||||
|
min-width: 82px !important;
|
||||||
|
}
|
||||||
|
.tooltip {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-tooltip-text]:hover {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-tooltip-text]:after {
|
||||||
|
-webkit-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
-moz-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
|
||||||
|
-webkit-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
-moz-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 7px 12px;
|
||||||
|
position: absolute;
|
||||||
|
width: auto;
|
||||||
|
min-width: 50px;
|
||||||
|
max-width: 300px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
z-index: 9999;
|
||||||
|
|
||||||
|
opacity: 0;
|
||||||
|
left: -9999px;
|
||||||
|
top: 90%;
|
||||||
|
|
||||||
|
content: attr(data-tooltip-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-tooltip-text]:hover:after {
|
||||||
|
top: 230%;
|
||||||
|
left: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
[data-tooltip-text]:hover {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-tooltip-text]:after {
|
||||||
|
-webkit-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
-moz-transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
|
||||||
|
-webkit-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
-moz-box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
box-shadow: 0px 0px 3px 1px rgba(50, 50, 50, 0.4);
|
||||||
|
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 7px 12px;
|
||||||
|
position: absolute;
|
||||||
|
width: auto;
|
||||||
|
min-width: 50px;
|
||||||
|
max-width: 300px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
z-index: 9999;
|
||||||
|
|
||||||
|
opacity: 0;
|
||||||
|
left: -9999px;
|
||||||
|
top: -210% !important;
|
||||||
|
|
||||||
|
content: attr(data-tooltip-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-tooltip-text]:hover:after {
|
||||||
|
top: 130%;
|
||||||
|
left: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#airing_list {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cut-text {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
.container {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#screen_movie_list {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
/* .spinner {*/
|
||||||
|
/* width: 40px;*/
|
||||||
|
/* height: 40px;*/
|
||||||
|
/* background-color: #333;*/
|
||||||
|
|
||||||
|
/* margin: 100px auto;*/
|
||||||
|
/* -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;*/
|
||||||
|
/* animation: sk-rotateplane 1.2s infinite ease-in-out;*/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
|
/*@-webkit-keyframes sk-rotateplane {*/
|
||||||
|
/* 0% { -webkit-transform: perspective(120px) }*/
|
||||||
|
/* 50% { -webkit-transform: perspective(120px) rotateY(180deg) }*/
|
||||||
|
/* 100% { -webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg) }*/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
|
/*@keyframes sk-rotateplane {*/
|
||||||
|
/* 0% {*/
|
||||||
|
/* transform: perspective(120px) rotateX(0deg) rotateY(0deg);*/
|
||||||
|
/* -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)*/
|
||||||
|
/* } 50% {*/
|
||||||
|
/* transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);*/
|
||||||
|
/* -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)*/
|
||||||
|
/* } 100% {*/
|
||||||
|
/* transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);*/
|
||||||
|
/* -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);*/
|
||||||
|
/* }*/
|
||||||
|
|
||||||
|
/*}*/
|
||||||
|
.spinner {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
margin: 100px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.double-bounce1,
|
||||||
|
.double-bounce2 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #333;
|
||||||
|
opacity: 0.6;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
-webkit-animation: sk-bounce 2s infinite ease-in-out;
|
||||||
|
animation: sk-bounce 2s infinite ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.double-bounce2 {
|
||||||
|
-webkit-animation-delay: -1s;
|
||||||
|
animation-delay: -1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes sk-bounce {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
-webkit-transform: scale(0);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes sk-bounce {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
transform: scale(0);
|
||||||
|
-webkit-transform: scale(0);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale(1);
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-on-image {
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
/*bottom: 2px; !* position where you want it *!*/
|
||||||
|
right: 2px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
}
|
||||||
@@ -9,19 +9,23 @@ let next_page = Number;
|
|||||||
let current_cate = "";
|
let current_cate = "";
|
||||||
let total_page = "";
|
let total_page = "";
|
||||||
|
|
||||||
$("#anime_category #ing").on("click", function () {
|
$("#anime_category #recent").on("click", function () {
|
||||||
let spinner = document.getElementById("spinner");
|
let spinner = document.getElementById("spinner");
|
||||||
spinner.style.display = "block";
|
spinner.style.display = "block";
|
||||||
current_cate = "ing";
|
current_cate = "recent";
|
||||||
get_anime_list(1, "ing");
|
get_lecture_list(1, "recent");
|
||||||
});
|
});
|
||||||
$("#anime_category #movie").on("click", function () {
|
$("#anime_category #rating").on("click", function () {
|
||||||
current_cate = "movie";
|
current_cate = "rating";
|
||||||
get_anime_screen_movie(1);
|
get_lecture_list(1, "rating");
|
||||||
});
|
});
|
||||||
$("#anime_category #complete_anilist").on("click", function () {
|
$("#anime_category #popular").on("click", function () {
|
||||||
current_cate = "complete";
|
current_cate = "popular";
|
||||||
get_complete_anilist(1);
|
get_lecture_list(1, "popular");
|
||||||
|
});
|
||||||
|
$("#anime_category #seq").on("click", function () {
|
||||||
|
current_cate = "seq";
|
||||||
|
get_lecture_list(1, "seq");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "#btn_search", function (e) {
|
$("body").on("click", "#btn_search", function (e) {
|
||||||
@@ -38,7 +42,7 @@ $("body").on("click", "#btn_search", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/search",
|
url: "/" + package_name + "/ajax/search",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { query: query },
|
data: {query: query},
|
||||||
// dataType: "json",
|
// dataType: "json",
|
||||||
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
@@ -53,47 +57,27 @@ $("body").on("click", "#btn_search", function (e) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const get_airing_list = () => {
|
|
||||||
let spinner = document.getElementById("spinner");
|
|
||||||
spinner.style.display = "block";
|
|
||||||
$.ajax({
|
|
||||||
url: "/" + package_name + "/ajax/airing_list",
|
|
||||||
type: "GET",
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
success: (ret) => {
|
|
||||||
current_airing_data = ret;
|
|
||||||
// console.log("ret::>", ret);
|
|
||||||
if (current_airing_data !== "") {
|
|
||||||
make_airing_list(ret);
|
|
||||||
div_visible = true;
|
|
||||||
spinner.style.display = "none";
|
|
||||||
// console.log(div_visible);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (div_visible) {
|
const get_lecture_list = (page, type) => {
|
||||||
// {#$('#airing_list').toggle()#}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const get_anime_list = (page, type) => {
|
|
||||||
let url = "";
|
let url = "";
|
||||||
let data = { page: page, type: type };
|
let data = {page: page, type: type};
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "ing":
|
case "recent":
|
||||||
url = "/" + package_name + "/ajax/anime_list";
|
url = "/" + package_name + "/ajax/get_lecture_list";
|
||||||
current_cate = "ing";
|
current_cate = "recent";
|
||||||
break;
|
break;
|
||||||
case "movie":
|
case "ranking":
|
||||||
url = "/" + package_name + "/ajax/screen_movie_list";
|
url = "/" + package_name + "/ajax/get_lecture_list";
|
||||||
current_cate = "movie";
|
current_cate = "ranking";
|
||||||
break;
|
break;
|
||||||
case "complete":
|
case "popular":
|
||||||
url = "/" + package_name + "/ajax/screen_movie_list";
|
url = "/" + package_name + "/ajax/get_lecture_list";
|
||||||
current_cate = "complete";
|
current_cate = "popular";
|
||||||
|
break;
|
||||||
|
case "seq":
|
||||||
|
url = "/" + package_name + "/ajax/get_lecture_list";
|
||||||
|
current_cate = "seq";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -108,7 +92,7 @@ const get_anime_list = (page, type) => {
|
|||||||
success: (ret) => {
|
success: (ret) => {
|
||||||
current_screen_movie_data = ret;
|
current_screen_movie_data = ret;
|
||||||
total_page = ret.total_page;
|
total_page = ret.total_page;
|
||||||
// console.log("ret::>", ret);
|
console.log("ret::>", ret);
|
||||||
|
|
||||||
if (current_screen_movie_data !== "") {
|
if (current_screen_movie_data !== "") {
|
||||||
make_screen_movie_list(ret, page);
|
make_screen_movie_list(ret, page);
|
||||||
@@ -124,58 +108,6 @@ const get_anime_list = (page, type) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const get_anime_screen_movie = (page) => {
|
|
||||||
let data = { page: page };
|
|
||||||
$.ajax({
|
|
||||||
url: "/" + package_name + "/ajax/screen_movie_list",
|
|
||||||
type: "POST",
|
|
||||||
data: data,
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
success: (ret) => {
|
|
||||||
current_screen_movie_data = ret;
|
|
||||||
total_page = ret.total_page;
|
|
||||||
// console.log("ret::>", ret);
|
|
||||||
|
|
||||||
if (current_screen_movie_data !== "") {
|
|
||||||
make_screen_movie_list(ret, page);
|
|
||||||
$("img.lazyload").lazyload({
|
|
||||||
threshold: 100,
|
|
||||||
effect: "fadeIn",
|
|
||||||
});
|
|
||||||
div_visible = true;
|
|
||||||
}
|
|
||||||
next_page = page + 1;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const get_complete_anilist = (page) => {
|
|
||||||
let data = { page: page };
|
|
||||||
$.ajax({
|
|
||||||
url: "/" + package_name + "/ajax/complete_anilist",
|
|
||||||
type: "POST",
|
|
||||||
data: data,
|
|
||||||
cache: false,
|
|
||||||
dataType: "json",
|
|
||||||
success: (ret) => {
|
|
||||||
current_screen_movie_data = ret;
|
|
||||||
console.log("get_complete_anilist():ret >", ret);
|
|
||||||
total_page = ret.total_page;
|
|
||||||
|
|
||||||
if (current_screen_movie_data !== "") {
|
|
||||||
make_screen_movie_list(ret, page);
|
|
||||||
$("img.lazyload").lazyload({
|
|
||||||
threshold: 100,
|
|
||||||
effect: "fadeIn",
|
|
||||||
});
|
|
||||||
div_visible = true;
|
|
||||||
}
|
|
||||||
next_page = page + 1;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// console.log(div_visible);
|
// console.log(div_visible);
|
||||||
|
|
||||||
$(document).on("click", "button.code-button", function (e) {
|
$(document).on("click", "button.code-button", function (e) {
|
||||||
@@ -190,31 +122,32 @@ $(document).on("click", "button.code-button", function (e) {
|
|||||||
});
|
});
|
||||||
$(".code-button").tooltip();
|
$(".code-button").tooltip();
|
||||||
|
|
||||||
$("body").on("click", "#analysis_btn", function (e) {
|
// $("body").on("click", "#analysis_btn", function (e) {
|
||||||
e.preventDefault();
|
// e.preventDefault();
|
||||||
code = document.getElementById("code").value;
|
// code = document.getElementById("code").value;
|
||||||
if (document.getElementById("code").value === "") {
|
// if (document.getElementById("code").value === "") {
|
||||||
console.log("code 값을 입력 해주세요.");
|
// console.log("code 값을 입력 해주세요.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
url: "/" + package_name + "/ajax/analysis",
|
// url: "/" + package_name + "/ajax/analysis",
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
cache: false,
|
// cache: false,
|
||||||
data: { code: code },
|
// data: { code: code },
|
||||||
dataType: "json",
|
// dataType: "json",
|
||||||
success: function (ret) {
|
// success: function (ret) {
|
||||||
if (ret.ret) {
|
// if (ret.ret) {
|
||||||
make_program(ret);
|
// console.log(ret)
|
||||||
} else {
|
// make_program(ret);
|
||||||
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
// } else {
|
||||||
type: "warning",
|
// $.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
||||||
});
|
// type: "warning",
|
||||||
}
|
// });
|
||||||
},
|
// }
|
||||||
});
|
// },
|
||||||
});
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
$("body").on("click", "#go_inflearn_btn", function (e) {
|
$("body").on("click", "#go_inflearn_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -284,7 +217,7 @@ function make_screen_movie_list(data, page) {
|
|||||||
'" style="cursor: pointer" onclick="location.href=\'./request?code=' +
|
'" style="cursor: pointer" onclick="location.href=\'./request?code=' +
|
||||||
data.episode[i].code +
|
data.episode[i].code +
|
||||||
"'\"/>";
|
"'\"/>";
|
||||||
if (current_cate == "ing") {
|
if (current_cate == "recent") {
|
||||||
tmp +=
|
tmp +=
|
||||||
'<span class="badge badge-danger badge-on-image">' +
|
'<span class="badge badge-danger badge-on-image">' +
|
||||||
data.episode[i].chapter +
|
data.episode[i].chapter +
|
||||||
@@ -296,8 +229,8 @@ function make_screen_movie_list(data, page) {
|
|||||||
'<button id="add_whitelist" name="add_whitelist" class="btn btn-sm btn-success mb-1" data-code="' +
|
'<button id="add_whitelist" name="add_whitelist" class="btn btn-sm btn-success mb-1" data-code="' +
|
||||||
data.episode[i].code +
|
data.episode[i].code +
|
||||||
'"><p class="card-text">' +
|
'"><p class="card-text">' +
|
||||||
data.episode[i].code +
|
data.episode[i].teacher +
|
||||||
" 자동 추가</p></button>";
|
"</p></button>";
|
||||||
tmp +=
|
tmp +=
|
||||||
'<a href="./request?code=' +
|
'<a href="./request?code=' +
|
||||||
data.episode[i].code +
|
data.episode[i].code +
|
||||||
@@ -335,21 +268,23 @@ const infiniteContainer = document.getElementById("screen_movie_list");
|
|||||||
|
|
||||||
const loadNextAnimes = (cate, page) => {
|
const loadNextAnimes = (cate, page) => {
|
||||||
spinner.style.display = "block";
|
spinner.style.display = "block";
|
||||||
const data = { type: cate, page: String(page) };
|
const data = {type: cate, page: String(page)};
|
||||||
let url = "";
|
let url = "";
|
||||||
|
|
||||||
|
url = "/" + package_name + "/ajax/get_lecture_list";
|
||||||
switch (cate) {
|
switch (cate) {
|
||||||
case "ing":
|
case "recent":
|
||||||
url = "/" + package_name + "/ajax/anime_list";
|
|
||||||
current_cate = "ing";
|
current_cate = "recent";
|
||||||
break;
|
break;
|
||||||
case "movie":
|
case "ranking":
|
||||||
url = "/" + package_name + "/ajax/screen_movie_list";
|
current_cate = "ranking";
|
||||||
current_cate = "movie";
|
|
||||||
break;
|
break;
|
||||||
case "complete":
|
case "popular":
|
||||||
url = "/" + package_name + "/ajax/anime_list";
|
current_cate = "popular";
|
||||||
current_cate = "complete";
|
break;
|
||||||
|
case "seq":
|
||||||
|
current_cate = "seq";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -391,9 +326,9 @@ const loadNextAnimes = (cate, page) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onScroll = (e) => {
|
const onScroll = (e) => {
|
||||||
threshold = 50;
|
let threshold = 50;
|
||||||
console.dir(e.target.scrollingElement.scrollHeight);
|
console.dir(e.target.scrollingElement.scrollHeight);
|
||||||
const { scrollTop, scrollHeight, clientHeight } = e.target.scrollingElement;
|
const {scrollTop, scrollHeight, clientHeight} = e.target.scrollingElement;
|
||||||
// if (Math.round(clientHeight + scrollTop) >= scrollHeight + threshold) {
|
// if (Math.round(clientHeight + scrollTop) >= scrollHeight + threshold) {
|
||||||
if (clientHeight + scrollTop + threshold >= scrollHeight) {
|
if (clientHeight + scrollTop + threshold >= scrollHeight) {
|
||||||
document.getElementById("spinner").style.display = "block";
|
document.getElementById("spinner").style.display = "block";
|
||||||
@@ -490,7 +425,7 @@ function make_program(data) {
|
|||||||
data.episode[i].code +
|
data.episode[i].code +
|
||||||
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small"> ';
|
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small"> ';
|
||||||
tmp += m_button("add_queue_btn", "다운로드 추가", [
|
tmp += m_button("add_queue_btn", "다운로드 추가", [
|
||||||
{ key: "code", value: data.episode[i].code },
|
{key: "code", value: data.episode[i].code},
|
||||||
]);
|
]);
|
||||||
tmp += "</div>";
|
tmp += "</div>";
|
||||||
str += m_col(12, tmp);
|
str += m_col(12, tmp);
|
||||||
@@ -518,31 +453,31 @@ $("body").on("click", "#search_tvdb_btn", function (e) {
|
|||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "#add_whitelist", function (e) {
|
// $("body").on("click", "#add_whitelist", function (e) {
|
||||||
e.preventDefault();
|
// e.preventDefault();
|
||||||
let data_code = $(this).attr("data-code");
|
// let data_code = $(this).attr("data-code");
|
||||||
console.log(data_code);
|
// console.log(data_code);
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
url: "/" + package_name + "/ajax/add_whitelist",
|
// url: "/" + package_name + "/ajax/add_whitelist",
|
||||||
type: "POST",
|
// type: "POST",
|
||||||
cache: false,
|
// cache: false,
|
||||||
data: JSON.stringify({ data_code: data_code }),
|
// data: JSON.stringify({ data_code: data_code }),
|
||||||
contentType: "application/json;charset=UTF-8",
|
// contentType: "application/json;charset=UTF-8",
|
||||||
dataType: "json",
|
// dataType: "json",
|
||||||
success: function (ret) {
|
// success: function (ret) {
|
||||||
if (ret.ret) {
|
// if (ret.ret) {
|
||||||
$.notify("<strong>추가하였습니다.</strong><br>", {
|
// $.notify("<strong>추가하였습니다.</strong><br>", {
|
||||||
type: "success",
|
// type: "success",
|
||||||
});
|
// });
|
||||||
make_program(ret);
|
// make_program(ret);
|
||||||
} else {
|
// } else {
|
||||||
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
|
// $.notify("<strong>추가 실패</strong><br>" + ret.log, {
|
||||||
type: "warning",
|
// type: "warning",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
$("body").on("click", "#apply_new_title_btn", function (e) {
|
$("body").on("click", "#apply_new_title_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -551,9 +486,10 @@ $("body").on("click", "#apply_new_title_btn", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/apply_new_title",
|
url: "/" + package_name + "/ajax/apply_new_title",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { new_title: new_title },
|
data: {new_title: new_title},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
|
|
||||||
if (ret.ret) {
|
if (ret.ret) {
|
||||||
$.notify("<strong>적용하였습니다.</strong><br>", {
|
$.notify("<strong>적용하였습니다.</strong><br>", {
|
||||||
type: "success",
|
type: "success",
|
||||||
@@ -581,7 +517,7 @@ $("body").on("click", "#apply_new_season_btn", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/apply_new_season",
|
url: "/" + package_name + "/ajax/apply_new_season",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { new_season: new_season },
|
data: {new_season: new_season},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
if (ret.ret) {
|
if (ret.ret) {
|
||||||
@@ -607,7 +543,7 @@ $("body").on("click", "#add_queue_btn", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/add_queue",
|
url: "/" + package_name + "/ajax/add_queue",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { code: code },
|
data: {code: code},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.ret === "success") {
|
if (data.ret === "success") {
|
||||||
@@ -651,7 +587,7 @@ $("body").on("click", "#check_download_btn", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/add_queue_checked_list",
|
url: "/" + package_name + "/ajax/add_queue_checked_list",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { code: str },
|
data: {code: str},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.ret == "success") {
|
if (data.ret == "success") {
|
||||||
@@ -667,23 +603,6 @@ $("body").on("click", "#check_download_btn", function (e) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// $("#go_modal_airing").on("shown.bs.modal", function () {
|
|
||||||
// // {#get_airing_list()#}
|
|
||||||
// $("#exModal").trigger("focus");
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $("#go_modal_airing").click(function (e) {
|
|
||||||
// e.preventDefault();
|
|
||||||
// console.log("open modal");
|
|
||||||
// // $("#exModal").bootstrapToggle();
|
|
||||||
// if (current_airing_data === "") {
|
|
||||||
// get_airing_list();
|
|
||||||
// }
|
|
||||||
// $("#inner_airing").toggle();
|
|
||||||
// $("#airing_list").toggle();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $("#go_modal_airing").attr("class", "btn btn-primary");
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#input_search").keydown(function (key) {
|
$("#input_search").keydown(function (key) {
|
||||||
@@ -694,11 +613,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
let spinner = document.getElementById("spinner");
|
let spinner = document.getElementById("spinner");
|
||||||
spinner.style.display = "block";
|
spinner.style.display = "block";
|
||||||
get_anime_list(1, "ing");
|
get_lecture_list(1, "recent");
|
||||||
// $("img.lazyload").lazyload({
|
|
||||||
// threshold : 200,
|
|
||||||
// effect : "fadeIn",
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// <!--<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.7.0/dist/lazyload.min.js"></script>-->
|
// <!--<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.7.0/dist/lazyload.min.js"></script>-->
|
||||||
|
|||||||
399
static/js/inflearn_excel.js
Executable file
399
static/js/inflearn_excel.js
Executable file
@@ -0,0 +1,399 @@
|
|||||||
|
let current_data = "";
|
||||||
|
let current_airing_data = "";
|
||||||
|
let code = "";
|
||||||
|
let div_visible = false;
|
||||||
|
let total_page = "";
|
||||||
|
|
||||||
|
const params = new Proxy(new URLSearchParams(window.location.search), {
|
||||||
|
get: (searchParams, prop) => searchParams.get(prop),
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log('current_airing_data', current_airing_data);
|
||||||
|
|
||||||
|
const get_excel_list = () => {
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/excel_list",
|
||||||
|
type: "GET",
|
||||||
|
cache: false,
|
||||||
|
dataType: "json",
|
||||||
|
success: (ret) => {
|
||||||
|
if (ret.ret == "success" && ret.data != null) {
|
||||||
|
current_airing_data = ret;
|
||||||
|
total_page = ret.total_page;
|
||||||
|
console.log(ret)
|
||||||
|
if (current_airing_data !== "") {
|
||||||
|
make_airing_list(ret);
|
||||||
|
div_visible = true;
|
||||||
|
// console.log(div_visible)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$(document).on("click", "button.code-button", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// console.log('click')
|
||||||
|
// console.log('code to click:' + $(this).data("code"))
|
||||||
|
document.getElementById("code").value = $(this).data("code");
|
||||||
|
$("#code").val($(this).data("code"));
|
||||||
|
$("#airing_list").toggle();
|
||||||
|
code = document.getElementById("code").value;
|
||||||
|
document.getElementById("analysis_btn").click();
|
||||||
|
});
|
||||||
|
$(".code-button").tooltip();
|
||||||
|
|
||||||
|
|
||||||
|
$("body").on("click", "#go_inflearn_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.open(inflearn_url, "_blank");
|
||||||
|
});
|
||||||
|
|
||||||
|
function make_airing_list(data) {
|
||||||
|
let str = "";
|
||||||
|
let tmp = "";
|
||||||
|
|
||||||
|
tmp =
|
||||||
|
'<div id="exModal" class="form-inline" role="dialog" aria-hidden="true">';
|
||||||
|
tmp += "</div>";
|
||||||
|
str += m_hr_black();
|
||||||
|
// {#str += m_row_start(0);#}
|
||||||
|
// {##}
|
||||||
|
// {#str += m_row_end();#}
|
||||||
|
// {#str += m_hr_black();#}
|
||||||
|
str +=
|
||||||
|
'<div id="inner_airing" class="d-flex align-content-between flex-wrapd-flex align-content-between flex-wrap">';
|
||||||
|
for (i in data.episode) {
|
||||||
|
// {#str += m_row_start();#}
|
||||||
|
// {#tmp = '<div class="col-sm"><strong>' + data.episode[i].title+ '</strong>';#}
|
||||||
|
//
|
||||||
|
// {#tmp += '<br />'#}
|
||||||
|
// {#tmp += '' + data.episode[i].code + '</div>';#}
|
||||||
|
// {#str += m_col(12, tmp)#}
|
||||||
|
tmp =
|
||||||
|
'<div class="mx-1 mb-1"><button id="code_button" data-code="' +
|
||||||
|
data.episode[i].code +
|
||||||
|
'" type="button" class="btn btn-primary code-button bootstrap-tooltip" data-toggle="button" data-tooltip="true" aria-pressed="true" autocomplete="off" data-placement="top">' +
|
||||||
|
'<span data-tooltip-text="' +
|
||||||
|
data.episode[i].title +
|
||||||
|
'">' +
|
||||||
|
data.episode[i].code +
|
||||||
|
"</span></button></div>";
|
||||||
|
// {#if (i === 10) {#}
|
||||||
|
// {# tmp += '<div class="w-100"></div>'#}
|
||||||
|
str += tmp;
|
||||||
|
}
|
||||||
|
str += "</div>";
|
||||||
|
str += m_hr_black();
|
||||||
|
|
||||||
|
document.getElementById("airing_list").innerHTML = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_program(data) {
|
||||||
|
current_data = data;
|
||||||
|
// console.log('current_data:: ', data)
|
||||||
|
str = "";
|
||||||
|
tmp = '<div class="form-inline w-100">';
|
||||||
|
tmp += m_button("check_download_btn", "선택 다운로드 추가", []);
|
||||||
|
tmp += m_button("all_check_on_btn", "전체 선택", []);
|
||||||
|
tmp += m_button("all_check_off_btn", "전체 해제", []);
|
||||||
|
tmp +=
|
||||||
|
' <input id="new_title" name="new_title" class="form-control form-control-sm" value="' +
|
||||||
|
data.title +
|
||||||
|
'">';
|
||||||
|
tmp += "</div>";
|
||||||
|
tmp += '<div class="form-inline">';
|
||||||
|
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
|
||||||
|
// tmp +=
|
||||||
|
// ' <input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
|
||||||
|
// data.season +
|
||||||
|
// '">';
|
||||||
|
// tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
|
||||||
|
// tmp += m_button("search_tvdb_btn", "TVDB", []);
|
||||||
|
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
|
||||||
|
tmp += "</div>";
|
||||||
|
tmp = m_button_group(tmp);
|
||||||
|
str += tmp;
|
||||||
|
// program
|
||||||
|
str += m_hr_black();
|
||||||
|
str += m_row_start(0);
|
||||||
|
tmp = "";
|
||||||
|
if (data.poster_url != null)
|
||||||
|
tmp = '<img src="' + data.poster_url + '" class="img-fluid">';
|
||||||
|
str += m_col(3, tmp);
|
||||||
|
tmp = "";
|
||||||
|
tmp += m_row_start(0);
|
||||||
|
tmp += m_col(3, "제목", "right");
|
||||||
|
tmp += m_col(9, data.title);
|
||||||
|
tmp += m_row_end();
|
||||||
|
tmp += m_row_start(0);
|
||||||
|
tmp += m_col(3, "시즌", "right");
|
||||||
|
tmp += m_col(9, data.season);
|
||||||
|
tmp += m_row_end();
|
||||||
|
for (i in data.detail) {
|
||||||
|
tmp += m_row_start(0);
|
||||||
|
key = Object.keys(data.detail[i])[0];
|
||||||
|
value = data.detail[i][key];
|
||||||
|
tmp += m_col(3, key, "right");
|
||||||
|
tmp += m_col(9, value);
|
||||||
|
tmp += m_row_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
str += m_col(9, tmp);
|
||||||
|
str += m_row_end();
|
||||||
|
|
||||||
|
str += m_hr_black();
|
||||||
|
for (i in data.episode) {
|
||||||
|
str += m_row_start();
|
||||||
|
// tmp = '<img src="' + data.episode[i].image + '" class="img-fluid">'
|
||||||
|
// str += m_col(3, tmp)
|
||||||
|
tmp = "<strong>" + data.episode[i].title + "</strong>";
|
||||||
|
tmp += "<br>";
|
||||||
|
tmp += data.episode[i].filename + "<br><p></p>";
|
||||||
|
|
||||||
|
tmp += '<div class="form-inline">';
|
||||||
|
tmp +=
|
||||||
|
'<input id="checkbox_' +
|
||||||
|
data.episode[i].code +
|
||||||
|
'" name="checkbox_' +
|
||||||
|
data.episode[i].code +
|
||||||
|
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small"> ';
|
||||||
|
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
|
||||||
|
tmp += m_button("add_download", "다운로드 추가", [
|
||||||
|
{key: "idx", value: i},
|
||||||
|
]);
|
||||||
|
tmp += "</div>";
|
||||||
|
str += m_col(12, tmp);
|
||||||
|
str += m_row_end();
|
||||||
|
if (i != data.length - 1) str += m_hr(0);
|
||||||
|
}
|
||||||
|
document.getElementById("episode_list").innerHTML = str;
|
||||||
|
$('input[id^="checkbox_"]').bootstrapToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
$("body").on("click", "#all_check_on_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('input[id^="checkbox_"]').bootstrapToggle("on");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#all_check_off_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('input[id^="checkbox_"]').bootstrapToggle("off");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#search_tvdb_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
new_title = document.getElementById("new_title").value;
|
||||||
|
url = "https://www.thetvdb.com/search?query=" + new_title;
|
||||||
|
window.open(url, "_blank");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#add_whitelist", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/add_whitelist",
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (ret) {
|
||||||
|
if (ret.ret) {
|
||||||
|
$.notify("<strong>추가하였습니다.</strong><br>", {
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
make_program(ret);
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#apply_new_title_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
new_title = document.getElementById("new_title").value;
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/apply_new_title",
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
data: {new_title: new_title},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (ret) {
|
||||||
|
if (ret.ret) {
|
||||||
|
$.notify("<strong>적용하였습니다.</strong><br>", {
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
// console.log(ret)
|
||||||
|
make_program(ret);
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#apply_new_season_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
new_season = document.getElementById("new_season").value;
|
||||||
|
if ($.isNumeric(new_season) == false) {
|
||||||
|
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/apply_new_season",
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
data: {new_season: new_season},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (ret) {
|
||||||
|
if (ret.ret) {
|
||||||
|
$.notify("<strong>적용하였습니다.</strong><br>", {
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
make_program(ret);
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>적용 실패</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 하나씩 다운로드 추가
|
||||||
|
$("body").on("click", "#add_download", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// code = $(this).data('code');
|
||||||
|
code = current_data.episode[$(this).data("idx")].code;
|
||||||
|
// console.log('code:: ', code)
|
||||||
|
let data = current_data.episode[$(this).data("idx")];
|
||||||
|
// console.log('data:: ', data)
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/add_download",
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
data: {code: code, data: JSON.stringify(data)},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
// console.log('#add_queue_btn::data >>', data)
|
||||||
|
if (data.ret === "enqueue_db_append") {
|
||||||
|
$.notify("<strong>다운로드 작업을 추가 하였습니다.</strong>", {
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
} else if (data.ret === "enqueue_db_exist") {
|
||||||
|
$.notify("<strong>DB에 존재하는 에피소드입니다.</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else if (data.ret === "db_completed") {
|
||||||
|
$.notify("<strong>DB에 완료 기록이 있습니다.</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else if (data.ret === "fail") {
|
||||||
|
$.notify("<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else if (data.ret === "no_data") {
|
||||||
|
$.notify("<strong>잘못된 코드입니다.</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else if (data.ret === "Debugging") {
|
||||||
|
$.notify("<strong>Debugging</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>추가 실패</strong><br>" + ret.log, {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", "#check_download_btn", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
all = $('input[id^="checkbox_"]');
|
||||||
|
str = "";
|
||||||
|
for (i in all) {
|
||||||
|
if (all[i].checked) {
|
||||||
|
code = all[i].id.split("_")[1];
|
||||||
|
str += code + ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str == "") {
|
||||||
|
$.notify("<strong>선택하세요.</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: "/" + package_name + "/ajax/add_queue_checked_list",
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
data: {code: str},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.ret == "success") {
|
||||||
|
$.notify("<strong>" + data.log + "개를 추가하였습니다.</strong>", {
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.notify("<strong>" + data.log + "</strong>", {
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#go_modal_airing").on("shown.bs.modal", function () {
|
||||||
|
// {#get_airing_list()#}
|
||||||
|
$("#exModal").trigger("focus");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#go_modal_airing").click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// console.log('open modal')
|
||||||
|
$("#exModal").bootstrapToggle();
|
||||||
|
if (current_airing_data === "") {
|
||||||
|
get_airing_list();
|
||||||
|
}
|
||||||
|
$("#inner_airing").toggle();
|
||||||
|
$("#airing_list").toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#go_modal_airing").attr("class", "btn btn-primary");
|
||||||
|
|
||||||
|
// {#$(function () {#}
|
||||||
|
// {# $('[data-tooltip="true"]').tooltip()#}
|
||||||
|
// {#});#}
|
||||||
|
|
||||||
|
// <!--{#-->
|
||||||
|
// <!--<script src="https://unpkg.com/@popperjs/core@2"></script>-->
|
||||||
|
// <!--#} {#-->
|
||||||
|
// <!--<script src="https://unpkg.com/tippy.js@6"></script>-->
|
||||||
|
// <!--#} {#-->
|
||||||
|
// <!--<script>-->
|
||||||
|
// <!-- // #}-->
|
||||||
|
// <!-- // {# tippy('.code-button',#}-->
|
||||||
|
// <!-- // {# { content: 'aaaa', // tooltip 내용#}-->
|
||||||
|
// <!-- // {# placement: 'top', // 상단 위치#}-->
|
||||||
|
// <!-- // {# trigger: 'hover', // :hover가 아닌 click시 노출#}-->
|
||||||
|
// <!-- // {# hideOnClick : 'toggle', // click시, toggle() 액션#}-->
|
||||||
|
// <!-- // {# animation: 'shift-away' // 아래에서 위로 올라오며 등장#}-->
|
||||||
|
// <!-- // {# })#}-->
|
||||||
|
// <!-- // {##}-->
|
||||||
|
// <!-- // {##}-->
|
||||||
|
// <!-- // {#-->
|
||||||
|
// <!--</script>-->
|
||||||
|
// <!--#}--
|
||||||
@@ -10,34 +10,34 @@ const params = new Proxy(new URLSearchParams(window.location.search), {
|
|||||||
|
|
||||||
// console.log('current_airing_data', current_airing_data);
|
// console.log('current_airing_data', current_airing_data);
|
||||||
|
|
||||||
const get_airing_list = () => {
|
// const get_airing_list = () => {
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
url: "/" + package_name + "/ajax/airing_list",
|
// url: "/" + package_name + "/ajax/airing_list",
|
||||||
type: "GET",
|
// type: "GET",
|
||||||
cache: false,
|
// cache: false,
|
||||||
dataType: "json",
|
// dataType: "json",
|
||||||
success: (ret) => {
|
// success: (ret) => {
|
||||||
if (ret.ret == "success" && ret.episode != null) {
|
// if (ret.ret == "success" && ret.episode != null) {
|
||||||
current_airing_data = ret;
|
// current_airing_data = ret;
|
||||||
total_page = ret.total_page;
|
// total_page = ret.total_page;
|
||||||
// console.log(ret)
|
// // console.log(ret)
|
||||||
if (current_airing_data !== "") {
|
// if (current_airing_data !== "") {
|
||||||
make_airing_list(ret);
|
// make_airing_list(ret);
|
||||||
div_visible = true;
|
// div_visible = true;
|
||||||
// console.log(div_visible)
|
// // console.log(div_visible)
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
// $.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
||||||
type: "warning",
|
// type: "warning",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
if (div_visible) {
|
// if (div_visible) {
|
||||||
// {#$('#airing_list').toggle()#}
|
// // {#$('#airing_list').toggle()#}
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
// console.log(div_visible)
|
// console.log(div_visible)
|
||||||
|
|
||||||
@@ -64,16 +64,20 @@ $("body").on("click", "#analysis_btn", function (e) {
|
|||||||
$.notify("<strong>code 값을 입력해주세요.</strong><br>");
|
$.notify("<strong>code 값을 입력해주세요.</strong><br>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (current_data === "" || current_data.data.code !== code) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/" + package_name + "/ajax/analysis",
|
url: "/" + package_name + "/ajax/analysis",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { code: code },
|
data: {code: code},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
if (ret.ret == "success" && ret.data != null) {
|
if (ret.ret == "success" && ret.data != null) {
|
||||||
|
console.log(ret)
|
||||||
|
// console.log('분석: %s', ret)
|
||||||
make_program(ret.data);
|
make_program(ret.data);
|
||||||
|
run_time = Math.floor(new Date().getTime() / 1000)
|
||||||
|
current_data = ret
|
||||||
} else {
|
} else {
|
||||||
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
$.notify("<strong>분석 실패</strong><br>" + ret.log, {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@@ -81,6 +85,11 @@ $("body").on("click", "#analysis_btn", function (e) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
console.log('과도한 사이트 조회 금지')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "#go_inflearn_btn", function (e) {
|
$("body").on("click", "#go_inflearn_btn", function (e) {
|
||||||
@@ -143,12 +152,12 @@ function make_program(data) {
|
|||||||
tmp += "</div>";
|
tmp += "</div>";
|
||||||
tmp += '<div class="form-inline">';
|
tmp += '<div class="form-inline">';
|
||||||
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
|
tmp += m_button("apply_new_title_btn", "저장폴더명 변경", []);
|
||||||
tmp +=
|
// tmp +=
|
||||||
' <input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
|
// ' <input id="new_season" name="new_season" class="form-control form-control-sm" value="' +
|
||||||
data.season +
|
// data.season +
|
||||||
'">';
|
// '">';
|
||||||
tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
|
// tmp += m_button("apply_new_season_btn", "시즌 변경 (숫자만 가능)", []);
|
||||||
tmp += m_button("search_tvdb_btn", "TVDB", []);
|
// tmp += m_button("search_tvdb_btn", "TVDB", []);
|
||||||
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
|
tmp += m_button("add_whitelist", "스케쥴링 추가", []);
|
||||||
tmp += "</div>";
|
tmp += "</div>";
|
||||||
tmp = m_button_group(tmp);
|
tmp = m_button_group(tmp);
|
||||||
@@ -193,13 +202,13 @@ function make_program(data) {
|
|||||||
tmp += '<div class="form-inline">';
|
tmp += '<div class="form-inline">';
|
||||||
tmp +=
|
tmp +=
|
||||||
'<input id="checkbox_' +
|
'<input id="checkbox_' +
|
||||||
data.episode[i].code +
|
data.episode[i].data_id +
|
||||||
'" name="checkbox_' +
|
'" name="checkbox_' +
|
||||||
data.episode[i].code +
|
data.episode[i].data_id +
|
||||||
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small"> ';
|
'" type="checkbox" checked data-toggle="toggle" data-on="선 택" data-off="-" data-onstyle="success" data-offstyle="danger" data-size="small"> ';
|
||||||
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
|
// tmp += m_button('add_queue_btn', '다운로드 추가', [{'key': 'code', 'value': data.episode[i].code}])
|
||||||
tmp += m_button("add_queue_btn", "다운로드 추가", [
|
tmp += m_button("add_download", "다운로드 추가", [
|
||||||
{ key: "idx", value: i },
|
{key: "idx", value: i},
|
||||||
]);
|
]);
|
||||||
tmp += "</div>";
|
tmp += "</div>";
|
||||||
str += m_col(12, tmp);
|
str += m_col(12, tmp);
|
||||||
@@ -222,8 +231,8 @@ $("body").on("click", "#all_check_off_btn", function (e) {
|
|||||||
|
|
||||||
$("body").on("click", "#search_tvdb_btn", function (e) {
|
$("body").on("click", "#search_tvdb_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
new_title = document.getElementById("new_title").value;
|
const new_title = document.getElementById("new_title").value;
|
||||||
url = "https://www.thetvdb.com/search?query=" + new_title;
|
let url = "https://www.thetvdb.com/search?query=" + new_title;
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -251,12 +260,12 @@ $("body").on("click", "#add_whitelist", function (e) {
|
|||||||
|
|
||||||
$("body").on("click", "#apply_new_title_btn", function (e) {
|
$("body").on("click", "#apply_new_title_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
new_title = document.getElementById("new_title").value;
|
const new_title = document.getElementById("new_title").value;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/" + package_name + "/ajax/apply_new_title",
|
url: "/" + package_name + "/ajax/apply_new_title",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { new_title: new_title },
|
data: {new_title: new_title},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
if (ret.ret) {
|
if (ret.ret) {
|
||||||
@@ -276,7 +285,7 @@ $("body").on("click", "#apply_new_title_btn", function (e) {
|
|||||||
|
|
||||||
$("body").on("click", "#apply_new_season_btn", function (e) {
|
$("body").on("click", "#apply_new_season_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
new_season = document.getElementById("new_season").value;
|
const new_season = document.getElementById("new_season").value;
|
||||||
if ($.isNumeric(new_season) == false) {
|
if ($.isNumeric(new_season) == false) {
|
||||||
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
|
$.notify("<strong>시즌은 숫자여야 합니다.</strong><br>" + ret.log, {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@@ -286,7 +295,7 @@ $("body").on("click", "#apply_new_season_btn", function (e) {
|
|||||||
url: "/" + package_name + "/ajax/apply_new_season",
|
url: "/" + package_name + "/ajax/apply_new_season",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { new_season: new_season },
|
data: {new_season: new_season},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (ret) {
|
success: function (ret) {
|
||||||
if (ret.ret) {
|
if (ret.ret) {
|
||||||
@@ -305,18 +314,18 @@ $("body").on("click", "#apply_new_season_btn", function (e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 하나씩 다운로드 추가
|
// 하나씩 다운로드 추가
|
||||||
$("body").on("click", "#add_queue_btn", function (e) {
|
$("body").on("click", "#add_download", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// code = $(this).data('code');
|
// code = $(this).data('code');
|
||||||
code = current_data.episode[$(this).data("idx")].code;
|
code = current_data.data.episode[$(this).data("idx")].code;
|
||||||
// console.log('code:: ', code)
|
// console.log('code:: ', code)
|
||||||
let data = current_data.episode[$(this).data("idx")];
|
let data = current_data.data.episode[$(this).data("idx")];
|
||||||
// console.log('data:: ', data)
|
// console.log('data:: ', data)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/" + package_name + "/ajax/add_queue",
|
url: "/" + package_name + "/ajax/add_download",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { code: code, data: JSON.stringify(data) },
|
data: {code: code, data: JSON.stringify(data)},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
// console.log('#add_queue_btn::data >>', data)
|
// console.log('#add_queue_btn::data >>', data)
|
||||||
@@ -355,25 +364,34 @@ $("body").on("click", "#add_queue_btn", function (e) {
|
|||||||
|
|
||||||
$("body").on("click", "#check_download_btn", function (e) {
|
$("body").on("click", "#check_download_btn", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
all = $('input[id^="checkbox_"]');
|
const checked_items = $('input[id^="checkbox_"]');
|
||||||
str = "";
|
console.log(checked_items)
|
||||||
for (i in all) {
|
let str = "";
|
||||||
if (all[i].checked) {
|
for (let i in checked_items) {
|
||||||
code = all[i].id.split("_")[1];
|
if (checked_items[i].checked) {
|
||||||
|
code = checked_items[i].id.split("_")[1];
|
||||||
str += code + ",";
|
str += code + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (str == "") {
|
lecture_id = current_data.data.episode[0].item_id
|
||||||
|
|
||||||
|
console.log(`checked_items: ${checked_items}`)
|
||||||
|
|
||||||
|
console.log(str)
|
||||||
|
if (str === "") {
|
||||||
$.notify("<strong>선택하세요.</strong>", {
|
$.notify("<strong>선택하세요.</strong>", {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/" + package_name + "/ajax/add_queue_checked_list",
|
url: "/" + package_name + "/ajax/add_queue_checked_list",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
cache: false,
|
cache: false,
|
||||||
data: { code: str },
|
data: {code: str, lecture_id: lecture_id},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.ret == "success") {
|
if (data.ret == "success") {
|
||||||
@@ -407,26 +425,3 @@ $("#go_modal_airing").click(function (e) {
|
|||||||
|
|
||||||
$("#go_modal_airing").attr("class", "btn btn-primary");
|
$("#go_modal_airing").attr("class", "btn btn-primary");
|
||||||
|
|
||||||
// {#$(function () {#}
|
|
||||||
// {# $('[data-tooltip="true"]').tooltip()#}
|
|
||||||
// {#});#}
|
|
||||||
|
|
||||||
// <!--{#-->
|
|
||||||
// <!--<script src="https://unpkg.com/@popperjs/core@2"></script>-->
|
|
||||||
// <!--#} {#-->
|
|
||||||
// <!--<script src="https://unpkg.com/tippy.js@6"></script>-->
|
|
||||||
// <!--#} {#-->
|
|
||||||
// <!--<script>-->
|
|
||||||
// <!-- // #}-->
|
|
||||||
// <!-- // {# tippy('.code-button',#}-->
|
|
||||||
// <!-- // {# { content: 'aaaa', // tooltip 내용#}-->
|
|
||||||
// <!-- // {# placement: 'top', // 상단 위치#}-->
|
|
||||||
// <!-- // {# trigger: 'hover', // :hover가 아닌 click시 노출#}-->
|
|
||||||
// <!-- // {# hideOnClick : 'toggle', // click시, toggle() 액션#}-->
|
|
||||||
// <!-- // {# animation: 'shift-away' // 아래에서 위로 올라오며 등장#}-->
|
|
||||||
// <!-- // {# })#}-->
|
|
||||||
// <!-- // {##}-->
|
|
||||||
// <!-- // {##}-->
|
|
||||||
// <!-- // {#-->
|
|
||||||
// <!--</script>-->
|
|
||||||
// <!--#}--
|
|
||||||
|
|||||||
@@ -20,27 +20,26 @@
|
|||||||
role="group"
|
role="group"
|
||||||
aria-label="Basic example"
|
aria-label="Basic example"
|
||||||
>
|
>
|
||||||
<button id="ing" type="button" class="btn btn-success">방영중</button>
|
<button id="recent" type="button" class="btn btn-success">최신순</button>
|
||||||
<button id="movie" type="button" class="btn btn-primary">극장판</button>
|
<button id="popular" type="button" class="btn btn-primary">인기순</button>
|
||||||
<button id="complete_anilist" type="button" class="btn btn-dark">
|
<button id="rating" type="button" class="btn btn-dark">
|
||||||
완결
|
평점순
|
||||||
|
</button>
|
||||||
|
<button id="seq" type="button" class="btn btn-dark">
|
||||||
|
추천순
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="airing_list_form">
|
<form id="recent_list_form">
|
||||||
<div id="airing_list"></div>
|
<div id="recent_list"></div>
|
||||||
</form>
|
</form>
|
||||||
<form id="screen_movie_list_form">
|
<form id="screen_movie_list_form">
|
||||||
<div id="screen_movie_list" class="container"></div>
|
<div id="screen_movie_list" class="container"></div>
|
||||||
</form>
|
</form>
|
||||||
<!-- <div class="text-center">-->
|
|
||||||
<!-- <div id="spinner" class="spinner-border" role="status">-->
|
|
||||||
<!-- <span class="sr-only">Loading...</span>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<form id="program_auto_form">
|
<form id="program_auto_form">
|
||||||
<div id="episode_list"></div>
|
<div id="lecture_list"></div>
|
||||||
</form>
|
</form>
|
||||||
<div class="spinner" id="spinner" style="display: none">
|
<div class="spinner" id="spinner" style="display: none">
|
||||||
<div class="double-bounce1"></div>
|
<div class="double-bounce1"></div>
|
||||||
|
|||||||
30
templates/inflearn_excel.html
Executable file
30
templates/inflearn_excel.html
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
{% extends "base.html" %} {% block content %}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<form id="program_list">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<form id="airing_list_form">
|
||||||
|
<div id="airing_list"></div>
|
||||||
|
</form>
|
||||||
|
<form id="program_auto_form">
|
||||||
|
<div id="episode_list"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<!--전체-->
|
||||||
|
<link
|
||||||
|
href="{{ url_for('.static', filename='css/%s.css' % arg['template_name'])
|
||||||
|
}}"
|
||||||
|
type="text/css"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<script type="text/javascript">
|
||||||
|
const package_name = "inflearn";
|
||||||
|
const inflearn_url = "{{arg['inflearn_url']}}";
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
get_excel_list()
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script src="{{ url_for('.static', filename='js/%s.js' % arg['template_name']) }}"></script>
|
||||||
|
{% endblock %}
|
||||||
@@ -3,18 +3,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<form id="program_list">
|
<form id="program_list">
|
||||||
{{ macros.setting_input_text_and_buttons('code', '작품 Code',
|
{{ macros.setting_input_text_and_buttons('code', '작품 Code',
|
||||||
[['analysis_btn', '분석'], ['go_inflearn_btn', 'Go Linkkf'],
|
[['analysis_btn', '분석'], ['go_inflearn_btn', 'Go Linkkf']], desc='URL:
|
||||||
['go_modal_airing', '방영중']], desc='URL: https://linkkf.app/[코드]/
|
https://www.inflearn.com/course/코드#curriculum') }}
|
||||||
형식에서 코드부분 숫자 (예> 22005 원피스)') }}
|
|
||||||
<!-- {#-->
|
|
||||||
<!-- <botton-->
|
|
||||||
<!-- id="go_modal_airing"-->
|
|
||||||
<!-- type="button"-->
|
|
||||||
<!-- class="btn btn-primary"-->
|
|
||||||
<!-- data-toggle="modal"-->
|
|
||||||
<!-- data-target="#exModal"-->
|
|
||||||
<!-- >방영중</botton-->
|
|
||||||
<!-- >#}-->
|
|
||||||
</form>
|
</form>
|
||||||
<form id="airing_list_form">
|
<form id="airing_list_form">
|
||||||
<div id="airing_list"></div>
|
<div id="airing_list"></div>
|
||||||
@@ -31,16 +22,22 @@
|
|||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const package_name = "linkkf-yommi";
|
const package_name = "inflearn";
|
||||||
const inflearn_url = "{{arg['inflearn_url']}}";
|
const inflearn_url = "{{arg['inflearn_url']}}";
|
||||||
|
// let current_data = ""
|
||||||
|
let run_time = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// console.log ('current_code::', {{arg['current_code']}})
|
// console.log ('current_code::', {{arg['current_code']}})
|
||||||
// {#console.log(params)#}
|
// {#console.log(params)#}
|
||||||
// {#code = params.code#}
|
// {#code = params.code#}
|
||||||
// {#console.log('code:::> ', code)#}
|
// {#console.log('code:::> ', code)#}
|
||||||
|
// console.log('current_data:: ', current_data)
|
||||||
|
let now = Math.floor(new Date().getTime() / 1000)
|
||||||
|
|
||||||
if ("{{arg['current_code']}}" !== "") {
|
if ("{{arg['current_code']}}" !== "" && current_data.data.code === "{{arg['current_code']}}") {
|
||||||
code = "{{arg['current_code']}}";
|
code = "{{arg['current_code']}}";
|
||||||
document.getElementById("code").value = "{{arg['current_code']}}";
|
document.getElementById("code").value = "{{arg['current_code']}}";
|
||||||
document.getElementById("analysis_btn").click();
|
document.getElementById("analysis_btn").click();
|
||||||
@@ -55,8 +52,10 @@
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById("code").value = params.code;
|
document.getElementById("code").value = params.code;
|
||||||
document.getElementById("analysis_btn").click();
|
document.getElementById("analysis_btn").click();
|
||||||
|
|
||||||
}
|
}
|
||||||
// console.log('code:::' ,code)
|
console.log('run_time:::' ,run_time)
|
||||||
|
console.log('after_time:::' ,now - run_time)
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ url_for('.static', filename='js/%s.js' % arg['template_name']) }}"></script>
|
<script src="{{ url_for('.static', filename='js/%s.js' % arg['template_name']) }}"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user