Skip to content

Commit 16acef3

Browse files
committed
fix: 完善计划任务描述(时间窗口/数量)
1 parent 41af7b7 commit 16acef3

File tree

8 files changed

+379
-62
lines changed

8 files changed

+379
-62
lines changed

Configuration/GitHubOptions.cs

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,75 @@
1+
using System;
2+
using System.Collections.Generic;
13
using System.ComponentModel;
24
using Emby.Web.GenericEdit;
5+
using Emby.Web.GenericEdit.Editors;
6+
using MediaBrowser.Model.GenericEdit;
37

48
namespace MediaInfoKeeper.Configuration
59
{
610
public class GitHubOptions : EditableOptionsBase
711
{
812
public override string EditorTitle => "GitHub";
913

14+
[DisplayName("GitHub 访问令牌")]
15+
[Description("设置后使用 Token 获取 Releases,避免未认证请求的限流。")]
16+
public string GitHubToken { get; set; } = string.Empty;
17+
1018
[DisplayName("项目地址")]
19+
[Description("项目初期,有许多不完善的地方,请及时关注更新。")]
1120
public string ProjectUrl { get; set; } = "https://github.com/honue/MediaInfoKeeper";
12-
13-
[DisplayName("最新版本")]
14-
[Description("从 GitHub Releases 获取最新版本号。项目初期,有许多不完善的地方,请及时关注更新。")]
15-
public string LatestReleaseVersion { get; set; } = "加载中";
16-
21+
1722
[DisplayName("当前版本")]
1823
[Description("计划任务可以更新插件。")]
1924
public string CurrentVersion { get; set; } = "未知";
25+
26+
[DisplayName("最新版本")]
27+
[Description("从 GitHub Releases 获取最新版本号。")]
28+
public string LatestReleaseVersion { get; set; } = "加载中";
2029

30+
[DisplayName("更新说明")]
31+
public string ReleaseHistoryBody { get; set; } = "加载中";
2132

22-
[DisplayName("GitHub 访问令牌")]
23-
[Description("设置后使用 Token 获取 Releases,避免未认证请求的限流。")]
24-
public string GitHubToken { get; set; } = string.Empty;
33+
public override IEditObjectContainer CreateEditContainer()
34+
{
35+
var container = (EditObjectContainer)base.CreateEditContainer();
36+
var root = container.EditorRoot;
37+
if (root?.EditorItems == null || root.EditorItems.Length == 0)
38+
{
39+
return container;
40+
}
41+
42+
var items = new List<EditorBase>(root.EditorItems.Length);
43+
foreach (var item in root.EditorItems)
44+
{
45+
var key = item.Name ?? item.Id;
46+
if (item is EditorText text)
47+
{
48+
if (string.Equals(key, nameof(ReleaseHistoryBody), StringComparison.OrdinalIgnoreCase))
49+
{
50+
text.IsReadOnly = true;
51+
text.MultiLine = true;
52+
text.LineCount = 12;
53+
text.AllowEmpty = true;
54+
}
55+
else if (string.Equals(key, nameof(ProjectUrl), StringComparison.OrdinalIgnoreCase))
56+
{
57+
text.IsReadOnly = true;
58+
text.AllowEmpty = true;
59+
}
60+
else if (string.Equals(key, nameof(LatestReleaseVersion), StringComparison.OrdinalIgnoreCase) ||
61+
string.Equals(key, nameof(CurrentVersion), StringComparison.OrdinalIgnoreCase))
62+
{
63+
text.IsReadOnly = true;
64+
text.AllowEmpty = true;
65+
}
66+
}
67+
68+
items.Add(item);
69+
}
2570

71+
root.EditorItems = items.ToArray();
72+
return container;
73+
}
2674
}
2775
}

Configuration/IntroSkipOptions.cs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.ComponentModel;
34
using Emby.Web.GenericEdit;
45
using Emby.Web.GenericEdit.Common;
6+
using Emby.Web.GenericEdit.Editors;
7+
using MediaBrowser.Model.GenericEdit;
58
using MediaBrowser.Model.Attributes;
69

710
namespace MediaInfoKeeper.Configuration
@@ -69,5 +72,93 @@ public class IntroSkipOptions : EditableOptionsBase
6972
[Description("允许触发打标的用户 ID,逗号或分号分隔;留空表示所有用户。")]
7073
public string UserScope { get; set; } = string.Empty;
7174

75+
public override IEditObjectContainer CreateEditContainer()
76+
{
77+
var container = (EditObjectContainer)base.CreateEditContainer();
78+
var root = container.EditorRoot;
79+
if (root?.EditorItems == null || root.EditorItems.Length == 0)
80+
{
81+
return container;
82+
}
83+
84+
var itemLookup = new Dictionary<string, EditorBase>(StringComparer.OrdinalIgnoreCase);
85+
foreach (var item in root.EditorItems)
86+
{
87+
var key = item.Name ?? item.Id;
88+
if (string.IsNullOrEmpty(key))
89+
{
90+
continue;
91+
}
92+
93+
if (!itemLookup.ContainsKey(key))
94+
{
95+
itemLookup.Add(key, item);
96+
}
97+
}
98+
99+
var groupedItems = new List<EditorBase>();
100+
var groupIndex = 0;
101+
102+
void AddGroup(string title, params string[] propertyNames)
103+
{
104+
var items = new List<EditorBase>();
105+
foreach (var propertyName in propertyNames)
106+
{
107+
if (itemLookup.TryGetValue(propertyName, out var item))
108+
{
109+
items.Add(item);
110+
itemLookup.Remove(propertyName);
111+
}
112+
}
113+
114+
if (items.Count == 0)
115+
{
116+
return;
117+
}
118+
119+
groupIndex++;
120+
groupedItems.Add(new EditorGroup(title, items.ToArray(), $"group{groupIndex}", root.Id, null));
121+
}
122+
123+
AddGroup("扫描片头",
124+
nameof(UnlockIntroSkip),
125+
nameof(ScanIntroOnItemAdded),
126+
nameof(ProtectIntroMarkers));
127+
128+
AddGroup("播放行为打标",
129+
nameof(EnableIntroSkip),
130+
nameof(MaxIntroDurationSeconds),
131+
nameof(MaxCreditsDurationSeconds),
132+
nameof(MinOpeningPlotDurationSeconds),
133+
nameof(IntroDetectionFingerprintMinutes),
134+
nameof(MarkerEnabledLibraryScope),
135+
nameof(LibraryScope),
136+
nameof(UserScope));
137+
138+
var remaining = new List<EditorBase>();
139+
foreach (var item in root.EditorItems)
140+
{
141+
var key = item.Name ?? item.Id;
142+
if (!string.IsNullOrEmpty(key) && itemLookup.ContainsKey(key))
143+
{
144+
remaining.Add(item);
145+
itemLookup.Remove(key);
146+
}
147+
}
148+
149+
if (remaining.Count > 0)
150+
{
151+
groupIndex++;
152+
groupedItems.Add(new EditorGroup("其他", remaining.ToArray(), $"group{groupIndex}", root.Id, null));
153+
}
154+
155+
if (groupedItems.Count > 0)
156+
{
157+
root.EditorItems = groupedItems.ToArray();
158+
}
159+
160+
return container;
161+
}
162+
72163
}
73164
}

Configuration/MainPageOptions.cs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.ComponentModel;
34
using Emby.Web.GenericEdit;
45
using Emby.Web.GenericEdit.Common;
56
using Emby.Web.GenericEdit.Editors;
7+
using MediaBrowser.Model.GenericEdit;
68
using MediaBrowser.Model.Attributes;
79

810
namespace MediaInfoKeeper.Configuration
@@ -91,5 +93,96 @@ public class MainPageOptions : EditableOptionsBase
9193
[EditMultilSelect]
9294
[SelectItemsSource(nameof(RefreshImageModeOptions))]
9395
public string RefreshImageMode { get; set; } = "Fill";
96+
97+
public override IEditObjectContainer CreateEditContainer()
98+
{
99+
var container = (EditObjectContainer)base.CreateEditContainer();
100+
var root = container.EditorRoot;
101+
if (root?.EditorItems == null || root.EditorItems.Length == 0)
102+
{
103+
return container;
104+
}
105+
106+
var itemLookup = new Dictionary<string, EditorBase>(StringComparer.OrdinalIgnoreCase);
107+
foreach (var item in root.EditorItems)
108+
{
109+
var key = item.Name ?? item.Id;
110+
if (string.IsNullOrEmpty(key))
111+
{
112+
continue;
113+
}
114+
115+
if (!itemLookup.ContainsKey(key))
116+
{
117+
itemLookup.Add(key, item);
118+
}
119+
}
120+
121+
var groupedItems = new List<EditorBase>();
122+
var groupIndex = 0;
123+
124+
void AddGroup(string title, params string[] propertyNames)
125+
{
126+
var items = new List<EditorBase>();
127+
foreach (var propertyName in propertyNames)
128+
{
129+
if (itemLookup.TryGetValue(propertyName, out var item))
130+
{
131+
items.Add(item);
132+
itemLookup.Remove(propertyName);
133+
}
134+
}
135+
136+
if (items.Count == 0)
137+
{
138+
return;
139+
}
140+
141+
groupIndex++;
142+
groupedItems.Add(new EditorGroup(title, items.ToArray(), $"group{groupIndex}", root.Id, null));
143+
}
144+
145+
AddGroup("基本设置",
146+
nameof(PersistMediaInfoEnabled),
147+
nameof(DeleteMediaInfoJsonOnRemove),
148+
nameof(DisableSystemFfprobe),
149+
nameof(EnableMetadataProvidersWatcher),
150+
nameof(MediaInfoJsonRootFolder),
151+
nameof(MaxConcurrentCount));
152+
153+
AddGroup("媒体库范围",
154+
nameof(CatchupLibraries),
155+
nameof(ScheduledTaskLibraries));
156+
157+
AddGroup("计划任务",
158+
nameof(RecentItemsDays),
159+
nameof(RecentItemsLimit),
160+
nameof(RefreshMetadataMode),
161+
nameof(RefreshImageMode));
162+
163+
var remaining = new List<EditorBase>();
164+
foreach (var item in root.EditorItems)
165+
{
166+
var key = item.Name ?? item.Id;
167+
if (!string.IsNullOrEmpty(key) && itemLookup.ContainsKey(key))
168+
{
169+
remaining.Add(item);
170+
itemLookup.Remove(key);
171+
}
172+
}
173+
174+
if (remaining.Count > 0)
175+
{
176+
groupIndex++;
177+
groupedItems.Add(new EditorGroup("其他", remaining.ToArray(), $"group{groupIndex}", root.Id, null));
178+
}
179+
180+
if (groupedItems.Count > 0)
181+
{
182+
root.EditorItems = groupedItems.ToArray();
183+
}
184+
185+
return container;
186+
}
94187
}
95188
}

MediaInfoKeeper.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<Description>MediaInfoKeeper Emby plugin</Description>
55
<PackageTags>emby;plugin;pms;media;server;</PackageTags>
66
<BaseOutputPath>Build\bin\</BaseOutputPath>
7-
<AssemblyVersion>1.5.3.0</AssemblyVersion>
8-
<FileVersion>1.5.3.0</FileVersion>
9-
<Version>1.5.3</Version>
7+
<AssemblyVersion>1.5.4.0</AssemblyVersion>
8+
<FileVersion>1.5.4.0</FileVersion>
9+
<Version>1.5.4</Version>
1010
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1111
</PropertyGroup>
1212
<ItemGroup>

0 commit comments

Comments
 (0)