opt: model & feat: filter play (#529)

* opt: model

* opt: model

* feat: filter play
This commit is contained in:
My-Responsitories
2025-03-25 22:45:30 +08:00
committed by GitHub
parent 018cd058ca
commit b9adf26ee0
3 changed files with 224 additions and 264 deletions

View File

@@ -6,6 +6,7 @@ import 'storage.dart';
class RecommendFilter {
// static late int filterUnfollowedRatio;
static late int minDurationForRcmd;
static late int minPlayForRcmd;
static late int minLikeRatioForRecommend;
static late bool exemptFilterForFollowed;
static late bool applyFilterToRelatedVideos;
@@ -23,6 +24,7 @@ class RecommendFilter {
// setting.get(SettingBoxKey.filterUnfollowedRatio, defaultValue: 0);
minDurationForRcmd =
setting.get(SettingBoxKey.minDurationForRcmd, defaultValue: 0);
minPlayForRcmd = setting.get(SettingBoxKey.minPlayForRcmd, defaultValue: 0);
minLikeRatioForRecommend =
setting.get(SettingBoxKey.minLikeRatioForRecommend, defaultValue: 0);
exemptFilterForFollowed =
@@ -40,11 +42,13 @@ class RecommendFilter {
}
static bool filterLikeRatio(int? like, int? view) {
return (view != null &&
view > -1 &&
like != null &&
like > -1 &&
like * 100 < minLikeRatioForRecommend * view);
if (view != null) {
return (view > -1 && view < minPlayForRcmd) ||
(like != null &&
like > -1 &&
like * 100 < minLikeRatioForRecommend * view);
}
return false;
}
static bool filterTitle(String title) {

View File

@@ -191,9 +191,6 @@ class GStorage {
defaultValue: CDNService.backupUrl.code,
);
static int get minDurationForRcmd =>
setting.get(SettingBoxKey.minDurationForRcmd, defaultValue: 0);
static String get banWordForRecommend =>
setting.get(SettingBoxKey.banWordForRecommend, defaultValue: '');
@@ -203,9 +200,6 @@ class GStorage {
static String get banWordForZone =>
setting.get(SettingBoxKey.banWordForZone, defaultValue: '');
static int get minLikeRatioForRecommend =>
setting.get(SettingBoxKey.minLikeRatioForRecommend, defaultValue: 0);
static bool get appRcmd =>
setting.get(SettingBoxKey.appRcmd, defaultValue: true);
@@ -636,6 +630,7 @@ class SettingBoxKey {
appRcmd = 'appRcmd',
enableSaveLastData = 'enableSaveLastData',
minDurationForRcmd = 'minDurationForRcmd',
minPlayForRcmd = 'minPlayForRcmd',
minLikeRatioForRecommend = 'minLikeRatioForRecommend',
exemptFilterForFollowed = 'exemptFilterForFollowed',
banWordForRecommend = 'banWordForRecommend',