feat: pgc skip

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-08 21:22:02 +08:00
parent 06d8296939
commit ca0eb1716f
13 changed files with 232 additions and 94 deletions

View File

@@ -1,3 +1,5 @@
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
class SegmentItemModel {
String? cid;
String category;
@@ -28,4 +30,21 @@ class SegmentItemModel {
? null
: (json["videoDuration"] as num) * 1000,
);
factory SegmentItemModel.fromPgcJson(
Map<String, dynamic> json,
num? videoDuration,
) => SegmentItemModel(
category: switch (json['clipType']) {
'CLIP_TYPE_OP' => SegmentType.intro.name,
'CLIP_TYPE_ED' => SegmentType.outro.name,
_ => SegmentType.sponsor.name,
},
segment: [
((json['start'] as num) * 1000).round(),
((json['end'] as num) * 1000).round(),
],
uuid: '',
videoDuration: videoDuration,
);
}