mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-09 03:27:46 +08:00
unify horizontal video models
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import 'package:PiliPlus/models/horizontal_video_model.dart';
|
||||
import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
|
||||
class VListItemModel extends BaseVideoItemModel {
|
||||
class VListItemModel extends HorizontalVideoModel {
|
||||
VListItemModel.fromJson(Map<String, dynamic> json) {
|
||||
cover = json['pic'];
|
||||
desc = json['description'];
|
||||
@@ -14,6 +15,24 @@ class VListItemModel extends BaseVideoItemModel {
|
||||
bvid = json['bvid'];
|
||||
stat = VListStat.fromJson(json);
|
||||
owner = VListOwner.fromJson(json);
|
||||
if (json['is_lesson_video'] == 1) {
|
||||
isPugv = true;
|
||||
badge = '课堂';
|
||||
} else if (json['is_charging_arc'] == true) {
|
||||
badge = '充电专属';
|
||||
} else if (json['is_union_video'] == 1) {
|
||||
badge = '合作';
|
||||
}
|
||||
seasonId = json['season_id'];
|
||||
redirectUrl = json['jump_url'];
|
||||
final position = json['playback_position'] as num?; // percent
|
||||
if (position != null) {
|
||||
if (position == 100) {
|
||||
progress = -1;
|
||||
} else {
|
||||
progress = ((position / 100) * duration).round();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user