anilife update 2022.10.23(01.)
This commit is contained in:
@@ -835,6 +835,8 @@ class LogicAniLife(LogicModuleBase):
|
|||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
return jsonify("")
|
return jsonify("")
|
||||||
|
elif sub == "web_list":
|
||||||
|
return jsonify(ModelAniLifeItem.web_list(request))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
P.logger.error("Exception:%s", e)
|
P.logger.error("Exception:%s", e)
|
||||||
@@ -1330,6 +1332,23 @@ class ModelAniLifeItem(db.Model):
|
|||||||
db.session.add(self)
|
db.session.add(self)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def web_list(cls, req):
|
||||||
|
ret = {}
|
||||||
|
page = int(req.form["page"]) if "page" in req.form else 1
|
||||||
|
page_size = 30
|
||||||
|
job_id = ""
|
||||||
|
search = req.form["search_word"] if "search_word" in req.form else ""
|
||||||
|
option = req.form["option"] if "option" in req.form else "all"
|
||||||
|
order = req.form["order"] if "order" in req.form else "desc"
|
||||||
|
query = cls.make_query(search=search, order=order, option=option)
|
||||||
|
count = query.count()
|
||||||
|
query = query.limit(page_size).offset((page - 1) * page_size)
|
||||||
|
lists = query.all()
|
||||||
|
ret["list"] = [item.as_dict() for item in lists]
|
||||||
|
ret["paging"] = Util.get_paging_info(count, page, page_size)
|
||||||
|
return ret
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def make_query(cls, search="", order="desc", option="all"):
|
def make_query(cls, search="", order="desc", option="all"):
|
||||||
query = db.session.query(cls)
|
query = db.session.query(cls)
|
||||||
|
|||||||
144
templates/anime_downloader_anilife_list.html
Normal file
144
templates/anime_downloader_anilife_list.html
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<form id="form_search" class="form-inline" style="text-align:left">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row show-grid">
|
||||||
|
<span class="col-md-4">
|
||||||
|
<select id="order" name="order" class="form-control form-control-sm">
|
||||||
|
<option value="desc">최근순</option>
|
||||||
|
<option value="asc">오래된순</option>
|
||||||
|
</select>
|
||||||
|
<select id="option" name="option" class="form-control form-control-sm">
|
||||||
|
<option value="all">전체</option>
|
||||||
|
<option value="completed">완료</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
<span class="col-md-8">
|
||||||
|
<input id="search_word" name="search_word" class="form-control form-control-sm w-75" type="text" placeholder="" aria-label="Search">
|
||||||
|
<button id="search" class="btn btn-sm btn-outline-success">검색</button>
|
||||||
|
<button id="reset_btn" class="btn btn-sm btn-outline-success">리셋</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div id='page1'></div>
|
||||||
|
{{ macros.m_hr_head_top() }}
|
||||||
|
{{ macros.m_row_start('0') }}
|
||||||
|
{{ macros.m_col(2, macros.m_strong('Poster')) }}
|
||||||
|
{{ macros.m_col(10, macros.m_strong('Info')) }}
|
||||||
|
{{ macros.m_row_end() }}
|
||||||
|
{{ macros.m_hr_head_bottom() }}
|
||||||
|
<div id="list_div"></div>
|
||||||
|
<div id='page2'></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var package_name = "{{arg['package_name']}}";
|
||||||
|
var sub = "{{arg['sub']}}";
|
||||||
|
var current_data = null;
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
global_sub_request_search('1');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#search").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
global_sub_request_search('1');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on('click', '#page', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
global_sub_request_search($(this).data('page'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#reset_btn").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
document.getElementById("order").value = 'desc';
|
||||||
|
document.getElementById("option").value = 'all';
|
||||||
|
document.getElementById("search_word").value = '';
|
||||||
|
global_sub_request_search('1')
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("body").on('click', '#json_btn', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var id = $(this).data('id');
|
||||||
|
for (i in current_data.list) {
|
||||||
|
if (current_data.list[i].id == id) {
|
||||||
|
m_modal(current_data.list[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on('click', '#self_search_btn', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var search_word = $(this).data('title');
|
||||||
|
document.getElementById("search_word").value = search_word;
|
||||||
|
global_sub_request_search('1')
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on('click', '#remove_btn', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
id = $(this).data('id');
|
||||||
|
$.ajax({
|
||||||
|
url: '/'+package_name+'/ajax/'+sub+ '/db_remove',
|
||||||
|
type: "POST",
|
||||||
|
cache: false,
|
||||||
|
data: {id:id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data) {
|
||||||
|
$.notify('<strong>삭제되었습니다.</strong>', {
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
global_sub_request_search(current_data.paging.current_page, false)
|
||||||
|
} else {
|
||||||
|
$.notify('<strong>삭제 실패</strong>', {
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on('click', '#request_btn', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var content_code = $(this).data('content_code');
|
||||||
|
$(location).attr('href', '/' + package_name + '/' + sub + '/request?content_code=' + content_code)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function make_list(data) {
|
||||||
|
//console.log(data)
|
||||||
|
str = '';
|
||||||
|
for (i in data) {
|
||||||
|
//console.log(data[i])
|
||||||
|
str += m_row_start();
|
||||||
|
str += m_col(1, data[i].id);
|
||||||
|
tmp = (data[i].status == 'completed') ? '완료' : '미완료';
|
||||||
|
str += m_col(1, tmp);
|
||||||
|
tmp = data[i].created_time + '(추가)';
|
||||||
|
if (data[i].completed_time != null)
|
||||||
|
tmp += data[i].completed_time + '(완료)';
|
||||||
|
str += m_col(3, tmp)
|
||||||
|
tmp = data[i].savepath + '<br>' + data[i].filename + '<br><br>';
|
||||||
|
tmp2 = m_button('json_btn', 'JSON', [{'key':'id', 'value':data[i].id}]);
|
||||||
|
tmp2 += m_button('request_btn', '작품 검색', [{'key':'content_code', 'value':data[i].content_code}]);
|
||||||
|
tmp2 += m_button('self_search_btn', '목록 검색', [{'key':'title', 'value':data[i].title}]);
|
||||||
|
tmp2 += m_button('remove_btn', '삭제', [{'key':'id', 'value':data[i].id}]);
|
||||||
|
tmp += m_button_group(tmp2)
|
||||||
|
str += m_col(7, tmp)
|
||||||
|
str += m_row_end();
|
||||||
|
if (i != data.length -1) str += m_hr();
|
||||||
|
}
|
||||||
|
document.getElementById("list_div").innerHTML = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user