add 事件广播
This commit is contained in:
@ -10,7 +10,7 @@ from app.db import get_db
|
|||||||
from app.db.models.subscribe import Subscribe
|
from app.db.models.subscribe import Subscribe
|
||||||
from app.db.models.user import User
|
from app.db.models.user import User
|
||||||
from app.db.userauth import get_current_active_superuser
|
from app.db.userauth import get_current_active_superuser
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from pathlib import Path
|
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Depends
|
from fastapi import APIRouter, HTTPException, Depends
|
||||||
@ -12,7 +11,7 @@ from app.core.metainfo import MetaInfo
|
|||||||
from app.db import get_db
|
from app.db import get_db
|
||||||
from app.db.models.subscribe import Subscribe
|
from app.db.models.subscribe import Subscribe
|
||||||
from app.schemas import RadarrMovie, SonarrSeries
|
from app.schemas import RadarrMovie, SonarrSeries
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
from version import APP_VERSION
|
from version import APP_VERSION
|
||||||
|
|
||||||
arr_router = APIRouter()
|
arr_router = APIRouter()
|
||||||
|
@ -6,13 +6,14 @@ from typing import Optional, Any, Tuple, List, Set, Union, Dict
|
|||||||
from ruamel.yaml import CommentedMap
|
from ruamel.yaml import CommentedMap
|
||||||
|
|
||||||
from app.core.context import Context
|
from app.core.context import Context
|
||||||
|
from app.core.event import EventManager
|
||||||
from app.core.module import ModuleManager
|
from app.core.module import ModuleManager
|
||||||
from app.core.context import MediaInfo, TorrentInfo
|
from app.core.context import MediaInfo, TorrentInfo
|
||||||
from app.core.meta import MetaBase
|
from app.core.meta import MetaBase
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.schemas.context import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent
|
from app.schemas.context import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent
|
||||||
from app.utils.singleton import AbstractSingleton, Singleton
|
from app.utils.singleton import AbstractSingleton, Singleton
|
||||||
from app.utils.types import TorrentStatus, MediaType
|
from app.schemas.types import TorrentStatus, MediaType
|
||||||
|
|
||||||
|
|
||||||
class ChainBase(AbstractSingleton, metaclass=Singleton):
|
class ChainBase(AbstractSingleton, metaclass=Singleton):
|
||||||
@ -25,6 +26,7 @@ class ChainBase(AbstractSingleton, metaclass=Singleton):
|
|||||||
公共初始化
|
公共初始化
|
||||||
"""
|
"""
|
||||||
self.modulemanager = ModuleManager()
|
self.modulemanager = ModuleManager()
|
||||||
|
self.eventmanager = EventManager()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def process(self, *args, **kwargs) -> Optional[Context]:
|
def process(self, *args, **kwargs) -> Optional[Context]:
|
||||||
|
@ -9,7 +9,7 @@ from app.helper.torrent import TorrentHelper
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.schemas.context import ExistMediaInfo, NotExistMediaInfo
|
from app.schemas.context import ExistMediaInfo, NotExistMediaInfo
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType, TorrentStatus
|
from app.schemas.types import MediaType, TorrentStatus, EventType
|
||||||
|
|
||||||
|
|
||||||
class DownloadChain(ChainBase):
|
class DownloadChain(ChainBase):
|
||||||
@ -115,6 +115,12 @@ class DownloadChain(ChainBase):
|
|||||||
self.post_download_message(meta=_meta, mediainfo=_media, torrent=_torrent, userid=userid)
|
self.post_download_message(meta=_meta, mediainfo=_media, torrent=_torrent, userid=userid)
|
||||||
# 下载成功后处理
|
# 下载成功后处理
|
||||||
self.download_added(context=_context, torrent_path=_torrent_file)
|
self.download_added(context=_context, torrent_path=_torrent_file)
|
||||||
|
# 广播事件
|
||||||
|
self.eventmanager.send_event(EventType.DownloadAdded, {
|
||||||
|
"hash": _hash,
|
||||||
|
"torrent_file": _torrent_file,
|
||||||
|
"context": _context
|
||||||
|
})
|
||||||
else:
|
else:
|
||||||
# 下载失败
|
# 下载失败
|
||||||
logger.error(f"{_media.title_year} 添加下载任务失败:"
|
logger.error(f"{_media.title_year} 添加下载任务失败:"
|
||||||
|
@ -9,7 +9,7 @@ from app.helper.sites import SitesHelper
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.schemas.context import NotExistMediaInfo
|
from app.schemas.context import NotExistMediaInfo
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class SearchChain(ChainBase):
|
class SearchChain(ChainBase):
|
||||||
|
@ -11,7 +11,7 @@ from app.helper.sites import SitesHelper
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.schemas.context import NotExistMediaInfo
|
from app.schemas.context import NotExistMediaInfo
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class SubscribeChain(ChainBase):
|
class SubscribeChain(ChainBase):
|
||||||
|
@ -10,7 +10,7 @@ from app.log import logger
|
|||||||
from app.schemas.context import TransferInfo, TransferTorrent
|
from app.schemas.context import TransferInfo, TransferTorrent
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
from app.utils.types import TorrentStatus
|
from app.schemas.types import TorrentStatus, EventType
|
||||||
|
|
||||||
|
|
||||||
class TransferChain(ChainBase):
|
class TransferChain(ChainBase):
|
||||||
@ -114,6 +114,12 @@ class TransferChain(ChainBase):
|
|||||||
self.refresh_mediaserver(mediainfo=mediainfo, file_path=transferinfo.target_path)
|
self.refresh_mediaserver(mediainfo=mediainfo, file_path=transferinfo.target_path)
|
||||||
# 发送通知
|
# 发送通知
|
||||||
self.__send_transfer_message(meta=meta, mediainfo=mediainfo, transferinfo=transferinfo)
|
self.__send_transfer_message(meta=meta, mediainfo=mediainfo, transferinfo=transferinfo)
|
||||||
|
# 广播事件
|
||||||
|
self.eventmanager.send_event(EventType.TransferComplete, {
|
||||||
|
'meta': meta,
|
||||||
|
'mediainfo': mediainfo,
|
||||||
|
'transferinfo': transferinfo
|
||||||
|
})
|
||||||
|
|
||||||
logger.info("下载器文件转移执行完成")
|
logger.info("下载器文件转移执行完成")
|
||||||
return True
|
return True
|
||||||
|
@ -7,7 +7,7 @@ from app.core.context import MediaInfo, TorrentInfo
|
|||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.core.event import EventManager
|
from app.core.event import EventManager
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
|
|
||||||
class UserMessageChain(ChainBase):
|
class UserMessageChain(ChainBase):
|
||||||
|
@ -3,6 +3,7 @@ from typing import Any
|
|||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.utils.http import WebUtils
|
from app.utils.http import WebUtils
|
||||||
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
|
|
||||||
class WebhookMessageChain(ChainBase):
|
class WebhookMessageChain(ChainBase):
|
||||||
@ -18,6 +19,8 @@ class WebhookMessageChain(ChainBase):
|
|||||||
event_info: dict = self.webhook_parser(body=body, form=form, args=args)
|
event_info: dict = self.webhook_parser(body=body, form=form, args=args)
|
||||||
if not event_info:
|
if not event_info:
|
||||||
return
|
return
|
||||||
|
# 广播事件
|
||||||
|
self.eventmanager.send_event(EventType.WebhookMessage, event_info)
|
||||||
# 拼装消息内容
|
# 拼装消息内容
|
||||||
_webhook_actions = {
|
_webhook_actions = {
|
||||||
"library.new": "新入库",
|
"library.new": "新入库",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import inspect
|
|
||||||
import traceback
|
import traceback
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
@ -16,7 +15,7 @@ from app.core.event import Event as ManagerEvent
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.object import ObjectUtils
|
from app.utils.object import ObjectUtils
|
||||||
from app.utils.singleton import Singleton
|
from app.utils.singleton import Singleton
|
||||||
from app.utils.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
|
|
||||||
class CommandChian(ChainBase):
|
class CommandChian(ChainBase):
|
||||||
|
@ -3,7 +3,7 @@ from typing import Optional, Any, List
|
|||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.meta import MetaBase
|
from app.core.meta import MetaBase
|
||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class TorrentInfo:
|
class TorrentInfo:
|
||||||
|
@ -2,7 +2,7 @@ from queue import Queue, Empty
|
|||||||
|
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.singleton import Singleton
|
from app.utils.singleton import Singleton
|
||||||
from app.utils.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
|
|
||||||
class EventManager(metaclass=Singleton):
|
class EventManager(metaclass=Singleton):
|
||||||
|
@ -4,7 +4,7 @@ import anitopy
|
|||||||
from app.core.meta.metabase import MetaBase
|
from app.core.meta.metabase import MetaBase
|
||||||
from app.core.meta.release_groups import ReleaseGroupsMatcher
|
from app.core.meta.release_groups import ReleaseGroupsMatcher
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class MetaAnime(MetaBase):
|
class MetaAnime(MetaBase):
|
||||||
|
@ -4,7 +4,7 @@ import cn2an
|
|||||||
import regex as re
|
import regex as re
|
||||||
|
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class MetaBase(object):
|
class MetaBase(object):
|
||||||
|
@ -6,7 +6,7 @@ from app.core.meta.metabase import MetaBase
|
|||||||
from app.core.meta.release_groups import ReleaseGroupsMatcher
|
from app.core.meta.release_groups import ReleaseGroupsMatcher
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.tokens import Tokens
|
from app.utils.tokens import Tokens
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class MetaVideo(MetaBase):
|
class MetaVideo(MetaBase):
|
||||||
|
@ -5,7 +5,7 @@ from app.db import DbOper
|
|||||||
from app.db.models.systemconfig import SystemConfig
|
from app.db.models.systemconfig import SystemConfig
|
||||||
from app.utils.object import ObjectUtils
|
from app.utils.object import ObjectUtils
|
||||||
from app.utils.singleton import Singleton
|
from app.utils.singleton import Singleton
|
||||||
from app.utils.types import SystemConfigKey
|
from app.schemas.types import SystemConfigKey
|
||||||
|
|
||||||
|
|
||||||
class SystemConfigOper(DbOper, metaclass=Singleton):
|
class SystemConfigOper(DbOper, metaclass=Singleton):
|
||||||
|
@ -12,7 +12,7 @@ from app.core.context import Context
|
|||||||
from app.core.metainfo import MetaInfo
|
from app.core.metainfo import MetaInfo
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class TorrentHelper:
|
class TorrentHelper:
|
||||||
|
@ -7,7 +7,7 @@ from ruamel.yaml import CommentedMap
|
|||||||
from app.core.context import MediaInfo, TorrentInfo, Context
|
from app.core.context import MediaInfo, TorrentInfo, Context
|
||||||
from app.core.meta import MetaBase
|
from app.core.meta import MetaBase
|
||||||
from app.schemas.context import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent
|
from app.schemas.context import TransferInfo, TransferTorrent, ExistMediaInfo, DownloadingTorrent
|
||||||
from app.utils.types import TorrentStatus, MediaType
|
from app.schemas.types import TorrentStatus, MediaType
|
||||||
|
|
||||||
|
|
||||||
class _ModuleBase(metaclass=ABCMeta):
|
class _ModuleBase(metaclass=ABCMeta):
|
||||||
|
@ -13,7 +13,7 @@ from app.modules.douban.apiv2 import DoubanApi
|
|||||||
from app.utils.dom import DomUtils
|
from app.utils.dom import DomUtils
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class DoubanModule(_ModuleBase):
|
class DoubanModule(_ModuleBase):
|
||||||
|
@ -6,7 +6,7 @@ from app.log import logger
|
|||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.emby.emby import Emby
|
from app.modules.emby.emby import Emby
|
||||||
from app.schemas.context import ExistMediaInfo, RefreshMediaItem
|
from app.schemas.context import ExistMediaInfo, RefreshMediaItem
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class EmbyModule(_ModuleBase):
|
class EmbyModule(_ModuleBase):
|
||||||
|
@ -9,7 +9,7 @@ from app.schemas.context import RefreshMediaItem
|
|||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.singleton import Singleton
|
from app.utils.singleton import Singleton
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class Emby(metaclass=Singleton):
|
class Emby(metaclass=Singleton):
|
||||||
|
@ -6,7 +6,7 @@ from app.core.context import MediaInfo, settings
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class FanartModule(_ModuleBase):
|
class FanartModule(_ModuleBase):
|
||||||
|
@ -13,7 +13,7 @@ from app.log import logger
|
|||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.schemas.context import TransferInfo
|
from app.schemas.context import TransferInfo
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
lock = Lock()
|
lock = Lock()
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from app.modules.indexer.spider import TorrentSpider
|
|||||||
from app.modules.indexer.tnode import TNodeSpider
|
from app.modules.indexer.tnode import TNodeSpider
|
||||||
from app.modules.indexer.torrentleech import TorrentLeech
|
from app.modules.indexer.torrentleech import TorrentLeech
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class IndexerModule(_ModuleBase):
|
class IndexerModule(_ModuleBase):
|
||||||
|
@ -14,7 +14,7 @@ from app.helper.browser import PlaywrightHelper
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class TorrentSpider:
|
class TorrentSpider:
|
||||||
|
@ -7,7 +7,7 @@ from app.log import logger
|
|||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.jellyfin.jellyfin import Jellyfin
|
from app.modules.jellyfin.jellyfin import Jellyfin
|
||||||
from app.schemas.context import ExistMediaInfo
|
from app.schemas.context import ExistMediaInfo
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class JellyfinModule(_ModuleBase):
|
class JellyfinModule(_ModuleBase):
|
||||||
|
@ -6,7 +6,7 @@ from app.log import logger
|
|||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.plex.plex import Plex
|
from app.modules.plex.plex import Plex
|
||||||
from app.schemas.context import ExistMediaInfo, RefreshMediaItem
|
from app.schemas.context import ExistMediaInfo, RefreshMediaItem
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class PlexModule(_ModuleBase):
|
class PlexModule(_ModuleBase):
|
||||||
|
@ -8,7 +8,7 @@ from app.modules import _ModuleBase
|
|||||||
from app.modules.qbittorrent.qbittorrent import Qbittorrent
|
from app.modules.qbittorrent.qbittorrent import Qbittorrent
|
||||||
from app.schemas.context import TransferInfo, TransferTorrent, DownloadingTorrent
|
from app.schemas.context import TransferInfo, TransferTorrent, DownloadingTorrent
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import TorrentStatus
|
from app.schemas.types import TorrentStatus
|
||||||
|
|
||||||
|
|
||||||
class QbittorrentModule(_ModuleBase):
|
class QbittorrentModule(_ModuleBase):
|
||||||
|
@ -15,7 +15,7 @@ from app.modules.themoviedb.tmdb_cache import TmdbCache
|
|||||||
from app.utils.dom import DomUtils
|
from app.utils.dom import DomUtils
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class TheMovieDbModule(_ModuleBase):
|
class TheMovieDbModule(_ModuleBase):
|
||||||
|
@ -12,7 +12,7 @@ from app.core.config import settings
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class TmdbHelper:
|
class TmdbHelper:
|
||||||
|
@ -8,7 +8,7 @@ from typing import Optional
|
|||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.meta import MetaBase
|
from app.core.meta import MetaBase
|
||||||
from app.utils.singleton import Singleton
|
from app.utils.singleton import Singleton
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
lock = RLock()
|
lock = RLock()
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ from app.log import logger
|
|||||||
from app.modules import _ModuleBase
|
from app.modules import _ModuleBase
|
||||||
from app.modules.transmission.transmission import Transmission
|
from app.modules.transmission.transmission import Transmission
|
||||||
from app.schemas.context import TransferInfo, TransferTorrent, DownloadingTorrent
|
from app.schemas.context import TransferInfo, TransferTorrent, DownloadingTorrent
|
||||||
from app.utils.types import TorrentStatus
|
from app.schemas.types import TorrentStatus
|
||||||
|
|
||||||
|
|
||||||
class TransmissionModule(_ModuleBase):
|
class TransmissionModule(_ModuleBase):
|
||||||
|
@ -18,7 +18,7 @@ from app.plugins import _PluginBase
|
|||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.site import SiteUtils
|
from app.utils.site import SiteUtils
|
||||||
from app.utils.timer import TimerUtils
|
from app.utils.timer import TimerUtils
|
||||||
from app.utils.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
|
|
||||||
class AutoSignIn(_PluginBase):
|
class AutoSignIn(_PluginBase):
|
||||||
|
@ -22,7 +22,7 @@ from app.utils.timer import TimerUtils
|
|||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from app.utils.types import EventType
|
from app.schemas.types import EventType
|
||||||
|
|
||||||
warnings.filterwarnings("ignore", category=FutureWarning)
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from app.helper.cloudflare import under_challenge
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
from app.utils.site import SiteUtils
|
from app.utils.site import SiteUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
SITE_BASE_ORDER = 1000
|
SITE_BASE_ORDER = 1000
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class DiscuzUserInfo(ISiteUserInfo):
|
class DiscuzUserInfo(ISiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class FileListSiteUserInfo(ISiteUserInfo):
|
class FileListSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class GazelleSiteUserInfo(ISiteUserInfo):
|
class GazelleSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class IptSiteUserInfo(ISiteUserInfo):
|
class IptSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -7,7 +7,7 @@ from lxml import etree
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class NexusPhpSiteUserInfo(ISiteUserInfo):
|
class NexusPhpSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -3,7 +3,7 @@ import re
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import SITE_BASE_ORDER
|
||||||
from app.plugins.sitestatistic.siteuserinfo.nexus_php import NexusPhpSiteUserInfo
|
from app.plugins.sitestatistic.siteuserinfo.nexus_php import NexusPhpSiteUserInfo
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class NexusProjectSiteUserInfo(NexusPhpSiteUserInfo):
|
class NexusProjectSiteUserInfo(NexusPhpSiteUserInfo):
|
||||||
|
@ -7,7 +7,7 @@ from lxml import etree
|
|||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.plugins.sitestatistic.siteuserinfo import SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import SITE_BASE_ORDER
|
||||||
from app.plugins.sitestatistic.siteuserinfo.nexus_php import NexusPhpSiteUserInfo
|
from app.plugins.sitestatistic.siteuserinfo.nexus_php import NexusPhpSiteUserInfo
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class NexusRabbitSiteUserInfo(NexusPhpSiteUserInfo):
|
class NexusRabbitSiteUserInfo(NexusPhpSiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class SmallHorseSiteUserInfo(ISiteUserInfo):
|
class SmallHorseSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -5,7 +5,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class TNodeSiteUserInfo(ISiteUserInfo):
|
class TNodeSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class TorrentLeechSiteUserInfo(ISiteUserInfo):
|
class TorrentLeechSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -6,7 +6,7 @@ from lxml import etree
|
|||||||
|
|
||||||
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
from app.plugins.sitestatistic.siteuserinfo import ISiteUserInfo, SITE_BASE_ORDER
|
||||||
from app.utils.string import StringUtils
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import SiteSchema
|
from app.schemas.types import SiteSchema
|
||||||
|
|
||||||
|
|
||||||
class Unit3dSiteUserInfo(ISiteUserInfo):
|
class Unit3dSiteUserInfo(ISiteUserInfo):
|
||||||
|
@ -3,7 +3,7 @@ from typing import Optional, Dict
|
|||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class MetaInfo(BaseModel):
|
class MetaInfo(BaseModel):
|
||||||
|
@ -22,6 +22,12 @@ class EventType(Enum):
|
|||||||
SiteSignin = "site.signin"
|
SiteSignin = "site.signin"
|
||||||
# 站点数据统计
|
# 站点数据统计
|
||||||
SiteStatistic = "site.statistic"
|
SiteStatistic = "site.statistic"
|
||||||
|
# Webhook消息
|
||||||
|
WebhookMessage = "webhook.message"
|
||||||
|
# 转移完成
|
||||||
|
TransferComplete = "transfer.complete"
|
||||||
|
# 添加下载
|
||||||
|
DownloadAdded = "download.added"
|
||||||
|
|
||||||
|
|
||||||
# 系统配置Key字典
|
# 系统配置Key字典
|
@ -10,7 +10,7 @@ import cn2an
|
|||||||
import dateparser
|
import dateparser
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
|
||||||
from app.utils.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
class StringUtils:
|
class StringUtils:
|
||||||
|
Reference in New Issue
Block a user