fix 软连接重定向

This commit is contained in:
thsrite
2024-10-19 16:10:53 +08:00
parent f0d02d4e63
commit dcd2776b8d
3 changed files with 17 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
47. 命令执行器 v1.2 `自定义容器命令执行。`
48. `-----------------------------`
49. [CloudDrive2助手v1.8.3](docs%2FCd2Assistant.md) `监控上传任务,检测是否有异常,发送通知。`
50. 软连接重定向 v1.1 `重定向软连接指向。`
50. 软连接重定向 v1.2 `重定向软连接指向。`
51. 云盘同步删除 v1.5.4 `媒体库删除软连接文件后,同步删除云盘文件。`
52. 媒体库重复媒体检测 v1.9 `媒体库重复媒体检查,可选保留规则保留其一。`
53. 演员作品订阅 v1.1 `获取TMDB演员作品并自动添加到订阅。`

View File

@@ -647,12 +647,13 @@
"name": "软连接重定向",
"description": "重定向软连接指向。",
"labels": "云盘",
"version": "1.1",
"version": "1.2",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlinkredirect.png",
"author": "thsrite",
"level": 2,
"v2": true,
"history": {
"v1.2": "修复重定向",
"v1.1": "不删除软连接,强制更新重定向",
"v1.0": "重定向软连接指向"
}

View File

@@ -13,7 +13,7 @@ class SoftLinkRedirect(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlinkredirect.png"
# 插件版本
plugin_version = "1.1"
plugin_version = "1.2"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -60,8 +60,9 @@ class SoftLinkRedirect(_PluginBase):
current_target = os.readlink(file_path)
if str(current_target).startswith(target_from):
new_target = current_target.replace(target_from, target_to)
subprocess.run(['ln', '-sf', file_path, new_target])
print(f"Updated symlink: {file_path} -> {new_target}")
result = subprocess.run(['ln', '-sf', new_target, file_path])
logger.info(
f"Updated symlink: {file_path} -> {new_target} ({'success' if result.returncode == 0 else 'failed'})")
@staticmethod
def get_command() -> List[Dict[str, Any]]:
@@ -123,7 +124,6 @@ class SoftLinkRedirect(_PluginBase):
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
},
'content': [
{
@@ -135,11 +135,15 @@ class SoftLinkRedirect(_PluginBase):
}
]
},
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
},
'content': [
{
@@ -151,11 +155,15 @@ class SoftLinkRedirect(_PluginBase):
}
]
},
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
'md': 4
},
'content': [
{