mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
Merge pull request #4614 from Aqr-K/feature-ua
This commit is contained in:
+2
-2
@@ -13,9 +13,9 @@ from dotenv import set_key
|
|||||||
from pydantic import BaseModel, BaseSettings, validator, Field
|
from pydantic import BaseModel, BaseSettings, validator, Field
|
||||||
|
|
||||||
from app.log import logger, log_settings, LogConfigModel
|
from app.log import logger, log_settings, LogConfigModel
|
||||||
|
from app.schemas import MediaType
|
||||||
from app.utils.system import SystemUtils
|
from app.utils.system import SystemUtils
|
||||||
from app.utils.url import UrlUtils
|
from app.utils.url import UrlUtils
|
||||||
from app.schemas import MediaType
|
|
||||||
from version import APP_VERSION
|
from version import APP_VERSION
|
||||||
|
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel):
|
|||||||
"""
|
"""
|
||||||
全局用户代理字符串
|
全局用户代理字符串
|
||||||
"""
|
"""
|
||||||
return f"{self.PROJECT_NAME}/{APP_VERSION[1:]} ({platform.system()}/{platform.release()})"
|
return f"{self.PROJECT_NAME}/{APP_VERSION[1:]} ({platform.system()} {platform.release()}; {SystemUtils.cpu_arch()})"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def INNER_CONFIG_PATH(self):
|
def INNER_CONFIG_PATH(self):
|
||||||
|
|||||||
+43
-5
@@ -68,35 +68,57 @@ class SystemUtils:
|
|||||||
"""
|
"""
|
||||||
if SystemUtils.is_windows():
|
if SystemUtils.is_windows():
|
||||||
return False
|
return False
|
||||||
return True if "synology" in SystemUtils.execute('uname -a') else False
|
return "synology" in SystemUtils.execute('uname -a')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_windows() -> bool:
|
def is_windows() -> bool:
|
||||||
"""
|
"""
|
||||||
判断是否为Windows系统
|
判断是否为Windows系统
|
||||||
"""
|
"""
|
||||||
return True if os.name == "nt" else False
|
return os.name == "nt"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_frozen() -> bool:
|
def is_frozen() -> bool:
|
||||||
"""
|
"""
|
||||||
判断是否为冻结的二进制文件
|
判断是否为冻结的二进制文件
|
||||||
"""
|
"""
|
||||||
return True if getattr(sys, 'frozen', False) else False
|
return getattr(sys, 'frozen', False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_macos() -> bool:
|
def is_macos() -> bool:
|
||||||
"""
|
"""
|
||||||
判断是否为MacOS系统
|
判断是否为MacOS系统
|
||||||
"""
|
"""
|
||||||
return True if platform.system() == 'Darwin' else False
|
return platform.system() == 'Darwin'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_aarch64() -> bool:
|
def is_aarch64() -> bool:
|
||||||
"""
|
"""
|
||||||
判断是否为ARM64架构
|
判断是否为ARM64架构
|
||||||
"""
|
"""
|
||||||
return True if platform.machine() == 'aarch64' else False
|
return platform.machine().lower() in ('aarch64', 'arm64')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_aarch() -> bool:
|
||||||
|
"""
|
||||||
|
判断是否为ARM32架构
|
||||||
|
"""
|
||||||
|
arch_name = platform.machine().lower()
|
||||||
|
return arch_name.startswith(('arm', 'aarch')) and arch_name not in ('aarch64', 'arm64')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_x86_64() -> bool:
|
||||||
|
"""
|
||||||
|
判断是否为AMD64架构
|
||||||
|
"""
|
||||||
|
return platform.machine().lower() in ('amd64', 'x86_64')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_x86_32() -> bool:
|
||||||
|
"""
|
||||||
|
判断是否为AMD32架构
|
||||||
|
"""
|
||||||
|
return platform.machine().lower() in ('i386', 'i686', 'x86', '386', 'x86_32')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def platform() -> str:
|
def platform() -> str:
|
||||||
@@ -112,6 +134,22 @@ class SystemUtils:
|
|||||||
else:
|
else:
|
||||||
return "Linux"
|
return "Linux"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def cpu_arch() -> str:
|
||||||
|
"""
|
||||||
|
获取CPU架构
|
||||||
|
"""
|
||||||
|
if SystemUtils.is_x86_64():
|
||||||
|
return "x86_64"
|
||||||
|
elif SystemUtils.is_x86_32():
|
||||||
|
return "x86_32"
|
||||||
|
elif SystemUtils.is_aarch64():
|
||||||
|
return "Arm64"
|
||||||
|
elif SystemUtils.is_aarch():
|
||||||
|
return "Arm32"
|
||||||
|
else:
|
||||||
|
return platform.machine()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def copy(src: Path, dest: Path) -> Tuple[int, str]:
|
def copy(src: Path, dest: Path) -> Tuple[int, str]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user