feat: 新增视频标题本地关键词过滤

This commit is contained in:
orz12
2024-09-08 22:42:32 +08:00
committed by bggRGjQaUbCoE
parent a4a1cb1371
commit 545140dbeb
3 changed files with 71 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ class RecommendFilter {
static late int minLikeRatioForRecommend;
static late bool exemptFilterForFollowed;
static late bool applyFilterToRelatedVideos;
static late List<String> banWordList;
RecommendFilter() {
update();
}
@@ -20,6 +21,9 @@ class RecommendFilter {
setting.get(SettingBoxKey.minDurationForRcmd, defaultValue: 0);
minLikeRatioForRecommend =
setting.get(SettingBoxKey.minLikeRatioForRecommend, defaultValue: 0);
banWordList = (setting.get(SettingBoxKey.banWordForRecommend,
defaultValue: '') as String)
.split(' ');
exemptFilterForFollowed =
setting.get(SettingBoxKey.exemptFilterForFollowed, defaultValue: true);
applyFilterToRelatedVideos = setting
@@ -47,6 +51,9 @@ class RecommendFilter {
minLikeRatioForRecommend * videoItem.stat.view) {
return true;
}
for (var word in banWordList) {
if (word.isNotEmpty && videoItem.title.contains(word)) return true;
}
return false;
}
}

View File

@@ -170,6 +170,7 @@ class SettingBoxKey {
minDurationForRcmd = 'minDurationForRcmd',
minLikeRatioForRecommend = 'minLikeRatioForRecommend',
exemptFilterForFollowed = 'exemptFilterForFollowed',
banWordForRecommend = 'banWordForRecommend',
//filterUnfollowedRatio = 'filterUnfollowedRatio',
applyFilterToRelatedVideos = 'applyFilterToRelatedVideos',