mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-05 11:47:50 +08:00
fix ide warnings
This commit is contained in:
@@ -19,8 +19,7 @@ from app.helper.directory import DirectoryHelper
|
||||
from app.helper.message import MessageHelper
|
||||
from app.helper.torrent import TorrentHelper
|
||||
from app.log import logger
|
||||
from app.schemas import ExistMediaInfo, NotExistMediaInfo, DownloadingTorrent, Notification
|
||||
from app.schemas.event import ResourceSelectionEventData, ResourceDownloadEventData
|
||||
from app.schemas import ExistMediaInfo, NotExistMediaInfo, DownloadingTorrent, Notification, ResourceSelectionEventData, ResourceDownloadEventData
|
||||
from app.schemas.types import MediaType, TorrentStatus, EventType, MessageChannel, NotificationType, ChainEventType
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.string import StringUtils
|
||||
|
||||
@@ -7,7 +7,7 @@ from app.core.security import get_password_hash, verify_password
|
||||
from app.db.models.user import User
|
||||
from app.db.user_oper import UserOper
|
||||
from app.log import logger
|
||||
from app.schemas.event import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas.types import ChainEventType
|
||||
from app.utils.otp import OtpUtils
|
||||
from app.utils.singleton import Singleton
|
||||
|
||||
@@ -15,8 +15,7 @@ from app.helper.message import MessageHelper
|
||||
from app.helper.thread import ThreadHelper
|
||||
from app.log import logger
|
||||
from app.scheduler import Scheduler
|
||||
from app.schemas import Notification
|
||||
from app.schemas.event import CommandRegisterEventData
|
||||
from app.schemas import Notification, CommandRegisterEventData
|
||||
from app.schemas.types import EventType, MessageChannel, ChainEventType
|
||||
from app.utils.object import ObjectUtils
|
||||
from app.utils.singleton import Singleton
|
||||
|
||||
@@ -13,7 +13,7 @@ from typing import Callable, Dict, List, Optional, Union
|
||||
from app.helper.message import MessageHelper
|
||||
from app.helper.thread import ThreadHelper
|
||||
from app.log import logger
|
||||
from app.schemas.event import ChainEventData
|
||||
from app.schemas import ChainEventData
|
||||
from app.schemas.types import ChainEventType, EventType
|
||||
from app.utils.limit import ExponentialBackoffRateLimiter
|
||||
from app.utils.singleton import Singleton
|
||||
|
||||
@@ -13,7 +13,7 @@ connect_args = {
|
||||
# 启用 WAL 模式时的额外配置
|
||||
if settings.DB_WAL_ENABLE:
|
||||
connect_args["check_same_thread"] = False
|
||||
kwargs = {
|
||||
db_kwargs = {
|
||||
"url": f"sqlite:///{settings.CONFIG_PATH}/user.db",
|
||||
"pool_pre_ping": settings.DB_POOL_PRE_PING,
|
||||
"echo": settings.DB_ECHO,
|
||||
@@ -23,13 +23,13 @@ kwargs = {
|
||||
}
|
||||
# 当使用 QueuePool 时,添加 QueuePool 特有的参数
|
||||
if pool_class == QueuePool:
|
||||
kwargs.update({
|
||||
db_kwargs.update({
|
||||
"pool_size": settings.DB_POOL_SIZE,
|
||||
"pool_timeout": settings.DB_POOL_TIMEOUT,
|
||||
"max_overflow": settings.DB_MAX_OVERFLOW
|
||||
})
|
||||
# 创建数据库引擎
|
||||
Engine = create_engine(**kwargs)
|
||||
Engine = create_engine(**db_kwargs)
|
||||
# 根据配置设置日志模式
|
||||
journal_mode = "WAL" if settings.DB_WAL_ENABLE else "DELETE"
|
||||
with Engine.connect() as connection:
|
||||
@@ -198,7 +198,7 @@ class Base:
|
||||
@classmethod
|
||||
@db_query
|
||||
def get(cls, db: Session, rid: int) -> Self:
|
||||
return db.query(cls).filter(cls.id == rid).first()
|
||||
return db.query(cls).filter(and_(cls.id == rid)).first()
|
||||
|
||||
@db_update
|
||||
def update(self, db: Session, payload: dict):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
|
||||
import requests
|
||||
from cachetools import TTLCache, cached
|
||||
|
||||
@@ -6,7 +6,6 @@ from app.core.event import eventmanager
|
||||
from app.log import logger
|
||||
from app.modules import _MediaServerBase, _ModuleBase
|
||||
from app.modules.emby.emby import Emby
|
||||
from app.schemas.event import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas.types import MediaType, ModuleType, ChainEventType, MediaServerType
|
||||
|
||||
|
||||
@@ -73,8 +72,8 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
|
||||
logger.info(f"Emby服务器 {name} 连接断开,尝试重连 ...")
|
||||
server.reconnect()
|
||||
|
||||
def user_authenticate(self, credentials: AuthCredentials, service_name: Optional[str] = None) \
|
||||
-> Optional[AuthCredentials]:
|
||||
def user_authenticate(self, credentials: schemas.AuthCredentials, service_name: Optional[str] = None) \
|
||||
-> Optional[schemas.AuthCredentials]:
|
||||
"""
|
||||
使用Emby用户辅助完成用户认证
|
||||
:param credentials: 认证数据
|
||||
@@ -96,11 +95,11 @@ class EmbyModule(_ModuleBase, _MediaServerBase[Emby]):
|
||||
# 触发认证拦截事件
|
||||
intercept_event = eventmanager.send_event(
|
||||
etype=ChainEventType.AuthIntercept,
|
||||
data=AuthInterceptCredentials(username=credentials.username, channel=self.get_name(),
|
||||
service=name, status="triggered")
|
||||
data=schemas.AuthInterceptCredentials(username=credentials.username, channel=self.get_name(),
|
||||
service=name, status="triggered")
|
||||
)
|
||||
if intercept_event and intercept_event.event_data:
|
||||
intercept_data: AuthInterceptCredentials = intercept_event.event_data
|
||||
intercept_data: schemas.AuthInterceptCredentials = intercept_event.event_data
|
||||
if intercept_data.cancel:
|
||||
continue
|
||||
token = server.authenticate(credentials.username, credentials.password)
|
||||
|
||||
@@ -16,8 +16,7 @@ from app.helper.module import ModuleHelper
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase
|
||||
from app.modules.filemanager.storages import StorageBase
|
||||
from app.schemas import TransferInfo, ExistMediaInfo, TmdbEpisode, TransferDirectoryConf, FileItem, StorageUsage
|
||||
from app.schemas.event import TransferRenameEventData
|
||||
from app.schemas import TransferInfo, ExistMediaInfo, TmdbEpisode, TransferDirectoryConf, FileItem, StorageUsage, TransferRenameEventData
|
||||
from app.schemas.types import MediaType, ModuleType, ChainEventType, OtherModulesType
|
||||
from app.utils.system import SystemUtils
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from pathlib import Path
|
||||
from typing import Optional, List, Union, Dict, Tuple
|
||||
from typing import Optional, List, Dict, Tuple
|
||||
|
||||
from app import schemas
|
||||
from app.helper.storage import StorageHelper
|
||||
|
||||
@@ -282,6 +282,6 @@ class IndexerModule(_ModuleBase):
|
||||
leeching_size=site_obj.leeching_size,
|
||||
message_unread=site_obj.message_unread,
|
||||
message_unread_contents=site_obj.message_unread_contents or [],
|
||||
updated_at=datetime.now().strftime('%Y-%m-%d'),
|
||||
updated_day=datetime.now().strftime('%Y-%m-%d'),
|
||||
err_msg=site_obj.err_msg
|
||||
)
|
||||
|
||||
@@ -675,7 +675,7 @@ class TorrentSpider:
|
||||
elif method_name == "appendleft":
|
||||
text = f"{args}{text}"
|
||||
elif method_name == "querystring":
|
||||
parsed_url = urlparse(text)
|
||||
parsed_url = urlparse(str(text))
|
||||
query_params = parse_qs(parsed_url.query)
|
||||
param_value = query_params.get(args)
|
||||
text = param_value[0] if param_value else ''
|
||||
|
||||
@@ -6,7 +6,7 @@ from app.core.event import eventmanager
|
||||
from app.log import logger
|
||||
from app.modules import _MediaServerBase, _ModuleBase
|
||||
from app.modules.jellyfin.jellyfin import Jellyfin
|
||||
from app.schemas.event import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas.types import MediaType, ModuleType, ChainEventType, MediaServerType
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from app.core.event import eventmanager
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase, _MediaServerBase
|
||||
from app.modules.plex.plex import Plex
|
||||
from app.schemas.event import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas import AuthCredentials, AuthInterceptCredentials
|
||||
from app.schemas.types import MediaType, ModuleType, ChainEventType, MediaServerType
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@ from app.core.event import eventmanager
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase, _MessageBase
|
||||
from app.modules.telegram.telegram import Telegram
|
||||
from app.schemas import MessageChannel, CommingMessage, Notification
|
||||
from app.schemas.event import CommandRegisterEventData
|
||||
from app.schemas import MessageChannel, CommingMessage, Notification, CommandRegisterEventData
|
||||
from app.schemas.types import ModuleType, ChainEventType
|
||||
from app.utils.structures import DictUtils
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ from app.log import logger
|
||||
from app.modules import _ModuleBase, _MessageBase
|
||||
from app.modules.wechat.WXBizMsgCrypt3 import WXBizMsgCrypt
|
||||
from app.modules.wechat.wechat import WeChat
|
||||
from app.schemas import MessageChannel, CommingMessage, Notification
|
||||
from app.schemas.event import CommandRegisterEventData
|
||||
from app.schemas import MessageChannel, CommingMessage, Notification, CommandRegisterEventData
|
||||
from app.schemas.types import ModuleType, ChainEventType
|
||||
from app.utils.dom import DomUtils
|
||||
from app.utils.structures import DictUtils
|
||||
|
||||
@@ -18,3 +18,4 @@ from .system import *
|
||||
from .file import *
|
||||
from .exception import *
|
||||
from .system import *
|
||||
from .event import *
|
||||
|
||||
@@ -89,7 +89,7 @@ class AuthInterceptCredentials(ChainEventData):
|
||||
channel: str = Field(..., description="认证渠道")
|
||||
service: str = Field(..., description="服务名称")
|
||||
status: str = Field(..., description="认证状态, 包含 'triggered' 表示认证触发,'completed' 表示认证成功")
|
||||
token: Optional[str] = Field(None, description="认证令牌")
|
||||
token: Optional[str] = Field(default=None, description="认证令牌")
|
||||
|
||||
# 输出参数
|
||||
source: str = Field(default="未知拦截源", description="拦截源")
|
||||
|
||||
@@ -132,7 +132,7 @@ class MediaServerSeasonInfo(BaseModel):
|
||||
媒体服务器媒体剧集信息
|
||||
"""
|
||||
season: Optional[int] = None
|
||||
episodes: Optional[List[int]] = Field(default_factory=list)
|
||||
episodes: Optional[List[Dict[int, list]]] = Field(default_factory=list)
|
||||
|
||||
|
||||
class WebhookEventInfo(BaseModel):
|
||||
|
||||
@@ -3,55 +3,57 @@ from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class RadarrMovie(BaseModel):
|
||||
id: Optional[int]
|
||||
title: Optional[str]
|
||||
year: Optional[str]
|
||||
id: Optional[int] = None
|
||||
title: Optional[str] = None
|
||||
year: Optional[str] = None
|
||||
isAvailable: bool = False
|
||||
monitored: bool = False
|
||||
tmdbId: Optional[int]
|
||||
imdbId: Optional[str]
|
||||
titleSlug: Optional[str]
|
||||
folderName: Optional[str]
|
||||
path: Optional[str]
|
||||
profileId: Optional[int]
|
||||
qualityProfileId: Optional[int]
|
||||
added: Optional[str]
|
||||
tmdbId: Optional[int] = None
|
||||
imdbId: Optional[str] = None
|
||||
titleSlug: Optional[str] = None
|
||||
folderName: Optional[str] = None
|
||||
path: Optional[str] = None
|
||||
profileId: Optional[int] = None
|
||||
qualityProfileId: Optional[int] = None
|
||||
added: Optional[str] = None
|
||||
hasFile: bool = False
|
||||
|
||||
|
||||
class SonarrSeries(BaseModel):
|
||||
id: Optional[int]
|
||||
title: Optional[str]
|
||||
sortTitle: Optional[str]
|
||||
seasonCount: Optional[int]
|
||||
status: Optional[str]
|
||||
overview: Optional[str]
|
||||
network: Optional[str]
|
||||
airTime: Optional[str]
|
||||
id: Optional[int] = None
|
||||
title: Optional[str] = None
|
||||
sortTitle: Optional[str] = None
|
||||
seasonCount: Optional[int] = None
|
||||
status: Optional[str] = None
|
||||
overview: Optional[str] = None
|
||||
network: Optional[str] = None
|
||||
airTime: Optional[str] = None
|
||||
images: list = Field(default_factory=list)
|
||||
remotePoster: Optional[str]
|
||||
remotePoster: Optional[str] = None
|
||||
seasons: list = Field(default_factory=list)
|
||||
year: Optional[str]
|
||||
path: Optional[str]
|
||||
profileId: Optional[int]
|
||||
languageProfileId: Optional[int]
|
||||
year: Optional[str] = None
|
||||
path: Optional[str] = None
|
||||
profileId: Optional[int] = None
|
||||
languageProfileId: Optional[int] = None
|
||||
seasonFolder: bool = False
|
||||
monitored: bool = False
|
||||
useSceneNumbering: bool = False
|
||||
runtime: Optional[int]
|
||||
tmdbId: Optional[int]
|
||||
imdbId: Optional[str]
|
||||
tvdbId: Optional[int]
|
||||
tvRageId: Optional[int]
|
||||
tvMazeId: Optional[int]
|
||||
firstAired: Optional[str]
|
||||
seriesType: Optional[str]
|
||||
cleanTitle: Optional[str]
|
||||
titleSlug: Optional[str]
|
||||
certification: Optional[str]
|
||||
runtime: Optional[int] = None
|
||||
tmdbId: Optional[int] = None
|
||||
imdbId: Optional[str] = None
|
||||
tvdbId: Optional[int] = None
|
||||
tvRageId: Optional[int] = None
|
||||
tvMazeId: Optional[int] = None
|
||||
firstAired: Optional[str] = None
|
||||
seriesType: Optional[str] = None
|
||||
cleanTitle: Optional[str] = None
|
||||
titleSlug: Optional[str] = None
|
||||
certification: Optional[str] = None
|
||||
genres: list = Field(default_factory=list)
|
||||
tags: list = Field(default_factory=list)
|
||||
added: Optional[str]
|
||||
ratings: Optional[dict]
|
||||
qualityProfileId: Optional[int]
|
||||
added: Optional[str] = None
|
||||
ratings: Optional[dict] = None
|
||||
qualityProfileId: Optional[int] = None
|
||||
statistics: dict = Field(default_factory=dict)
|
||||
isAvailable: Optional[bool] = False
|
||||
hasFile: Optional[bool] = False
|
||||
|
||||
@@ -53,7 +53,7 @@ class Site(BaseModel):
|
||||
|
||||
class SiteStatistic(BaseModel):
|
||||
# 站点ID
|
||||
domain: Optional[str]
|
||||
domain: Optional[str] = None
|
||||
# 成功次数
|
||||
success: Optional[int] = 0
|
||||
# 失败次数
|
||||
@@ -63,7 +63,7 @@ class SiteStatistic(BaseModel):
|
||||
# 最后状态
|
||||
lst_state: Optional[int] = 0
|
||||
# 最后修改时间
|
||||
lst_mod_date: Optional[str]
|
||||
lst_mod_date: Optional[str] = None
|
||||
# 备注
|
||||
note: Optional[Any] = None
|
||||
|
||||
@@ -73,15 +73,15 @@ class SiteStatistic(BaseModel):
|
||||
|
||||
class SiteUserData(BaseModel):
|
||||
# 站点域名
|
||||
domain: Optional[str]
|
||||
domain: Optional[str] = None
|
||||
# 用户名
|
||||
username: Optional[str]
|
||||
username: Optional[str] = None
|
||||
# 用户ID
|
||||
userid: Optional[Union[int, str]]
|
||||
userid: Optional[Union[int, str]] = None
|
||||
# 用户等级
|
||||
user_level: Optional[str]
|
||||
user_level: Optional[str] = None
|
||||
# 加入时间
|
||||
join_at: Optional[str]
|
||||
join_at: Optional[str] = None
|
||||
# 积分
|
||||
bonus: Optional[float] = 0.0
|
||||
# 上传量
|
||||
|
||||
@@ -5,9 +5,6 @@ Revises: ecf3c693fdf3
|
||||
Create Date: 2024-11-14 12:49:13.838120
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import sqlite
|
||||
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.schemas.types import SystemConfigKey
|
||||
|
||||
Reference in New Issue
Block a user