Linkkf Fixes: resolve unknown sub add_queue and JS errors, refactor file handling, bump version to 0.7.16

This commit is contained in:
2026-01-27 16:01:52 +09:00
parent 31aaaaf8e9
commit 25688db376
4 changed files with 35 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
title: "애니 다운로더" title: "애니 다운로더"
version: 0.7.15 version: 0.7.16
package_name: "anime_downloader" package_name: "anime_downloader"
developer: "projectdx" developer: "projectdx"
description: "anime downloader" description: "anime downloader"

View File

@@ -32,10 +32,8 @@ def download(url, file_name):
def read_file(filename): def read_file(filename):
try: try:
import codecs import codecs
ifp = codecs.open(filename, 'r', encoding='utf8') with codecs.open(filename, 'r', encoding='utf8') as ifp:
data = ifp.read() return ifp.read()
ifp.close()
return data
except Exception as exception: except Exception as exception:
logger.error('Exception:%s', exception) logger.error('Exception:%s', exception)
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -79,9 +77,8 @@ class Util(object):
def write_file(data, filename): def write_file(data, filename):
try: try:
import codecs import codecs
ofp = codecs.open(filename, 'w', encoding='utf8') with codecs.open(filename, 'w', encoding='utf8') as ofp:
ofp.write(data) ofp.write(data)
ofp.close()
except Exception as exception: except Exception as exception:
logger.debug('Exception:%s', exception) logger.debug('Exception:%s', exception)
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())

View File

@@ -196,6 +196,7 @@ class LogicLinkkf(AnimeModuleBase):
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
ret["ret"] = "error" ret["ret"] = "error"
ret["log"] = str(e) ret["log"] = str(e)
return jsonify(ret)
elif sub == "add_queue_checked_list": elif sub == "add_queue_checked_list":
# 선택된 에피소드 일괄 추가 (백그라운드 스레드로 처리) # 선택된 에피소드 일괄 추가 (백그라운드 스레드로 처리)
import threading import threading

View File

@@ -49,7 +49,7 @@
const package_name = "{{arg['package_name'] }}"; const package_name = "{{arg['package_name'] }}";
const sub = "{{arg['sub'] }}"; const sub = "{{arg['sub'] }}";
const ohli24_url = "{{arg['ohli24_url']}}"; const ohli24_url = "{{arg['ohli24_url']}}";
// let current_data = ''; var current_data = null;
const params = new Proxy(new URLSearchParams(window.location.search), { const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop), get: (searchParams, prop) => searchParams.get(prop),
@@ -288,26 +288,29 @@
$("body").on('click', '#add_queue_btn', function (e) { $("body").on('click', '#add_queue_btn', function (e) {
e.preventDefault(); e.preventDefault();
data = current_data.episode[$(this).data('idx')]; let episode_data = current_data.episode[$(this).data('idx')];
// console.log('data:::>', data) // console.log('episode_data:::>', episode_data)
$.ajax({ $.ajax({
url: '/' + package_name + '/ajax/' + sub + '/add_queue', url: '/' + package_name + '/ajax/' + sub + '/add_queue',
type: "POST", type: "POST",
cache: false, cache: false,
data: {data: JSON.stringify(data)}, data: {data: JSON.stringify(episode_data)},
dataType: "json", dataType: "json",
success: function (data) { success: function (ret) {
// console.log('#add_queue_btn::data >>', data) // console.log('#add_queue_btn::ret >>', ret)
if (data.ret == 'enqueue_db_append' || data.ret == 'enqueue_db_exist') { if (ret.ret == 'enqueue_db_append' || ret.ret == 'enqueue_db_exist' || ret.ret == 'enqueue_gdm_success') {
$.notify('<strong>다운로드 작업을 추가 하였습니다.</strong>', {type: 'success'}); $.notify('<strong>다운로드 작업을 추가 하였습니다.</strong>', {type: 'success'});
} else if (data.ret == 'queue_exist') { } else if (ret.ret == 'queue_exist') {
$.notify('<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>', {type: 'warning'}); $.notify('<strong>이미 큐에 있습니다. 삭제 후 추가하세요.</strong>', {type: 'warning'});
} else if (data.ret == 'db_completed') { } else if (ret.ret == 'db_completed') {
$.notify('<strong>DB에 완료 기록이 있습니다.</strong>', {type: 'warning'}); $.notify('<strong>DB에 완료 기록이 있습니다.</strong>', {type: 'warning'});
} else if (data.ret == 'file_exists') { } else if (ret.ret == 'file_exists') {
$.notify('<strong>파일이 이미 존재합니다.</strong>', {type: 'warning'}); $.notify('<strong>파일이 이미 존재합니다.</strong>', {type: 'warning'});
} else if (ret.ret == 'extract_failed') {
$.notify('<strong>추가 실패: 영상 주소 추출에 실패하였습니다.</strong>', {type: 'warning'});
} else { } else {
$.notify('<strong>추가 실패</strong><br>' + ret.log, {type: 'warning'}); const msg = ret.log || '알 수 없는 이유로 추가에 실패하였습니다.';
$.notify('<strong>추가 실패</strong><br>' + msg, {type: 'warning'});
} }
} }
}); });
@@ -316,13 +319,14 @@
$("body").on('click', '#check_download_btn', function (e) { $("body").on('click', '#check_download_btn', function (e) {
e.preventDefault(); e.preventDefault();
let selected_data = [];
$('input[id^="checkbox_"]').each(function() { $('input[id^="checkbox_"]').each(function() {
if ($(this).prop('checked')) { if ($(this).prop('checked')) {
idx = parseInt($(this).attr('id').split('_')[1]) let idx = parseInt($(this).attr('id').split('_')[1]);
data.push(current_data.episode[idx]); selected_data.push(current_data.episode[idx]);
} }
}); });
if (data.length == 0) { if (selected_data.length == 0) {
$.notify('<strong>선택하세요.</strong>', {type: 'warning'}); $.notify('<strong>선택하세요.</strong>', {type: 'warning'});
return; return;
} }
@@ -330,9 +334,9 @@
url: '/' + package_name + '/ajax/' + sub + '/add_queue_checked_list', url: '/' + package_name + '/ajax/' + sub + '/add_queue_checked_list',
type: "POST", type: "POST",
cache: false, cache: false,
data: {data: JSON.stringify(data)}, data: {data: JSON.stringify(selected_data)},
dataType: "json", dataType: "json",
success: function (data) { success: function (ret) {
$.notify('<strong>백그라운드로 작업을 추가합니다.</strong>', {type: 'success'}); $.notify('<strong>백그라운드로 작업을 추가합니다.</strong>', {type: 'success'});
} }
}); });
@@ -340,13 +344,14 @@
$("body").on('click', '#down_subtitle_btn', function (e) { $("body").on('click', '#down_subtitle_btn', function (e) {
e.preventDefault(); e.preventDefault();
let selected_data = [];
$('input[id^="checkbox_"]').each(function() { $('input[id^="checkbox_"]').each(function() {
if ($(this).prop('checked')) { if ($(this).prop('checked')) {
idx = parseInt($(this).attr('id').split('_')[1]); let idx = parseInt($(this).attr('id').split('_')[1]);
data.push(current_data.episode[idx]); selected_data.push(current_data.episode[idx]);
} }
}); });
if (data.length == 0) { if (selected_data.length == 0) {
$.notify('<strong>선택하세요.</strong>', {type: 'warning'}); $.notify('<strong>선택하세요.</strong>', {type: 'warning'});
return; return;
} }
@@ -354,13 +359,14 @@
url: '/' + package_name + '/ajax/' + sub + '/add_sub_queue_checked_list', url: '/' + package_name + '/ajax/' + sub + '/add_sub_queue_checked_list',
type: "POST", type: "POST",
cache: false, cache: false,
data: {data: JSON.stringify(data)}, data: {data: JSON.stringify(selected_data)},
dataType: "json", dataType: "json",
success: function (data) { success: function (ret) {
if (data.ret == "success") { if (ret.ret == "success") {
$.notify('<strong>백그라운드로 자막 다운로드를 시작합니다.</strong>', {type: 'success'}); $.notify('<strong>백그라운드로 자막 다운로드를 시작합니다.</strong>', {type: 'success'});
} else { } else {
$.notify('<strong>자막 다운로드 요청 실패: ' + data.log + '</strong>', {type: 'warning'}); const msg = ret.log || '알 수 없는 이유로 요청에 실패하였습니다.';
$.notify('<strong>자막 다운로드 요청 실패: ' + msg + '</strong>', {type: 'warning'});
} }
} }
}); });