mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: danmaku filter (#486)
This commit is contained in:
committed by
GitHub
parent
066f3d4132
commit
99b14d0f0e
@@ -69,21 +69,13 @@ class PlDanmakuController {
|
||||
queryDanmaku(segmentIndex);
|
||||
}
|
||||
if (plPlayerController.danmakuWeight == 0 &&
|
||||
plPlayerController.filterCount == 0) {
|
||||
plPlayerController.filters.count == 0) {
|
||||
return dmSegMap[progress ~/ 100];
|
||||
} else {
|
||||
return dmSegMap[progress ~/ 100]
|
||||
?.where(
|
||||
(element) => element.weight >= plPlayerController.danmakuWeight)
|
||||
.where(filterDanmaku)
|
||||
.toList();
|
||||
?..retainWhere((element) =>
|
||||
element.weight >= plPlayerController.danmakuWeight &&
|
||||
plPlayerController.filters.retain(element));
|
||||
}
|
||||
}
|
||||
|
||||
bool filterDanmaku(DanmakuElem elem) {
|
||||
return !(plPlayerController.dmUid.contains(elem.midHash) ||
|
||||
plPlayerController.dmFilterString
|
||||
.any((i) => elem.content.contains(i)) ||
|
||||
plPlayerController.dmRegExp.any((i) => i.hasMatch(elem.content)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user