또 많은 수정을 했슴.
This commit is contained in:
@@ -50,7 +50,6 @@ $(document).ready(function(){
|
||||
|
||||
// linkkf_status 이벤트로 다운로드 상태 업데이트 수신
|
||||
frameworkSocket.on('linkkf_status', function(data) {
|
||||
console.log('linkkf_status received:', data.percent + '%');
|
||||
status_html(data);
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -112,10 +111,75 @@ $(document).ready(function(){
|
||||
});
|
||||
}
|
||||
|
||||
var refreshIntervalId = null;
|
||||
|
||||
// 로딩 인디케이터 없이 조용히 목록 가져오기
|
||||
function silentFetchList(callback) {
|
||||
$.ajax({
|
||||
url: '/' + PACKAGE_NAME + '/ajax/' + MODULE_NAME + '/command',
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
global: false, // 로딩 인디케이터 표시 안함
|
||||
data: {command: 'list'},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (callback) callback(data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// 에러 무시
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 자동 새로고침 (로딩 인디케이터 없음)
|
||||
function autoRefreshList() {
|
||||
silentFetchList(function(data) {
|
||||
// 새 아이템이 추가되었는지 확인
|
||||
if (!current_data || data.length !== current_data.length) {
|
||||
current_data = data;
|
||||
$("#list").html('');
|
||||
console.log('Refreshed list:', data.length, 'items');
|
||||
if (data.length == 0) {
|
||||
str = "<tr><td colspan='10'><h4>작업이 없습니다.</h4><td><tr>";
|
||||
} else {
|
||||
str = ''
|
||||
for(i in data) {
|
||||
str += make_item(data[i]);
|
||||
}
|
||||
}
|
||||
$("#list").html(str);
|
||||
}
|
||||
|
||||
// 진행 중인 다운로드가 있는지 확인
|
||||
var hasActiveDownload = false;
|
||||
if (data && data.length > 0) {
|
||||
for (var j = 0; j < data.length; j++) {
|
||||
if (data[j].status_str === 'DOWNLOADING' || data[j].status_str === 'WAITING') {
|
||||
hasActiveDownload = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 모든 다운로드 완료 시 자동 새로고침 중지
|
||||
if (!hasActiveDownload && refreshIntervalId) {
|
||||
console.log('All downloads completed, stopping auto-refresh');
|
||||
clearInterval(refreshIntervalId);
|
||||
refreshIntervalId = null;
|
||||
}
|
||||
|
||||
// 활성 다운로드가 있고 새로고침이 중지된 경우 재시작
|
||||
if (hasActiveDownload && !refreshIntervalId) {
|
||||
console.log('Active downloads detected, starting auto-refresh');
|
||||
refreshIntervalId = setInterval(autoRefreshList, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 초기 로드 (로딩 인디케이터 표시)
|
||||
globalSendCommand('list', null, null, null, function(data) {
|
||||
current_data = data;
|
||||
$("#list").html('');
|
||||
console.log(data)
|
||||
if (data.length == 0) {
|
||||
str = "<tr><td colspan='10'><h4>작업이 없습니다.</h4><td><tr>";
|
||||
} else {
|
||||
@@ -126,6 +190,9 @@ $(document).ready(function(){
|
||||
}
|
||||
$("#list").html(str);
|
||||
});
|
||||
|
||||
// 3초마다 자동 새로고침 (로딩 인디케이터 없음)
|
||||
refreshIntervalId = setInterval(autoRefreshList, 3000);
|
||||
});
|
||||
|
||||
|
||||
@@ -216,14 +283,27 @@ function button_html(data) {
|
||||
|
||||
function status_html(data) {
|
||||
var progress = document.getElementById("progress_" + data.idx);
|
||||
if (!progress) {
|
||||
return;
|
||||
}
|
||||
progress.style.width = data.percent+ '%';
|
||||
progress.innerHTML = data.percent+ '%';
|
||||
progress.style.visibility = 'visible';
|
||||
document.getElementById("status_" + data.idx).innerHTML = data.status_kor;
|
||||
document.getElementById("current_pf_count_" + data.idx).innerHTML = data.current_pf_count;
|
||||
document.getElementById("current_speed_" + data.idx).innerHTML = data.current_speed;
|
||||
document.getElementById("download_time_" + data.idx).innerHTML = data.download_time;
|
||||
document.getElementById("detail_" + data.idx).innerHTML = get_detail(data);
|
||||
|
||||
var statusEl = document.getElementById("status_" + data.idx);
|
||||
if (statusEl) statusEl.innerHTML = data.status_kor;
|
||||
|
||||
var pfEl = document.getElementById("current_pf_count_" + data.idx);
|
||||
if (pfEl) pfEl.innerHTML = data.current_pf_count;
|
||||
|
||||
var speedEl = document.getElementById("current_speed_" + data.idx);
|
||||
if (speedEl) speedEl.innerHTML = data.current_speed;
|
||||
|
||||
var timeEl = document.getElementById("download_time_" + data.idx);
|
||||
if (timeEl) timeEl.innerHTML = data.download_time;
|
||||
|
||||
var detailEl = document.getElementById("detail_" + data.idx);
|
||||
if (detailEl) detailEl.innerHTML = get_detail(data);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -165,9 +165,9 @@
|
||||
tmp += '<div class="form-inline">';
|
||||
tmp +=
|
||||
'<input id="checkbox_' +
|
||||
data.episode[i].code +
|
||||
i +
|
||||
'" name="checkbox_' +
|
||||
data.episode[i].code +
|
||||
i +
|
||||
'" 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", "다운로드 추가", [
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{{ macros.setting_input_text_and_buttons('linkkf_url', 'linkkf URL', [['go_btn', 'GO']], value=arg['linkkf_url']) }}
|
||||
{{ macros.setting_input_text('linkkf_download_path', '저장 폴더', value=arg['linkkf_download_path'], desc='정상적으로 다운 완료 된 파일이 이동할 폴더 입니다. ') }}
|
||||
{{ macros.setting_input_int('linkkf_max_ffmpeg_process_count', '동시 다운로드 수', value=arg['linkkf_max_ffmpeg_process_count'], desc='동시에 다운로드 할 에피소드 갯수입니다.') }}
|
||||
{{ macros.setting_select('linkkf_download_method', '다운로드 방법', [['ffmpeg', 'ffmpeg'], ['ytdlp', 'yt-dlp']], col='3', value=arg['linkkf_download_method'], desc='ffmpeg: HLS 다운로더 사용, yt-dlp: yt-dlp 사용') }}
|
||||
{{ macros.setting_checkbox('linkkf_order_desc', '요청 화면 최신순 정렬', value=arg['linkkf_order_desc'], desc='On : 최신화부터, Off : 1화부터') }}
|
||||
{{ macros.setting_checkbox('linkkf_auto_make_folder', '제목 폴더 생성', value=arg['linkkf_auto_make_folder'], desc='제목으로 폴더를 생성하고 폴더 안에 다운로드합니다.') }}
|
||||
<div id="linkkf_auto_make_folder_div" class="collapse">
|
||||
|
||||
@@ -47,9 +47,53 @@
|
||||
on_status(data)
|
||||
});
|
||||
|
||||
|
||||
// 초기 목록 로드
|
||||
on_start();
|
||||
|
||||
// 3초마다 자동 새로고침 시작
|
||||
var refreshIntervalId = setInterval(silentRefresh, 3000);
|
||||
});
|
||||
|
||||
var current_list_length = 0;
|
||||
var refreshIntervalId = null;
|
||||
|
||||
// 로딩 인디케이터 없이 조용히 목록 가져오기
|
||||
function silentRefresh() {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/' + sub + '/entity_list',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
global: false, // 로딩 인디케이터 표시 안함
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
// 목록이 변경된 경우에만 갱신
|
||||
if (data.length !== current_list_length) {
|
||||
current_list_length = data.length;
|
||||
make_download_list(data);
|
||||
}
|
||||
|
||||
// 활성 다운로드 확인
|
||||
var hasActive = false;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].ffmpeg_status_kor === '다운로드중' || data[i].ffmpeg_status_kor === '대기') {
|
||||
hasActive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 모든 다운로드 완료 시 새로고침 중지
|
||||
if (!hasActive && refreshIntervalId) {
|
||||
clearInterval(refreshIntervalId);
|
||||
refreshIntervalId = null;
|
||||
}
|
||||
// 활성 다운로드 있고 새로고침 중지된 경우 재시작
|
||||
if (hasActive && !refreshIntervalId) {
|
||||
refreshIntervalId = setInterval(silentRefresh, 3000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function on_start() {
|
||||
$.ajax({
|
||||
@@ -60,6 +104,7 @@
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log("on_start():: ", data)
|
||||
current_list_length = data.length;
|
||||
make_download_list(data)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -121,17 +121,18 @@
|
||||
tmp = '<img src="' + data.image + '" class="img-fluid" />';
|
||||
str += m_col(3, tmp)
|
||||
tmp = ''
|
||||
tmp += m_row_start(2) + m_col(3, '제목', 'right') + m_col(9, data.title) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '원제', 'right') + m_col(9, data.des._otit) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '감독', 'right') + m_col(9, data.des._dir) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '제작사', 'right') + m_col(9, data.des._pub) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '장르', 'right') + m_col(9, data.des._tag) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '분류', 'right') + m_col(9, data.des._classifi) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '방영일', 'right') + m_col(9, data.date + '(' + data.day + ')') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '등급', 'right') + m_col(9, data.des._grade) + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '총화수', 'right') + m_col(9, data.des._total_chapter ? data.des._total_chapter : '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '상영시간', 'right') + m_col(9, data.des._show_time ? data.des._show_time : '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '줄거리', 'right') + m_col(9, data.ser_description) + m_row_end();
|
||||
var des = data.des || {};
|
||||
tmp += m_row_start(2) + m_col(3, '제목', 'right') + m_col(9, data.title || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '원제', 'right') + m_col(9, des._otit || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '감독', 'right') + m_col(9, des._dir || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '제작사', 'right') + m_col(9, des._pub || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '장르', 'right') + m_col(9, des._tag || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '분류', 'right') + m_col(9, des._classifi || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '방영일', 'right') + m_col(9, (data.date || '') + '(' + (data.day || '') + ')') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '등급', 'right') + m_col(9, des._grade || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '총화수', 'right') + m_col(9, des._total_chapter || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '상영시간', 'right') + m_col(9, des._show_time || '') + m_row_end();
|
||||
tmp += m_row_start(2) + m_col(3, '줄거리', 'right') + m_col(9, data.ser_description || '') + m_row_end();
|
||||
str += m_col(9, tmp)
|
||||
str += m_row_end();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{{ macros.setting_input_text_and_buttons('ohli24_url', 'ohli24 URL', [['go_btn', 'GO']], value=arg['ohli24_url']) }}
|
||||
{{ macros.setting_input_text('ohli24_download_path', '저장 폴더', value=arg['ohli24_download_path'], desc='정상적으로 다운 완료 된 파일이 이동할 폴더 입니다. ') }}
|
||||
{{ macros.setting_input_int('ohli24_max_ffmpeg_process_count', '동시 다운로드 수', value=arg['ohli24_max_ffmpeg_process_count'], desc='동시에 다운로드 할 에피소드 갯수입니다.') }}
|
||||
{{ macros.setting_select('ohli24_download_method', '다운로드 방법', [['ffmpeg', 'ffmpeg (기본)'], ['ytdlp', 'yt-dlp']], value=arg.get('ohli24_download_method', 'ffmpeg'), desc='m3u8 다운로드에 사용할 도구를 선택합니다.') }}
|
||||
{{ macros.setting_checkbox('ohli24_order_desc', '요청 화면 최신순 정렬', value=arg['ohli24_order_desc'], desc='On : 최신화부터, Off : 1화부터') }}
|
||||
{{ macros.setting_checkbox('ohli24_auto_make_folder', '제목 폴더 생성', value=arg['ohli24_auto_make_folder'], desc='제목으로 폴더를 생성하고 폴더 안에 다운로드합니다.') }}
|
||||
<div id="ohli24_auto_make_folder_div" class="collapse">
|
||||
|
||||
Reference in New Issue
Block a user