mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
refa: sb & feat: sb portVideo (WIP) (#1751)
* refa: sb * feat: sb portVideo (WIP) * fix: keep-alive * revert: ua version * fix * tweak [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
d5d95671ff
commit
2be13e7283
@@ -7,6 +7,7 @@ class SegmentItemModel {
|
||||
List<int> segment;
|
||||
String uuid;
|
||||
num? videoDuration;
|
||||
int votes;
|
||||
|
||||
SegmentItemModel({
|
||||
this.cid,
|
||||
@@ -15,6 +16,7 @@ class SegmentItemModel {
|
||||
required this.segment,
|
||||
required this.uuid,
|
||||
this.videoDuration,
|
||||
this.votes = 0,
|
||||
});
|
||||
|
||||
factory SegmentItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -29,6 +31,7 @@ class SegmentItemModel {
|
||||
videoDuration: json["videoDuration"] == null
|
||||
? null
|
||||
: (json["videoDuration"] as num) * 1000,
|
||||
votes: json["votes"],
|
||||
);
|
||||
|
||||
factory SegmentItemModel.fromPgcJson(
|
||||
|
||||
33
lib/models_new/sponsor_block/user_info.dart
Normal file
33
lib/models_new/sponsor_block/user_info.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
|
||||
class UserInfo {
|
||||
final int viewCount;
|
||||
final double minutesSaved;
|
||||
final int segmentCount;
|
||||
|
||||
const UserInfo({
|
||||
required this.viewCount,
|
||||
required this.minutesSaved,
|
||||
required this.segmentCount,
|
||||
});
|
||||
|
||||
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
|
||||
viewCount: json['viewCount'],
|
||||
minutesSaved: (json['minutesSaved'] as num).toDouble(),
|
||||
segmentCount: json['segmentCount'],
|
||||
);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
String minutes = DurationUtils.formatTimeDuration(
|
||||
Duration(minutes: minutesSaved.round()),
|
||||
);
|
||||
if (minutes.isEmpty) {
|
||||
minutes = '0分钟';
|
||||
}
|
||||
return ('您提交了 ${NumUtils.formatPositiveDecimal(segmentCount)} 片段\n'
|
||||
'您为大家节省了 ${NumUtils.formatPositiveDecimal(viewCount)} 片段\n'
|
||||
'($minutes 的生命)');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user