mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
feat: pgc skip
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user