This commit is contained in:
jxxghp
2023-06-09 19:25:12 +08:00
parent 77b755da5f
commit 6925dde254
76 changed files with 137 additions and 102 deletions

View File

@ -3,7 +3,9 @@ from pathlib import Path
from typing import List, Optional, Tuple, Union
from xml.dom import minidom
from app.core import MediaInfo, settings, MetaInfo
from app.core.context import MediaInfo
from app.core.config import settings
from app.core.meta_info import MetaInfo
from app.core.meta import MetaBase
from app.log import logger
from app.modules import _ModuleBase

View File

@ -1,6 +1,6 @@
from typing import Optional, Tuple, Union
from app.core import MediaInfo
from app.core.context import MediaInfo
from app.log import logger
from app.modules import _ModuleBase
from app.modules.emby.emby import Emby

View File

@ -2,7 +2,7 @@ import re
from pathlib import Path
from typing import List, Optional, Union, Dict
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.singleton import Singleton

View File

@ -2,7 +2,7 @@ import re
from functools import lru_cache
from typing import Optional, Tuple, Union
from app.core import MediaInfo, settings
from app.core.context import MediaInfo, settings
from app.log import logger
from app.modules import _ModuleBase
from app.utils.http import RequestUtils

View File

@ -5,7 +5,9 @@ from typing import Optional, List, Tuple, Union
from jinja2 import Template
from app.core import MediaInfo, MetaInfo, settings
from app.core.context import MediaInfo
from app.core.meta_info import MetaInfo
from app.core.config import settings
from app.core.meta import MetaBase
from app.log import logger
from app.modules import _ModuleBase

View File

@ -1,7 +1,8 @@
import re
from typing import List, Tuple, Union, Dict, Optional
from app.core import TorrentInfo, settings
from app.core.context import TorrentInfo
from app.core.config import settings
from app.modules import _ModuleBase
from app.modules.filter.RuleParser import RuleParser

View File

@ -4,7 +4,7 @@ from typing import List, Optional, Tuple, Union
from ruamel.yaml import CommentedMap
from app.core import MediaInfo, TorrentInfo
from app.core.context import MediaInfo, TorrentInfo
from app.log import logger
from app.modules import _ModuleBase
from app.modules.indexer.spider import TorrentSpider

View File

@ -8,8 +8,8 @@ from jinja2 import Template
from pyquery import PyQuery
from ruamel.yaml import CommentedMap
from app.core import settings
from app.helper.playwright import PlaywrightHelper
from app.core.config import settings
from app.helper.browser import PlaywrightHelper
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
@ -17,6 +17,7 @@ from app.utils.types import MediaType
class TorrentSpider:
# 是否出现错误
is_error: bool = False
# 索引器ID
@ -217,7 +218,7 @@ class TorrentSpider:
if self.render:
page_source = PlaywrightHelper().get_page_source(
url=searchurl,
cookie=self.cookie,
cookies=self.cookie,
ua=self.ua,
proxy=self.proxies
)

View File

@ -3,7 +3,7 @@ from typing import Tuple, List
from ruamel.yaml import CommentedMap
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils

View File

@ -3,7 +3,7 @@ from urllib.parse import quote
from ruamel.yaml import CommentedMap
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils

View File

@ -1,6 +1,6 @@
from typing import Optional, Tuple, Union
from app.core import MediaInfo
from app.core.context import MediaInfo
from app.log import logger
from app.modules import _ModuleBase
from app.modules.jellyfin.jellyfin import Jellyfin

View File

@ -1,7 +1,7 @@
import re
from typing import List, Union, Optional, Dict
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.singleton import Singleton

View File

@ -1,6 +1,6 @@
from typing import Optional, Tuple, Union
from app.core import MediaInfo
from app.core.context import MediaInfo
from app.log import logger
from app.modules import _ModuleBase
from app.modules.plex.plex import Plex

View File

@ -5,7 +5,7 @@ from urllib.parse import quote_plus
from plexapi import media
from plexapi.server import PlexServer
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton

View File

@ -1,7 +1,8 @@
from pathlib import Path
from typing import Set, Tuple, Optional, Union, List
from app.core import settings, MetaInfo
from app.core.config import settings
from app.core.meta_info import MetaInfo
from app.modules import _ModuleBase
from app.modules.qbittorrent.qbittorrent import Qbittorrent
from app.utils.string import StringUtils

View File

@ -6,7 +6,7 @@ import qbittorrentapi
from qbittorrentapi import TorrentFilesList, TorrentDictionary
from qbittorrentapi.client import Client
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton
from app.utils.string import StringUtils

View File

@ -1,7 +1,8 @@
import json
from typing import Optional, Union, List, Tuple, Any
from app.core import MediaInfo, settings, Context
from app.core.context import MediaInfo, Context
from app.core.config import settings
from app.log import logger
from app.modules import _ModuleBase
from app.modules.telegram.telegram import Telegram

View File

@ -4,11 +4,11 @@ from typing import Optional, List
import telebot
from app.core import settings, MediaInfo, Context
from app.core.config import settings
from app.core.context import MediaInfo, Context
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.singleton import Singleton
from app.utils.string import StringUtils
class Telegram(metaclass=Singleton):
@ -20,6 +20,9 @@ class Telegram(metaclass=Singleton):
"""
初始化参数
"""
if settings.MESSAGER != "telegram":
return
# Token
self._telegram_token = settings.TELEGRAM_TOKEN
# Chat Id
@ -72,7 +75,7 @@ class Telegram(metaclass=Singleton):
else:
chat_id = self._telegram_chat_id
return self.__send_request(image=image, caption=caption)
return self.__send_request(userid=chat_id, image=image, caption=caption)
except Exception as msg_e:
logger.error(f"发送消息失败:{msg_e}")
@ -110,7 +113,7 @@ class Telegram(metaclass=Singleton):
else:
chat_id = self._telegram_chat_id
return self.__send_request(image=image, caption=caption)
return self.__send_request(userid=chat_id, image=image, caption=caption)
except Exception as msg_e:
logger.error(f"发送消息失败:{msg_e}")
@ -140,24 +143,24 @@ class Telegram(metaclass=Singleton):
else:
chat_id = self._telegram_chat_id
return self.__send_request(caption=caption)
return self.__send_request(userid=chat_id, caption=caption)
except Exception as msg_e:
logger.error(f"发送消息失败:{msg_e}")
return False
def __send_request(self, image="", caption="") -> bool:
def __send_request(self, userid: str = None, image="", caption="") -> bool:
"""
向Telegram发送报文
"""
if image:
ret = self._bot.send_photo(chat_id=self._telegram_chat_id,
ret = self._bot.send_photo(chat_id=userid or self._telegram_chat_id,
photo=image,
caption=caption,
parse_mode="Markdown")
else:
ret = self._bot.send_message(chat_id=self._telegram_chat_id,
ret = self._bot.send_message(chat_id=userid or self._telegram_chat_id,
text=caption,
parse_mode="Markdown")

View File

@ -3,7 +3,9 @@ from pathlib import Path
from typing import Optional, List, Tuple, Union
from xml.dom import minidom
from app.core import settings, MediaInfo, MetaInfo
from app.core.config import settings
from app.core.context import MediaInfo
from app.core.meta_info import MetaInfo
from app.core.meta import MetaBase
from app.log import logger
from app.modules import _ModuleBase

View File

@ -3,7 +3,7 @@ from pathlib import Path
import ruamel.yaml
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton

View File

@ -6,7 +6,7 @@ from lxml import etree
from tmdbv3api import TMDb, Search, Movie, TV, Season, Episode
from tmdbv3api.exceptions import TMDbException
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils

View File

@ -5,7 +5,7 @@ from pathlib import Path
from threading import RLock
from typing import Optional
from app.core import settings
from app.core.config import settings
from app.core.meta import MetaBase
from app.utils.singleton import Singleton
from app.utils.types import MediaType

View File

@ -1,7 +1,8 @@
from pathlib import Path
from typing import Set, Tuple, Optional, Union, List
from app.core import settings, MetaInfo
from app.core.config import settings
from app.core.meta_info import MetaInfo
from app.modules import _ModuleBase
from app.modules.transmission.transmission import Transmission
from app.utils.types import TorrentStatus

View File

@ -4,7 +4,7 @@ from typing import Optional, Union, Tuple, List
import transmission_rpc
from transmission_rpc import Client, Torrent, File
from app.core import settings
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton
from app.utils.string import StringUtils

View File

@ -1,7 +1,8 @@
import xml.dom.minidom
from typing import Optional, Union, List, Tuple, Any
from app.core import MediaInfo, settings, Context
from app.core.context import MediaInfo, Context
from app.core.config import settings
from app.log import logger
from app.modules import _ModuleBase
from app.modules.wechat.WXBizMsgCrypt3 import WXBizMsgCrypt

View File

@ -3,7 +3,8 @@ import threading
from datetime import datetime
from typing import Optional, List
from app.core import settings, MediaInfo, Context
from app.core.config import settings
from app.core.context import MediaInfo, Context
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.singleton import Singleton