mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 新增视频标题本地关键词过滤
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ class SettingBoxKey {
|
||||
minDurationForRcmd = 'minDurationForRcmd',
|
||||
minLikeRatioForRecommend = 'minLikeRatioForRecommend',
|
||||
exemptFilterForFollowed = 'exemptFilterForFollowed',
|
||||
banWordForRecommend = 'banWordForRecommend',
|
||||
//filterUnfollowedRatio = 'filterUnfollowedRatio',
|
||||
applyFilterToRelatedVideos = 'applyFilterToRelatedVideos',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user