Compare commits

...

2 Commits

Author SHA1 Message Date
ce07ca12e2 bug fix 1 2022-05-08 19:36:16 +09:00
ce1db623e6 소소한 정리 3 2022-04-27 15:29:17 +09:00
3 changed files with 596 additions and 575 deletions

View File

@@ -8,8 +8,10 @@
import os, sys, traceback, re, json, threading
from datetime import datetime
import copy
# third-party
import requests
# third-party
from flask import request, render_template, jsonify
from sqlalchemy import or_, and_, func, not_, desc
@@ -18,29 +20,40 @@ from sqlalchemy import or_, and_, func, not_, desc
from framework import db, scheduler, path_data, socketio
from framework.util import Util
from framework.common.util import headers
from plugin import LogicModuleBase, FfmpegQueueEntity, FfmpegQueue, default_route_socketio
from plugin import (
LogicModuleBase,
FfmpegQueueEntity,
FfmpegQueue,
default_route_socketio,
)
from tool_base import d
# 패키지
from .plugin import P
class LogicLinkkf(LogicModuleBase):
def __init__(self, P):
super(LogicLinkkf, self).__init__(P, 'setting', scheduler_desc='linkkf 자동 다운로드')
self.name = 'linkkf'
super(LogicLinkkf, self).__init__(P, "setting", scheduler_desc="linkkf 자동 다운로드")
self.name = "linkkf"
default_route_socketio(P, self)
def process_menu(self, sub, req):
arg = P.ModelSetting.to_dict()
arg['sub'] = self.name
if sub in ['setting', 'queue', 'list', 'request']:
if sub == 'request' and req.args.get('content_code') is not None:
arg['ani365_current_code'] = req.args.get('content_code')
if sub == 'setting':
job_id = '%s_%s' % (self.P.package_name, self.name)
arg['scheduler'] = str(scheduler.is_include(job_id))
arg['is_running'] = str(scheduler.is_running(job_id))
return render_template('{package_name}_{module_name}_{sub}.html'.format(package_name=P.package_name, module_name=self.name, sub=sub), arg=arg)
return render_template('sample.html', title='%s - %s' % (P.package_name, sub))
arg["sub"] = self.name
if sub in ["setting", "queue", "list", "request"]:
if sub == "request" and req.args.get("content_code") is not None:
arg["ani365_current_code"] = req.args.get("content_code")
if sub == "setting":
job_id = "%s_%s" % (self.P.package_name, self.name)
arg["scheduler"] = str(scheduler.is_include(job_id))
arg["is_running"] = str(scheduler.is_running(job_id))
return render_template(
"{package_name}_{module_name}_{sub}.html".format(
package_name=P.package_name, module_name=self.name, sub=sub
),
arg=arg,
)
return render_template("sample.html", title="%s - %s" % (P.package_name, sub))
pass

View File

@@ -39,7 +39,7 @@ class P(object):
["setting", "설정"],
["request", "요청"],
["queue", ""],
["category", "분류"],
["category", "검색"],
["list", "목록"],
],
"linkkf": [

View File

@@ -48,7 +48,9 @@
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"
></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js" integrity="sha512-jNDtFf7qgU0eH/+Z42FG4fw3w7DM/9zbgNPe3wfJlCylVDTT3IgKW5r92Vy9IHa6U50vyMz5gRByIu4YIXFtaQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js"
integrity="sha512-jNDtFf7qgU0eH/+Z42FG4fw3w7DM/9zbgNPe3wfJlCylVDTT3IgKW5r92Vy9IHa6U50vyMz5gRByIu4YIXFtaQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript">
const package_name = "{{arg['package_name'] }}";
const sub = "{{arg['sub'] }}";
@@ -74,19 +76,19 @@
switch (type) {
case 'ing':
url = '/' + package_name + '/ajax/'+sub+'/anime_list'
url = '/' + package_name + '/ajax/' + sub + '/anime_list'
current_cate = 'ing'
break;
case 'movie':
url = '/' + package_name + '/ajax/'+sub+'/screen_movie_list'
url = '/' + package_name + '/ajax/' + sub + '/screen_movie_list'
current_cate = 'movie'
break;
case 'theater':
url = '/' + package_name + '/ajax/'+sub+'/anime_list'
url = '/' + package_name + '/ajax/' + sub + '/anime_list'
current_cate = 'theater'
break;
case 'fin':
url = '/' + package_name + '/ajax/'+sub+'/complete_list'
url = '/' + package_name + '/ajax/' + sub + '/complete_list'
current_cate = 'fin'
break
default:
@@ -169,8 +171,8 @@
}
$("img.lazyload").lazyload({
threshold : 10,
effect : "fadeIn",
threshold: 10,
effect: "fadeIn",
});
}
@@ -190,7 +192,7 @@
const re = /bo_table=([^&]+)/
const bo_table = data.anime_list[i].link.match(re)
// console.log(bo_table)
request_url = './request?code=' + data.anime_list[i].code + '&amp;wr_id='+ data.anime_list[i].wr_id + '&amp;bo_table='+bo_table[1]
request_url = './request?code=' + data.anime_list[i].code + '&amp;wr_id=' + data.anime_list[i].wr_id + '&amp;bo_table=' + bo_table[1]
} else {
request_url = './request?code=' + data.anime_list[i].code
}
@@ -203,7 +205,7 @@
// {# '<span data-tooltip-text="'+data.episode[i].title+'">' + data.episode[i].code + '</span></button></div>';#}
tmp += '<h5 class="card-title">' + data.anime_list[i].title + '</h5>';
tmp += '<p class="card-text">' + data.anime_list[i].code + '</p>';
tmp += '<a href="'+request_url+'" class="btn btn-primary cut-text">' + data.anime_list[i].title + '</a>';
tmp += '<a href="' + request_url + '" class="btn btn-primary cut-text">' + data.anime_list[i].title + '</a>';
tmp += '</div>';
tmp += '</div>';
tmp += '</div>';
@@ -270,14 +272,14 @@
}
$("img.lazyload").lazyload({
threshold : 10,
effect : "fadeIn",
threshold: 10,
effect: "fadeIn",
});
}
$(document).ready(function(){
$(document).ready(function () {
// if ( "{{arg['ohli24_current_code']}}" !== "" ) {
// document.getElementById("code").value = "{{arg['ohli24_current_code']}}";
@@ -291,6 +293,9 @@
}
})
get_anime_list("ing", 1)
const observer = lozad('.lozad', {
rootMargin: '10px 0px', // syntax similar to that of CSS Margin
threshold: 0.1, // ratio of element convergence
@@ -316,7 +321,7 @@
url: "/" + package_name + "/ajax/" + sub + "/search",
type: "POST",
cache: false,
data: { query: query, type: current_cate, page: page },
data: {query: query, type: current_cate, page: page},
// dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
success: function (ret) {
@@ -333,21 +338,21 @@
});
});
$('#anime_category #ing').on("click", function() {
$('#anime_category #ing').on("click", function () {
// {#console.log(this.id)#}
let spinner = document.getElementById('spinner');
spinner.style.visibility = 'visible';
get_anime_list("ing", 1)
})
$('#anime_category #complete_anilist').on("click", function() {
$('#anime_category #complete_anilist').on("click", function () {
// {#console.log(this.id)#}
let spinner = document.getElementById('spinner');
spinner.style.visibility = 'visible';
get_anime_list("fin", 1)
})
$('#anime_category #theater').on("click", function() {
$('#anime_category #theater').on("click", function () {
// {#console.log(this.id)#}
let spinner = document.getElementById('spinner');
spinner.style.visibility = 'visible';
@@ -355,7 +360,7 @@
})
// 분석 버튼 클릭시 호출
$("body").on('click', '#analysis_btn', function(e) {
$("body").on('click', '#analysis_btn', function (e) {
e.preventDefault();
const code = document.getElementById("code").value
console.log(code)
@@ -378,22 +383,22 @@
});
$("body").on('click', '#go_ohli24_btn', function(e){
$("body").on('click', '#go_ohli24_btn', function (e) {
e.preventDefault();
window.open("{{arg['ohli24_url']}}", "_blank");
});
$("body").on('click', '#all_check_on_btn', function(e){
$("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){
$("body").on('click', '#all_check_off_btn', function (e) {
e.preventDefault();
$('input[id^="checkbox_"]').bootstrapToggle('off')
});
$("body").on('click', '#add_queue_btn', function(e){
$("body").on('click', '#add_queue_btn', function (e) {
e.preventDefault();
data = current_data.episode[$(this).data('idx')];
console.log('data:::>', data)
@@ -401,7 +406,7 @@
url: '/' + package_name + '/ajax/' + sub + '/add_queue',
type: "POST",
cache: false,
data: {data:JSON.stringify(data)},
data: {data: JSON.stringify(data)},
dataType: "json",
success: function (data) {
if (data.ret == 'enqueue_db_append' || data.ret == 'enqueue_db_exist') {
@@ -422,23 +427,23 @@
// observer.observe();
const loadNextAnimes = (cate, page) => {
spinner.style.display = "block";
let data = { type: cate, page: String(page) };
let data = {type: cate, page: String(page)};
let url = ''
switch (cate) {
case 'ing':
url = '/' + package_name + '/ajax/'+sub+'/anime_list'
url = '/' + package_name + '/ajax/' + sub + '/anime_list'
current_cate = 'ing'
break;
case 'movie':
url = '/' + package_name + '/ajax/'+sub+'/screen_movie_list'
url = '/' + package_name + '/ajax/' + sub + '/screen_movie_list'
current_cate = 'movie'
break;
case 'theater':
url = '/' + package_name + '/ajax/'+sub+'/anime_list'
url = '/' + package_name + '/ajax/' + sub + '/anime_list'
current_cate = 'theater'
break;
case 'fin':
url = '/' + package_name + '/ajax/'+sub+'/complete_list'
url = '/' + package_name + '/ajax/' + sub + '/complete_list'
current_cate = 'fin'
break
case 'search':
@@ -479,7 +484,7 @@
const onScroll = (e) => {
console.dir(e.target.scrollingElement.scrollHeight);
const { scrollTop, scrollHeight, clientHeight } = e.target.scrollingElement;
const {scrollTop, scrollHeight, clientHeight} = e.target.scrollingElement;
if (Math.round(scrollHeight - scrollTop) <= clientHeight) {
document.getElementById("spinner").style.display = "block";
console.log("loading");
@@ -503,10 +508,12 @@
button.code-button {
min-width: 82px !important;
}
.tooltip {
position: relative;
display: block;
}
@media (min-width: 576px) {
.container {
max-width: 100%;
@@ -556,6 +563,7 @@
left: 0;
opacity: 1;
}
[data-tooltip-text]:hover {
position: relative;
}