fix TmdbWallpaper

This commit is contained in:
jxxghp
2025-06-09 20:16:11 +08:00
parent 314f6c1f8d
commit 8d8c7b88a8
2 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
from datetime import datetime, timedelta
from pathlib import Path
from typing import Any, List, Dict, Tuple
from urllib.parse import urlparse
from urllib.parse import urlparse, parse_qs
import pytz
from apscheduler.schedulers.background import BackgroundScheduler
@@ -21,7 +21,7 @@ class TmdbWallpaper(_PluginBase):
# 插件图标
plugin_icon = "Macos_Sierra.png"
# 插件版本
plugin_version = "1.4"
plugin_version = "1.4.1"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -242,12 +242,13 @@ class TmdbWallpaper(_PluginBase):
if settings.WALLPAPER == "tmdb":
filename = url.split("/")[-1]
elif settings.WALLPAPER == "bing":
# https://cn.bing.com/th?id=OHR.EchinaceaButterfly_EN-US8404044892_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp
# 解析url参数获取id的值
url_params = urlparse(url)
filename = url_params.query.split("id=")[-1]
parsed_url = urlparse(url)
query_params = parse_qs(parsed_url.query)
param_value = query_params.get("id")
filename = param_value[0] if param_value else None
else:
# 其他壁纸类型直接使用url的文件名
# 其他壁纸类型直接使用url的文件名hash
filename = url.split("/")[-1]
# 没有后缀的文件名,添加.jpg后缀
if not filename.endswith(".jpg"):