From 43f82fbf59140f38669b384a39063d0681a09439 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:26:53 +0900 Subject: [PATCH 01/18] Update offcloud2_rss_setting.html --- templates/offcloud2_rss_setting.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/offcloud2_rss_setting.html b/templates/offcloud2_rss_setting.html index 6ceae00..4eba2f4 100644 --- a/templates/offcloud2_rss_setting.html +++ b/templates/offcloud2_rss_setting.html @@ -20,6 +20,9 @@ {{ macros.setting_checkbox('remove_cloud_history_on_web', '완료시 웹에서 Cloud 작업 삭제', value=arg['remove_cloud_history_on_web'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_remote', 'Remote 중복 작업 제거', value=arg['dedupe_on_remote'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_cloud', 'Cloud 중복 작업 제거', value=arg['dedupe_on_cloud'], desc=None) }} + {{ macros.setting_checkbox('alt_download', '다운로드 중지 다운로드 스테이션으로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} + {{ macros.setting_input_int('alt_download_time', '다운로드 중지 판정시간', value=arg['alt_download_time'], desc=['hours', '']) }} + {{ macros.setting_input_int('alt_upload_time', '업로드 중지 판정시간', value=arg['alt_upload_time'], desc=['hours', '다운로드 포함한 시간, 0이면 업로드 중인건 삭제하지 않음']) }} {{ macros.setting_button([['global_setting_save_btn', '설정 저장']]) }} {{ macros.m_tab_content_end() }} From b4c2b7c4b7056d90115c19feaaf08d5c3a41bb98 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:28:02 +0900 Subject: [PATCH 02/18] Update logic.py --- logic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/logic.py b/logic.py index ac4dee0..e7b5a0a 100644 --- a/logic.py +++ b/logic.py @@ -46,6 +46,10 @@ class Logic(object): 'dedupe_on_remote' : 'False', 'dedupe_on_cloud' : 'False', + # 20230331 새로 추가 + 'alt_download' : 'False', + 'alt_download_time' : '4', + 'alt_upload_time' : '12', # cache 'cache_save_type_list' : '', 'cache_receive_info_send_telegram' : 'False' @@ -259,4 +263,4 @@ def migration(): except Exception as e: logger.error('Exception:%s', e) - logger.error(traceback.format_exc()) \ No newline at end of file + logger.error(traceback.format_exc()) From 840415d2d86287eded0d71dee1194b6fea58e8c7 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:29:53 +0900 Subject: [PATCH 03/18] Update logic_rss.py --- logic_rss.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/logic_rss.py b/logic_rss.py index bdc715c..e8e43ed 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -177,7 +177,8 @@ def scheduler_function2(): LogicRss.scheduler_function_remove_history() if ModelSetting.get_bool('remove_cloud_history_on_web'): LogicRss.scheduler_function_remove_cloud_history('cloud') - + if ModelSetting.get_bool('alt_download'): + LogicRss.scheduler_function_alt_download('remote') # status # 0 : 초기 값 # 1 : 마그넷. 캐쉬. 오버 @@ -257,7 +258,36 @@ def scheduler_function_remove_cloud_history(target): logger.error(e) logger.error(traceback.format_exc()) + @staticmethod + def scheduler_function_alt_download(target): + try: + from downloader.logic import Logic + from downloader.logic_normal import LogicNormal + LogicNormal.program_init() + get_default_value = Logic.get_default_value() + apikey = ModelSetting.get('apikey') + history_status = Offcloud.get_history(apikey, target) + history_status = history_status['history_status'] + if len(history_status) != 0: + for remote_item in history_status: + remote_magnet = str(remote_item.get('originalLink')).strip() + try: + if (remote_item.get('status') != 'uploading') and int(remote_item.get('downloadingTime')) > (ModelSetting.get_int('alt_download_time')*3600*1000) and remote_item.get('downloadingSpeed') == None : + Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) + item = remote_item.get('requestId') + result = Offcloud.remove(apikey, target, item) + logger.debug('다운로드 중지됨 - removed : %s === %s', result, item) + elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (ModelSetting.get_int('alt_upload_time')) : + Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) + item = remote_item.get('requestId') + result = Offcloud.remove(apikey, target, item) + logger.debug('업로드 중지됨 - removed : %s === %s', result, item) + except: + continue + except Exception as e: + logger.error(e) + logger.error(traceback.format_exc()) @staticmethod def scheduler_function_remove_duplicated_job(target): From 26ad58564fa994f9efa3a476e5763905b42f92a9 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:30:31 +0900 Subject: [PATCH 04/18] Update logic_rss.py --- logic_rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_rss.py b/logic_rss.py index e8e43ed..3a16e44 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -284,10 +284,10 @@ def scheduler_function_alt_download(target): logger.debug('업로드 중지됨 - removed : %s === %s', result, item) except: continue - except Exception as e: logger.error(e) logger.error(traceback.format_exc()) + @staticmethod def scheduler_function_remove_duplicated_job(target): From cda46cafcd4229e443a6a475e6af355d43fff97f Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:42:36 +0900 Subject: [PATCH 05/18] Update logic_rss.py --- logic_rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_rss.py b/logic_rss.py index 3a16e44..8e10554 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -277,7 +277,7 @@ def scheduler_function_alt_download(target): item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) logger.debug('다운로드 중지됨 - removed : %s === %s', result, item) - elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (ModelSetting.get_int('alt_upload_time')) : + elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (ModelSetting.get_int('alt_upload_time')*3600*1000) : Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) From cd6da248a91374cc15a523f2bfc3504b75b8df32 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 14:00:48 +0900 Subject: [PATCH 06/18] Update offcloud2_rss_setting.html --- templates/offcloud2_rss_setting.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/offcloud2_rss_setting.html b/templates/offcloud2_rss_setting.html index 4eba2f4..ab465fb 100644 --- a/templates/offcloud2_rss_setting.html +++ b/templates/offcloud2_rss_setting.html @@ -20,7 +20,7 @@ {{ macros.setting_checkbox('remove_cloud_history_on_web', '완료시 웹에서 Cloud 작업 삭제', value=arg['remove_cloud_history_on_web'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_remote', 'Remote 중복 작업 제거', value=arg['dedupe_on_remote'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_cloud', 'Cloud 중복 작업 제거', value=arg['dedupe_on_cloud'], desc=None) }} - {{ macros.setting_checkbox('alt_download', '다운로드 중지 다운로드 스테이션으로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} + {{ macros.setting_checkbox('alt_download', '다운로드 중지 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} {{ macros.setting_input_int('alt_download_time', '다운로드 중지 판정시간', value=arg['alt_download_time'], desc=['hours', '']) }} {{ macros.setting_input_int('alt_upload_time', '업로드 중지 판정시간', value=arg['alt_upload_time'], desc=['hours', '다운로드 포함한 시간, 0이면 업로드 중인건 삭제하지 않음']) }} {{ macros.setting_button([['global_setting_save_btn', '설정 저장']]) }} From e8478bd729a17e1c748cc1e8c1714ca3dba829d7 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Fri, 31 Mar 2023 14:03:54 +0900 Subject: [PATCH 07/18] Update offcloud2_rss_setting.html --- templates/offcloud2_rss_setting.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/offcloud2_rss_setting.html b/templates/offcloud2_rss_setting.html index ab465fb..ea3672b 100644 --- a/templates/offcloud2_rss_setting.html +++ b/templates/offcloud2_rss_setting.html @@ -20,7 +20,7 @@ {{ macros.setting_checkbox('remove_cloud_history_on_web', '완료시 웹에서 Cloud 작업 삭제', value=arg['remove_cloud_history_on_web'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_remote', 'Remote 중복 작업 제거', value=arg['dedupe_on_remote'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_cloud', 'Cloud 중복 작업 제거', value=arg['dedupe_on_cloud'], desc=None) }} - {{ macros.setting_checkbox('alt_download', '다운로드 중지 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} + {{ macros.setting_checkbox('alt_download', '중지된 목록 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} {{ macros.setting_input_int('alt_download_time', '다운로드 중지 판정시간', value=arg['alt_download_time'], desc=['hours', '']) }} {{ macros.setting_input_int('alt_upload_time', '업로드 중지 판정시간', value=arg['alt_upload_time'], desc=['hours', '다운로드 포함한 시간, 0이면 업로드 중인건 삭제하지 않음']) }} {{ macros.setting_button([['global_setting_save_btn', '설정 저장']]) }} From 6d0f756b98d7ccf91958e839a07f5c1faace6e2a Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:37:44 +0900 Subject: [PATCH 08/18] Update logic_rss.py --- logic_rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_rss.py b/logic_rss.py index 8e10554..9fabdcf 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -277,7 +277,7 @@ def scheduler_function_alt_download(target): item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) logger.debug('다운로드 중지됨 - removed : %s === %s', result, item) - elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (ModelSetting.get_int('alt_upload_time')*3600*1000) : + elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (int(remote_item.get('fileSize') / (2 * 1024 * 2024) * 2) * 1000) : Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) From 98afc4ce655d1e4e18a459ff597066701e97e251 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:40:00 +0900 Subject: [PATCH 09/18] Update logic_rss.py --- logic_rss.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/logic_rss.py b/logic_rss.py index 9fabdcf..d3efae2 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -278,10 +278,12 @@ def scheduler_function_alt_download(target): result = Offcloud.remove(apikey, target, item) logger.debug('다운로드 중지됨 - removed : %s === %s', result, item) elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (int(remote_item.get('fileSize') / (2 * 1024 * 2024) * 2) * 1000) : - Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) + if ModelSetting.get_bool('alt_upload'): + Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) - logger.debug('업로드 중지됨 - removed : %s === %s', result, item) + logger.debug('업로드 중지됨 - removed : %s === %s', result, item) + except: continue except Exception as e: From 98fc38663ef317205dc3c4ed38e3ee237f0ff119 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:42:42 +0900 Subject: [PATCH 10/18] Update offcloud2_rss_setting.html --- templates/offcloud2_rss_setting.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/offcloud2_rss_setting.html b/templates/offcloud2_rss_setting.html index ea3672b..cc47d6e 100644 --- a/templates/offcloud2_rss_setting.html +++ b/templates/offcloud2_rss_setting.html @@ -22,7 +22,7 @@ {{ macros.setting_checkbox('dedupe_on_cloud', 'Cloud 중복 작업 제거', value=arg['dedupe_on_cloud'], desc=None) }} {{ macros.setting_checkbox('alt_download', '중지된 목록 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} {{ macros.setting_input_int('alt_download_time', '다운로드 중지 판정시간', value=arg['alt_download_time'], desc=['hours', '']) }} - {{ macros.setting_input_int('alt_upload_time', '업로드 중지 판정시간', value=arg['alt_upload_time'], desc=['hours', '다운로드 포함한 시간, 0이면 업로드 중인건 삭제하지 않음']) }} + {{ macros.setting_checkbox('alt_upload', '업로드 중지된 것도 넘김', value=arg['alt_upload'], desc='업로드 시간이 넘은 것 처리. off: 그냥 삭제, on: 넘김') }} {{ macros.setting_button([['global_setting_save_btn', '설정 저장']]) }} {{ macros.m_tab_content_end() }} From a201d29585536bf5bf1230525c30cbda2bba2be0 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:43:27 +0900 Subject: [PATCH 11/18] Update logic.py --- logic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic.py b/logic.py index e7b5a0a..a2d26cb 100644 --- a/logic.py +++ b/logic.py @@ -49,7 +49,7 @@ class Logic(object): # 20230331 새로 추가 'alt_download' : 'False', 'alt_download_time' : '4', - 'alt_upload_time' : '12', + 'alt_upload' : '', # cache 'cache_save_type_list' : '', 'cache_receive_info_send_telegram' : 'False' From 63216c1e025da76eb78ac021569af6ae317b14d7 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 21:05:27 +0900 Subject: [PATCH 12/18] Update offcloud2_rss_setting.html --- templates/offcloud2_rss_setting.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/offcloud2_rss_setting.html b/templates/offcloud2_rss_setting.html index cc47d6e..e3097e9 100644 --- a/templates/offcloud2_rss_setting.html +++ b/templates/offcloud2_rss_setting.html @@ -20,7 +20,7 @@ {{ macros.setting_checkbox('remove_cloud_history_on_web', '완료시 웹에서 Cloud 작업 삭제', value=arg['remove_cloud_history_on_web'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_remote', 'Remote 중복 작업 제거', value=arg['dedupe_on_remote'], desc=None) }} {{ macros.setting_checkbox('dedupe_on_cloud', 'Cloud 중복 작업 제거', value=arg['dedupe_on_cloud'], desc=None) }} - {{ macros.setting_checkbox('alt_download', '중지된 목록 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 스테이션으로 마그넷 넘깁니다') }} + {{ macros.setting_checkbox('alt_download', '중지된 목록 다운로드 클라이언트로', value=arg['alt_download'], desc='지정한 시간이 넘고 다운로드 속도가 없으면 다운로드 클라이언트로 마그넷 넘깁니다') }} {{ macros.setting_input_int('alt_download_time', '다운로드 중지 판정시간', value=arg['alt_download_time'], desc=['hours', '']) }} {{ macros.setting_checkbox('alt_upload', '업로드 중지된 것도 넘김', value=arg['alt_upload'], desc='업로드 시간이 넘은 것 처리. off: 그냥 삭제, on: 넘김') }} {{ macros.setting_button([['global_setting_save_btn', '설정 저장']]) }} From 79dad140425988c4fdd6681f988181eb9c49cd07 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 1 Apr 2023 21:22:16 +0900 Subject: [PATCH 13/18] Update logic_rss.py --- logic_rss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_rss.py b/logic_rss.py index d3efae2..96b6c9b 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -277,7 +277,7 @@ def scheduler_function_alt_download(target): item = remote_item.get('requestId') result = Offcloud.remove(apikey, target, item) logger.debug('다운로드 중지됨 - removed : %s === %s', result, item) - elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (int(remote_item.get('fileSize') / (2 * 1024 * 2024) * 2) * 1000) : + elif (remote_item.get('status') == 'uploading') and ModelSetting.get_int('alt_upload_time') > 0 and int(remote_item.get('downloadingTime')) > (int(remote_item.get('fileSize') / (2 * 1024 * 2024)) * 1000) : if ModelSetting.get_bool('alt_upload'): Logic.add_download2(remote_magnet, get_default_value[0], get_default_value[1]) item = remote_item.get('requestId') From 10cf390a5279926beb11d54285cb5c6e8c8703e4 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Tue, 14 May 2024 10:31:52 +0900 Subject: [PATCH 14/18] Add files via upload --- rss_nyaa.py | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 rss_nyaa.py diff --git a/rss_nyaa.py b/rss_nyaa.py new file mode 100644 index 0000000..79f5145 --- /dev/null +++ b/rss_nyaa.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +######################################################### +# python +import os +import traceback +import logging +import urllib +import xml.etree.ElementTree as ET +# third-party +import requests +# sjva 공용 +from framework import logger, py_urllib2 + +# 패키지 +from .plugin import logger, package_name +# 로그 + +######################################################### +class RssUtil(object): + @staticmethod + def get_rss(url): + try: + logger.debug('get_rss : %s', url) + """ + req = py_urllib2.Request(url) + req.add_header('user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36') + resp = py_urllib2.urlopen(req) + + tree = ET.ElementTree(file=resp) + """ + text = requests.get(url, headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36'}).text + + #logger.warning(text) + + try: + root = ET.fromstring(text) + except ET.ParseError as e: + print(f"XML 파싱 에러: {e}") + else: + namespaces = {'nyaa': 'https://nyaa.si/xmlns/nyaa'} # 'nyaa' 네임스페이스 정의 + #logger.warning(tree) + #root = tree.getroot() + item_list = root.findall('.//channel/item') + logger.debug('xml item count:%s', len(item_list)) + ret = [] + for item in item_list: + try: + info_hash_element = item.find('nyaa:infoHash', namespaces=namespaces) + if info_hash_element is not None and info_hash_element.text: + link = "magnet:?xt=urn:btih:" + info_hash_element.text + else: + link = item.find('link').text.strip() + if link.startswith('magnet'): + try: + link = link[0:60] + except: + logger.error(e) + logger.error(traceback.format_exc()) + link = item.find('link').text.strip() + rss = Feed(item.find('title').text.strip(), link) + ret.append(rss) + except Exception as exception: + #logger.debug(item.find('title').text) + #logger.debug(item.find('link').text) + logger.debug(exception) + logger.debug(traceback.format_exc()) + return ret + except Exception as exception: + logger.debug(exception) + logger.debug(traceback.format_exc()) + logger.debug('url:%s', url) + return None + + """ + @staticmethod + def make_rss(title, rss_list, torrent_mode, ddns, is_bot=False): + xml = '\n' + xml += '\t\n' + xml += '\t\t' + '%s\n' % title + xml += '\t\t\n' + xml += '\t\t\n' + for bbs in rss_list: + for download in bbs.files: + try: + item_str = '\t\t\n' + if download.filename.lower().endswith('.smi') or download.filename.lower().endswith('.srt') or download.filename.lower().endswith('.ass') or download.filename.lower().endswith('.ssa') or download.filename.lower().endswith('.sub'): + tmp = '\t\t\t[자막]%s\n' % TorrentSite.replace_xml(bbs.title) + else: + tmp = '\t\t\t%s\n' % TorrentSite.replace_xml(bbs.title) + + item_str += tmp + if torrent_mode == 'magnet' and download.is_torrent: + item_str += '\t\t\t%s\n' % download.magnet + else: + if is_bot: + item_str += '\t\t\t%s/rss/download_bot/%s\n' % (ddns, download.id) + else: + item_str += '\t\t\t%s/rss/download/%s\n' % (ddns, download.id) + item_str += '\t\t\t%s\n' % TorrentSite.replace_xml(download.filename) + date_str = bbs.created_time.strftime("%a, %d %b %Y %H:%M:%S") + ' +0900' + item_str += '\t\t\t%s\n' % date_str + item_str += '\t\t\n' + xml += item_str + except Exception as exception: + logger.debug('Exception:%s', exception) + logger.debug(traceback.format_exc()) + xml += '\t\n' + xml += '' + return xml + """ + + @staticmethod + def replace_xml(xml): + tmp = [['&', '&'], ['<', '<'], ['>', '>'], ['‘', '''], ['"', '"']] + for t in tmp: + xml = xml.replace(t[0], t[1]) + return xml + + + @staticmethod + def make_rss(package_name, rss_list): + #from system.model import ModelSetting as SystemModelSetting + #ddns = SystemModelSetting.get('ddns') + xml = '\n' + xml += '\t\n' + xml += '\t\t' + '%s\n' % package_name + xml += '\t\t\n' + xml += '\t\t\n' + for bbs in rss_list: + try: + item_str = '\t\t\n' + tmp = '\t\t\t%s\n' % RssUtil.replace_xml(bbs['title']) + item_str += tmp + #item_str += '\t\t\t%s\n' % bbs['link'] + item_str += '\t\t\t%s\n' % RssUtil.replace_xml(bbs['link']) + date_str = bbs['created_time'].strftime("%a, %d %b %Y %H:%M:%S") + ' +0900' + item_str += '\t\t\t%s\n' % date_str + item_str += '\t\t\n' + xml += item_str + except Exception as exception: + logger.debug('Exception:%s', exception) + logger.debug(traceback.format_exc()) + xml += '\t\n' + xml += '' + return xml + + + + + +class Feed(object): + def __init__(self, title, link): + self.title = title + self.link = link + From 25aed7ce2e58e6b9342e23f948a15d6f2880b99a Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Tue, 14 May 2024 10:32:38 +0900 Subject: [PATCH 15/18] Update logic_rss.py --- logic_rss.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/logic_rss.py b/logic_rss.py index 96b6c9b..abf343d 100644 --- a/logic_rss.py +++ b/logic_rss.py @@ -18,14 +18,13 @@ # sjva 공용 from framework import db, scheduler, path_app_root, SystemModelSetting, celery, app, Util from framework.job import Job -from framework.common.rss import RssUtil import framework.common.celery as celery_task # 패키지 from .plugin import logger, package_name from .model import ModelSetting, ModelOffcloud2Account, ModelOffcloud2Job, ModelOffcloud2Item, ModelOffcloud2Cache from .offcloud_api import Offcloud - +from .rss_nyaa import RssUtil ######################################################### From 8ac51df5c3bf81009fc96ad0d3abd47f2b56c08a Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 25 May 2024 14:27:15 +0900 Subject: [PATCH 16/18] Update logic_base.py --- logic_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_base.py b/logic_base.py index 882cb47..c397db9 100644 --- a/logic_base.py +++ b/logic_base.py @@ -12,7 +12,7 @@ from framework import db, scheduler, path_app_root from framework.job import Job from framework.util import Util -from framework.common.rss import RssUtil +from .rss_nyaa import RssUtil # 패키지 from .plugin import logger, package_name From 60b95006084a78a7c729cdbf2a5bec5acc54fdba Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 25 May 2024 14:27:39 +0900 Subject: [PATCH 17/18] Update logic_cache.py --- logic_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic_cache.py b/logic_cache.py index f2ba19c..3e4a48a 100644 --- a/logic_cache.py +++ b/logic_cache.py @@ -16,7 +16,7 @@ from framework import db, scheduler, path_app_root, SystemModelSetting from framework.job import Job from framework.util import Util -from framework.common.rss import RssUtil +from .rss_nyaa import RssUtil from tool_base import ToolBaseNotify # 패키지 From e379c63e33b14122e6eac493d80a613a5c4aaa67 Mon Sep 17 00:00:00 2001 From: kihyyo <83176214+kihyyo@users.noreply.github.com> Date: Sat, 25 May 2024 14:28:51 +0900 Subject: [PATCH 18/18] Update plugin.py --- plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.py b/plugin.py index d9af048..cee3b69 100644 --- a/plugin.py +++ b/plugin.py @@ -255,7 +255,7 @@ def api(sub): item['link'] = t.link item['created_time'] = t.created_time data.append(item) - from framework.common.rss import RssUtil + from .rss_nyaa import RssUtil xml = RssUtil.make_rss(package_name, data) return Response(xml, mimetype='application/xml') elif sub == 'cache': @@ -267,7 +267,7 @@ def api(sub): item['link'] = t.magnet item['created_time'] = t.created_time data.append(item) - from framework.common.rss import RssUtil + from .rss_nyaa import RssUtil xml = RssUtil.make_rss(package_name, data) return Response(xml, mimetype='application/xml') elif sub == 'hash':