重命名推送函数

This commit is contained in:
WeijiangChen
2023-03-13 00:28:40 +08:00
parent e9f493863b
commit dc8347ffaa
3 changed files with 6 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ from .download_client import DownloadClient
from module.conf import settings
from module.parser import TitleParser
from ..network import PostNotification, FtqqNotification
from ..network import PostNotification, ServerChanNotification
logger = logging.getLogger(__name__)
@@ -54,7 +54,7 @@ class Renamer:
return path_name, season, folder_name, suffix, download_path
def run(self):
notification = FtqqNotification()
notification = ServerChanNotification()
recent_info, torrent_count = self.get_torrent_info()
rename_count = 0
for info in recent_info:

View File

@@ -1,2 +1,2 @@
from .request_contents import RequestContent
from .notification import PostNotification, FtqqNotification
from .notification import PostNotification, ServerChanNotification

View File

@@ -19,7 +19,7 @@ class PostNotification:
return response.status_code == 200
class FtqqNotification:
class ServerChanNotification:
"""Server酱推送"""
def __init__(self):
@@ -35,12 +35,12 @@ class FtqqNotification:
resp = requests.post(self.notification_url, json=data, timeout=3)
resp.raise_for_status()
except requests.RequestException as e:
logging.error("[FtqqNotification] send fail, error: %s" % e)
logging.error("[ServerChanNotification] send fail, error: %s" % e)
return False
return True
if __name__ == '__main__':
name = "勇者、辞职不干了"
notification = FtqqNotification()
notification = ServerChanNotification()
notification.send_msg(f"{name[:10]}》缓存成功", f"[Auto Bangumi]《{name}》缓存成功")