From 5cf7be9e9abb9d8b81f907ff6170999f47d50304 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 6 Jun 2025 07:14:44 +0800 Subject: [PATCH] fix TmdbWallpaper --- package.json | 3 ++- plugins/tmdbwallpaper/__init__.py | 19 ++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 9c5c75b..750afa1 100644 --- a/package.json +++ b/package.json @@ -826,12 +826,13 @@ "name": "登录壁纸本地化", "description": "将MoviePilot的登录壁纸下载到本地。", "labels": "工具", - "version": "1.2", + "version": "1.3", "icon": "Macos_Sierra.png", "author": "jxxghp", "level": 1, "v2": true, "history": { + "v1.3": "适配MoviePilot v2.5.3+版本", "v1.2": "一次性下载多张壁纸", "v1.1": "修复下载Bing每日壁纸时文件名错乱的问题" } diff --git a/plugins/tmdbwallpaper/__init__.py b/plugins/tmdbwallpaper/__init__.py index 86f3e06..300a77e 100644 --- a/plugins/tmdbwallpaper/__init__.py +++ b/plugins/tmdbwallpaper/__init__.py @@ -5,12 +5,11 @@ from typing import Any, List, Dict, Tuple import pytz from apscheduler.schedulers.background import BackgroundScheduler -from app.chain.tmdb import TmdbChain from app.core.config import settings +from app.helper.wallpaper import WallpaperHelper from app.log import logger from app.plugins import _PluginBase from app.utils.http import RequestUtils -from app.utils.web import WebUtils class TmdbWallpaper(_PluginBase): @@ -21,7 +20,7 @@ class TmdbWallpaper(_PluginBase): # 插件图标 plugin_icon = "Macos_Sierra.png" # 插件版本 - plugin_version = "1.2" + plugin_version = "1.3" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -237,13 +236,7 @@ class TmdbWallpaper(_PluginBase): if not self._savepath: return - if settings.WALLPAPER == "tmdb": - urls = TmdbChain().get_trending_wallpapers() or [] - for url in urls: - filename = url.split("/")[-1] - __save_file(url, filename) - else: - url = WebUtils.get_bing_wallpaper() - if url: - filename = f"{datetime.now().strftime('%Y%m%d')}.jpg" - __save_file(url, filename) + urls = WallpaperHelper().get_wallpapers(10) or [] + for url in urls: + filename = url.split("/")[-1] + __save_file(url, filename)