mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-22 19:51:11 +08:00
feat: merge danmaku
Closes #150 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/grpc/dm/v1/dm.pb.dart';
|
||||
import 'package:PiliPlus/http/danmaku.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
|
||||
class PlDanmakuController {
|
||||
PlDanmakuController(
|
||||
@@ -18,6 +19,8 @@ class PlDanmakuController {
|
||||
|
||||
static int segmentLength = 60 * 6 * 1000;
|
||||
|
||||
late final mergeDanmaku = GStorage.mergeDanmaku;
|
||||
|
||||
void initiate(int videoDuration, int progress) {
|
||||
if (videoDuration <= 0) {
|
||||
return;
|
||||
@@ -45,7 +48,10 @@ class PlDanmakuController {
|
||||
assert(requestedSeg[segmentIndex] == false);
|
||||
requestedSeg[segmentIndex] = true;
|
||||
final DmSegMobileReply result = await DanmakaHttp.queryDanmaku(
|
||||
cid: cid, segmentIndex: segmentIndex + 1);
|
||||
cid: cid,
|
||||
segmentIndex: segmentIndex + 1,
|
||||
mergeDanmaku: mergeDanmaku,
|
||||
);
|
||||
if (result.elems.isNotEmpty) {
|
||||
for (var element in result.elems) {
|
||||
int pos = element.progress ~/ 100; //每0.1秒存储一次
|
||||
|
||||
@@ -1754,6 +1754,14 @@ List<SettingsModel> get extraSettings => [
|
||||
setKey: SettingBoxKey.showVipDanmaku,
|
||||
defaultVal: true,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '合并弹幕',
|
||||
subtitle: '合并一段时间内获取到的相同弹幕',
|
||||
leading: Icon(Icons.merge),
|
||||
setKey: SettingBoxKey.mergeDanmaku,
|
||||
defaultVal: false,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
enableFeedback: true,
|
||||
|
||||
Reference in New Issue
Block a user