diff --git a/src/BiliLite.UWP/Models/Common/Enumerates.cs b/src/BiliLite.UWP/Models/Common/Enumerates.cs index 1106d71c..ffc92e0a 100644 --- a/src/BiliLite.UWP/Models/Common/Enumerates.cs +++ b/src/BiliLite.UWP/Models/Common/Enumerates.cs @@ -514,5 +514,6 @@ public enum FilterContentType { Title, User, + Desc, } } \ No newline at end of file diff --git a/src/BiliLite.UWP/Models/Common/Settings/FilterRuleTypes.cs b/src/BiliLite.UWP/Models/Common/Settings/FilterRuleTypes.cs index e713190b..893c3b13 100644 --- a/src/BiliLite.UWP/Models/Common/Settings/FilterRuleTypes.cs +++ b/src/BiliLite.UWP/Models/Common/Settings/FilterRuleTypes.cs @@ -13,6 +13,7 @@ public class FilterRuleTypes { new FilterTargetOption(FilterContentType.Title, "标题"), new FilterTargetOption(FilterContentType.User, "用户"), + new FilterTargetOption(FilterContentType.Desc, "详情"), }; } diff --git a/src/BiliLite.UWP/Modules/SearchVM.cs b/src/BiliLite.UWP/Modules/SearchVM.cs index 08dc5303..085e58a3 100644 --- a/src/BiliLite.UWP/Modules/SearchVM.cs +++ b/src/BiliLite.UWP/Modules/SearchVM.cs @@ -852,6 +852,7 @@ public string pic set { _pic = "https:" + value; } } + public string Description { get; set; } } public class SearchAnimeItem { diff --git a/src/BiliLite.UWP/Services/ContentFilterService.cs b/src/BiliLite.UWP/Services/ContentFilterService.cs index 79b312ed..3449c8e0 100644 --- a/src/BiliLite.UWP/Services/ContentFilterService.cs +++ b/src/BiliLite.UWP/Services/ContentFilterService.cs @@ -168,6 +168,12 @@ public List FilterSearchItems(List searchItems FilterType.Regular => current.Where(x => !new Regex(rule.Rule).IsMatch(x.author)), _ => current }, + FilterContentType.Desc => rule.FilterType switch + { + FilterType.Word => current.Where(x => !x.Description.Contains(rule.Rule)), + FilterType.Regular => current.Where(x => !new Regex(rule.Rule).IsMatch(x.Description)), + _ => current + }, _ => current }); @@ -198,6 +204,18 @@ public List FilterDynamicItems(List current.Where(x => !(x.Author != null && new Regex(rule.Rule).IsMatch(x.Author.Author.Name))), _ => current }, + FilterContentType.Desc => rule.FilterType switch + { + FilterType.Word => current.Where(x => !(x.ContentStr != null && x.ContentStr.Contains(rule.Rule))), + FilterType.Regular => current.Where(x => !(x.ContentStr != null && new Regex(rule.Rule).IsMatch(x.ContentStr))), + _ => current + }, + FilterContentType.Title => rule.FilterType switch + { + FilterType.Word => current.Where(x => !(x.ManuscriptTitle.Contains(rule.Rule))), + FilterType.Regular => current.Where(x => !(new Regex(rule.Rule).IsMatch(x.ManuscriptTitle))), + _ => current + }, _ => current }); diff --git a/src/BiliLite.UWP/ViewModels/Settings/FilterRuleViewModel.cs b/src/BiliLite.UWP/ViewModels/Settings/FilterRuleViewModel.cs index ee20292f..508891ca 100644 --- a/src/BiliLite.UWP/ViewModels/Settings/FilterRuleViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Settings/FilterRuleViewModel.cs @@ -43,7 +43,11 @@ public string FilterContentTypeDesc var desc = "选择过滤目标对象属性"; if (FilterRuleType == FilterRuleType.Dynamic) { - return desc + "(动态不支持过滤标题)"; + return desc + "(动态项过滤标题指过滤投稿标题)"; + } + if (FilterRuleType == FilterRuleType.Recommend) + { + return desc + "(推荐项不支持过滤详情)"; } return desc; diff --git a/src/BiliLite.UWP/ViewModels/UserDynamic/DynamicV2ItemViewModel.cs b/src/BiliLite.UWP/ViewModels/UserDynamic/DynamicV2ItemViewModel.cs index c23e95f1..8a0d45ee 100644 --- a/src/BiliLite.UWP/ViewModels/UserDynamic/DynamicV2ItemViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/UserDynamic/DynamicV2ItemViewModel.cs @@ -25,6 +25,46 @@ public DynamicV2ItemViewModel() m_mapper = App.ServiceProvider.GetRequiredService(); } + [DoNotNotify] + public string ManuscriptTitle + { + get + { + // Dynamic.DynArchive.Title + if (Dynamic is { DynArchive: { }}) + { + return Dynamic.DynArchive.Title; + } + // Extend.OrigDesc[0].Text + if (Extend is { OrigDesc: { } } && Extend.OrigDesc.Count > 0) + { + return Extend.OrigDesc[0].Text; + } + // LiveInfo.PlayInfo.Title + if (LiveInfo is { PlayInfo: { } }) + { + return LiveInfo.PlayInfo.Title; + } + // Dynamic.DynCourBatchUp.Title + if (Dynamic is { DynCourBatchUp: { } }) + { + return Dynamic.DynCourBatchUp.Title; + } + // Season.Title + if (Season is { }) + { + return Season.Title; + } + // CustomArticle.Title + if (CustomArticle is { }) + { + return CustomArticle.Title; + } + + return ""; + } + } + public IUserDynamicCommands Parent { get; set; } public string CardType { get; set; } @@ -133,6 +173,45 @@ public ModuleStat Stat [DependsOn(nameof(Content))] public bool ShowContent => Desc != null || OpusSummary != null; + [DoNotNotify] + public string ContentStr + { + get + { + if (Extend.OpusSummary != null && Extend.OpusSummary.Summary.Text != null) + { + var text = ""; + if (Extend.OpusSummary.Title != null) + { + var title = Extend.OpusSummary.Title.Text.Nodes + .Aggregate("", (current, textNode) => current + textNode.RawText); + text = title + "\n"; + } + + text += Extend.OpusSummary.Summary.Text.Nodes + .Aggregate("", (current, textNode) => current + textNode.RawText); + + return text; + } + + if (Desc != null) + { + return + Desc.Text; + } + + if (OpusSummary != null) + { + var text = OpusSummary.Summary.Text.Nodes.Aggregate("", (current, textNode) => current + textNode.RawText); + + return + text; + } + + return ""; + } + } + [DependsOn(nameof(Desc),nameof(OpusSummary))] public RichTextBlock Content {