mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: hot: filter like ratio
Closes #108 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -168,7 +168,9 @@ class VideoHttp {
|
|||||||
List<int> blackMidsList = GStorage.blackMidsList;
|
List<int> blackMidsList = GStorage.blackMidsList;
|
||||||
for (var i in res.data['data']['list']) {
|
for (var i in res.data['data']['list']) {
|
||||||
if (!blackMidsList.contains(i['owner']['mid']) &&
|
if (!blackMidsList.contains(i['owner']['mid']) &&
|
||||||
!RecommendFilter.filterTitle(i['title'])) {
|
!RecommendFilter.filterTitle(i['title']) &&
|
||||||
|
!RecommendFilter.filterLikeRatio(
|
||||||
|
i['stat']['like'], i['stat']['view'])) {
|
||||||
list.add(HotVideoItemModel.fromJson(i));
|
list.add(HotVideoItemModel.fromJson(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,7 @@ class RecommendFilter {
|
|||||||
if (videoItem.duration > 0 && videoItem.duration < minDurationForRcmd) {
|
if (videoItem.duration > 0 && videoItem.duration < minDurationForRcmd) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (videoItem.stat.view is int &&
|
if (filterLikeRatio(videoItem.stat.like, videoItem.stat.view)) {
|
||||||
videoItem.stat.view > -1 &&
|
|
||||||
videoItem.stat.like is int &&
|
|
||||||
videoItem.stat.like > -1 &&
|
|
||||||
videoItem.stat.like * 100 <
|
|
||||||
minLikeRatioForRecommend * videoItem.stat.view) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (filterTitle(videoItem.title)) {
|
if (filterTitle(videoItem.title)) {
|
||||||
@@ -57,6 +52,17 @@ class RecommendFilter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool filterLikeRatio(like, view) {
|
||||||
|
if (view is int &&
|
||||||
|
view > -1 &&
|
||||||
|
like is int &&
|
||||||
|
like > -1 &&
|
||||||
|
like * 100 < minLikeRatioForRecommend * view) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool filterTitle(String title, {bool? isFollowed}) {
|
static bool filterTitle(String title, {bool? isFollowed}) {
|
||||||
if (exemptFilterForFollowed && isFollowed == true) {
|
if (exemptFilterForFollowed && isFollowed == true) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user