提交 6e657130 编写于 作者: H hjdhnx

增加了搜索统计看板

上级 41ea69a8
......@@ -200,49 +200,55 @@ def sort_lsg_rules2(sites:list,lsg_rule_names:list):
sites.sort(key=functools.cmp_to_key(comp), reverse=False)
return sites
def multi_search(wd):
def getSearchSites():
val = {}
lsg = storage_service()
env = get_env()
t1 = time()
try:
timeout = round(int(lsg.getItem('SEARCH_TIMEOUT',5000))/1000,2)
except:
timeout = 5
val['timeout'] = timeout
rules = getRules('js')['list']
rule_names = list(map(lambda x:x['name'],rules))
rule_names = list(map(lambda x: x['name'], rules))
rules_exclude = ['drpy']
new_rules = list(filter(lambda x: x.get('searchable', 0) and x.get('name', '') not in rules_exclude, rules))
search_sites = [new_rule['name'] for new_rule in new_rules]
# print(search_sites)
nosearch_sites = set(rule_names) ^ set(search_sites)
total_search = [new_rule['name'] for new_rule in new_rules]
nosearch_sites = set(rule_names) ^ set(total_search)
nosearch_sites.remove('drpy')
# print(nosearch_sites)
logger.info(f'开始聚搜{wd},共计{len(search_sites)}个规则,聚搜超时{timeout}秒')
logger.info(f'不支持聚搜的规则,共计{len(nosearch_sites)}个规则:{",".join(nosearch_sites)}')
search_sites = merged_hide(search_sites)
# print(len(search_sites))
# search_sites = []
val['total_search'] = total_search
val['nosearch_sites'] = list(nosearch_sites)
search_sites = merged_hide(total_search)
lsg_rules = rules_service()
lsg_rule_list = lsg_rules.query_all()
# print(len(lsg_rule_list))
# rule_names = list(map(lambda x: x['name'], rule_list))
lsg_rule_list = list(filter(lambda x:x['name'] in search_sites,lsg_rule_list))
lsg_rule_list = list(filter(lambda x: x['name'] in search_sites, lsg_rule_list))
lsg_rule_names = list(map(lambda x: x['name'], lsg_rule_list))
search_sites = sort_lsg_rules2(search_sites,lsg_rule_names)
# print(len(lsg_rule_list))
# lsg_rule_list = sort_lsg_rules(lsg_rule_list)
# print(len(lsg_rule_list))
# print(search_sites)
SEARCH_LIMIT = lsg.getItem('SEARCH_LIMIT', 24)
search_sites = sort_lsg_rules2(search_sites, lsg_rule_names)
search_limit = lsg.getItem('SEARCH_LIMIT', 24)
try:
SEARCH_LIMIT = int(SEARCH_LIMIT)
search_limit = int(search_limit)
except:
SEARCH_LIMIT = 0
if SEARCH_LIMIT < 1:
SEARCH_LIMIT = 0
search_sites = search_sites[:SEARCH_LIMIT]
msearch_msg = f'搜索限制条数:{SEARCH_LIMIT}/{len(search_sites)} {search_sites}'
search_limit = 0
if search_limit < 1:
search_limit = 0
search_sites = search_sites[:search_limit]
val['search_limit'] = search_limit
val['search_sites'] = search_sites
return val
def multi_search(wd):
t1 = time()
val = getSearchSites()
timeout = val['timeout']
total_search = val['total_search']
nosearch_sites = val['nosearch_sites']
search_limit = val['search_limit']
search_sites = val['search_sites']
env = get_env()
logger.info(f'开始聚搜{wd},共计{len(total_search)}个规则,聚搜超时{timeout}秒')
logger.info(f'不支持聚搜的规则,共计{len(nosearch_sites)}个规则:{",".join(nosearch_sites)}')
msearch_msg = f'搜索限制条数:{search_limit}/{len(search_sites)} {search_sites}'
logger.info(msearch_msg)
print(msearch_msg)
# search_sites = []
......@@ -273,6 +279,14 @@ def multi_search(wd):
"list": res
})
@vod.route('/vods')
def vods_search():
val = getSearchSites()
print(val)
# return jsonify(val)
return render_template('show_search.html',val=val)
@vod.route('/vod')
def vod_home():
lsg = storage_service()
......
3.9.34beta6
\ No newline at end of file
3.9.34beta7
\ No newline at end of file
......@@ -224,6 +224,7 @@ function getFileSize(fileObj) {
id="lives">直播列表</a></button>
<button type="button" class="yongyin"><a href="javascript:void(0);" class="funcbtn"
id="logtail">在线日志</a></button>
<button type="button" class="yongyin4"><a href="/vods" class="funcbtn" target="_blank">搜索看板</a></button>
<input id="live_url" value="{{live_url}}" style="display: none">
......
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<meta http-equiv="Cache-Control" content="no-siteapp;no-transform">
<meta name="applicable-device" content="pc,mobile">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>drpy搜索统计</title>
<script src="/static/js/jquery.min.js"></script>
<link rel="stylesheet" media="screen" href="/static/css/home.css">
<script src="/static/js/grey.js"></script>
<link href="/static/css/jquery-confirm.min.css" rel="stylesheet">
<script src="/static/js/jquery-confirm.min.js"></script>
</head>
<body>
<div class="image">
<script>
$(document).ready(function () {
$("#nosearch_sites").click(function () {
let a = "{{val.nosearch_sites|safe}}";
// console.log(a);
let nosearch_sites = eval(a);
console.log(nosearch_sites);
let ss_sites = nosearch_sites.join(',');
// console.log(ss_sites);
// $.alert(ss_sites);
$.alert({title:'不可搜索统计:'+nosearch_sites.length,content:ss_sites,buttons: {
ok: {
text: '确认',
btnClass: 'btn-primary',
action: function() {
}
}
}});
});
$("#search_sites").click(function () {
let a = "{{val.search_sites|safe}}";
// console.log(a);
let search_sites = eval(a);
console.log(search_sites);
let ss_sites = search_sites.join(',');
// console.log(ss_sites);
// $.alert(ss_sites);
$.alert({title:'可搜索统计:'+search_sites.length,content:ss_sites,buttons: {
ok: {
text: '确认',
btnClass: 'btn-primary',
action: function() {
}
}
}});
});
});
</script>
<h2 class="title">欢迎使用drpy搜索统计界面<div class="kf"><span
class="ver_title">框架开发:道长</span><span class="ver_title">框架美化:蓝莓</span></div>
</h2>
<p class="tips">统计内置源参与搜索相关数据</p>
<center>
<div class="zt">
<div class="btn">
<a href="javascript:;">聚搜超时: {{val.timeout}} 秒</a>
</div>
<div class="btn">
<a href="javascript:;">搜索限制源数量: {{val.search_limit}} </a>
</div>
<div class="btn">
<a href="javascript:;">总可搜索源: {{val.total_search|length}}</a>
</div>
<div class="btn">
<a href="javascript:;" id="nosearch_sites">不可搜索源: {{val.nosearch_sites|length}}</a>
</div>
<div class="btn">
<a href="javascript:;" id="search_sites">当前搜索源: {{val.search_sites|length}}</a>
</div>
</div>
</center>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册