mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refa: video model (#523)
This commit is contained in:
committed by
GitHub
parent
bf464994df
commit
7a6085e923
@@ -1,107 +1,90 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../model_owner.dart';
|
||||
import '../model_video.dart';
|
||||
import 'badge.dart';
|
||||
import 'cursor_attr.dart';
|
||||
import 'three_point.dart';
|
||||
|
||||
part 'item.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Item {
|
||||
String? title;
|
||||
class Item extends BaseSimpleVideoItemModel {
|
||||
String? subtitle;
|
||||
String? tname;
|
||||
String? cover;
|
||||
@JsonKey(name: 'cover_icon')
|
||||
String? get cover => pic; // 不知道哪里使用了cover
|
||||
String? coverIcon;
|
||||
String? uri;
|
||||
String? param;
|
||||
String? goto;
|
||||
String? length;
|
||||
int? duration;
|
||||
@JsonKey(name: 'is_popular')
|
||||
bool? isPopular;
|
||||
@JsonKey(name: 'is_steins')
|
||||
bool? isSteins;
|
||||
@JsonKey(name: 'is_ugcpay')
|
||||
bool? isUgcpay;
|
||||
@JsonKey(name: 'is_cooperation')
|
||||
bool? isCooperation;
|
||||
@JsonKey(name: 'is_pgc')
|
||||
bool? isPgc;
|
||||
@JsonKey(name: 'is_live_playback')
|
||||
bool? isLivePlayback;
|
||||
@JsonKey(name: 'is_pugv')
|
||||
bool? isPugv;
|
||||
@JsonKey(name: 'is_fold')
|
||||
bool? isFold;
|
||||
@JsonKey(name: 'is_oneself')
|
||||
bool? isOneself;
|
||||
int? play;
|
||||
int? danmaku;
|
||||
int? ctime;
|
||||
@JsonKey(name: 'ugc_pay')
|
||||
int? ugcPay;
|
||||
String? author;
|
||||
bool? state;
|
||||
String? bvid;
|
||||
int? videos;
|
||||
@JsonKey(name: 'three_point')
|
||||
List<ThreePoint>? threePoint;
|
||||
@JsonKey(name: 'first_cid')
|
||||
int? firstCid;
|
||||
@JsonKey(name: 'cursor_attr')
|
||||
CursorAttr? cursorAttr;
|
||||
@JsonKey(name: 'view_content')
|
||||
String? viewContent;
|
||||
@JsonKey(name: 'icon_type')
|
||||
int? iconType;
|
||||
@JsonKey(name: 'publish_time_text')
|
||||
String? publishTimeText;
|
||||
List<Badge>? badges;
|
||||
Map? season;
|
||||
Map? history;
|
||||
|
||||
Item({
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.tname,
|
||||
this.cover,
|
||||
this.coverIcon,
|
||||
this.uri,
|
||||
this.param,
|
||||
this.goto,
|
||||
this.length,
|
||||
this.duration,
|
||||
this.isPopular,
|
||||
this.isSteins,
|
||||
this.isUgcpay,
|
||||
this.isCooperation,
|
||||
this.isPgc,
|
||||
this.isLivePlayback,
|
||||
this.isPugv,
|
||||
this.isFold,
|
||||
this.isOneself,
|
||||
this.play,
|
||||
this.danmaku,
|
||||
this.ctime,
|
||||
this.ugcPay,
|
||||
this.author,
|
||||
this.state,
|
||||
this.bvid,
|
||||
this.videos,
|
||||
this.threePoint,
|
||||
this.firstCid,
|
||||
this.cursorAttr,
|
||||
this.viewContent,
|
||||
this.iconType,
|
||||
this.publishTimeText,
|
||||
this.badges,
|
||||
this.season,
|
||||
this.history,
|
||||
});
|
||||
|
||||
factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ItemToJson(this);
|
||||
Item.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
subtitle = json['subtitle'];
|
||||
tname = json['tname'];
|
||||
pic = json['cover'];
|
||||
coverIcon = json['cover_icon'];
|
||||
uri = json['uri'];
|
||||
param = json['param'];
|
||||
goto = json['goto'];
|
||||
length = json['length'];
|
||||
duration = json['duration'] ?? -1;
|
||||
isPopular = json['is_popular'];
|
||||
isSteins = json['is_steins'];
|
||||
isUgcpay = json['is_ugcpay'];
|
||||
isCooperation = json['is_cooperation'];
|
||||
isPgc = json['is_pgc'];
|
||||
isLivePlayback = json['is_live_playback'];
|
||||
isPugv = json['is_pugv'];
|
||||
isFold = json['is_fold'];
|
||||
isOneself = json['is_oneself'];
|
||||
ctime = json['ctime'];
|
||||
ugcPay = json['ugc_pay'];
|
||||
state = json['state'];
|
||||
bvid = json['bvid'];
|
||||
videos = json['videos'];
|
||||
threePoint = (json['three_point'] as List<dynamic>?)
|
||||
?.map((e) => ThreePoint.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
cid = json['first_cid'];
|
||||
cursorAttr = json['cursor_attr'] == null
|
||||
? null
|
||||
: CursorAttr.fromJson(json['cursor_attr'] as Map<String, dynamic>);
|
||||
iconType = json['icon_type'];
|
||||
publishTimeText = json['publish_time_text'];
|
||||
badges = (json['badges'] as List<dynamic>?)
|
||||
?.map((e) => Badge.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
season = json['season'];
|
||||
history = json['history'];
|
||||
stat = PlayStat.fromJson(json);
|
||||
owner = Owner(mid: 0, name: json['author']);
|
||||
}
|
||||
}
|
||||
|
||||
class UserStat extends PlayStat {
|
||||
String? _viewStr;
|
||||
|
||||
@override
|
||||
String get viewStr => _viewStr ?? super.viewStr;
|
||||
|
||||
UserStat.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
||||
_viewStr = json['view_content'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'item.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Item _$ItemFromJson(Map<String, dynamic> json) => Item(
|
||||
title: json['title'] as String?,
|
||||
subtitle: json['subtitle'] as String?,
|
||||
tname: json['tname'] as String?,
|
||||
cover: json['cover'] as String?,
|
||||
coverIcon: json['cover_icon'] as String?,
|
||||
uri: json['uri'] as String?,
|
||||
param: json['param'] as String?,
|
||||
goto: json['goto'] as String?,
|
||||
length: json['length'] as String?,
|
||||
duration: (json['duration'] as num?)?.toInt(),
|
||||
isPopular: json['is_popular'] as bool?,
|
||||
isSteins: json['is_steins'] as bool?,
|
||||
isUgcpay: json['is_ugcpay'] as bool?,
|
||||
isCooperation: json['is_cooperation'] as bool?,
|
||||
isPgc: json['is_pgc'] as bool?,
|
||||
isLivePlayback: json['is_live_playback'] as bool?,
|
||||
isPugv: json['is_pugv'] as bool?,
|
||||
isFold: json['is_fold'] as bool?,
|
||||
isOneself: json['is_oneself'] as bool?,
|
||||
play: (json['play'] as num?)?.toInt(),
|
||||
danmaku: (json['danmaku'] as num?)?.toInt(),
|
||||
ctime: (json['ctime'] as num?)?.toInt(),
|
||||
ugcPay: (json['ugc_pay'] as num?)?.toInt(),
|
||||
author: json['author'] as String?,
|
||||
state: json['state'] as bool?,
|
||||
bvid: json['bvid'] as String?,
|
||||
videos: (json['videos'] as num?)?.toInt(),
|
||||
threePoint: (json['three_point'] as List<dynamic>?)
|
||||
?.map((e) => ThreePoint.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
firstCid: (json['first_cid'] as num?)?.toInt(),
|
||||
cursorAttr: json['cursor_attr'] == null
|
||||
? null
|
||||
: CursorAttr.fromJson(json['cursor_attr'] as Map<String, dynamic>),
|
||||
viewContent: json['view_content'] as String?,
|
||||
iconType: (json['icon_type'] as num?)?.toInt(),
|
||||
publishTimeText: json['publish_time_text'] as String?,
|
||||
badges: (json['badges'] as List<dynamic>?)
|
||||
?.map((e) => Badge.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
season: json['season'],
|
||||
history: json['history'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
|
||||
'title': instance.title,
|
||||
'subtitle': instance.subtitle,
|
||||
'tname': instance.tname,
|
||||
'cover': instance.cover,
|
||||
'cover_icon': instance.coverIcon,
|
||||
'uri': instance.uri,
|
||||
'param': instance.param,
|
||||
'goto': instance.goto,
|
||||
'length': instance.length,
|
||||
'duration': instance.duration,
|
||||
'is_popular': instance.isPopular,
|
||||
'is_steins': instance.isSteins,
|
||||
'is_ugcpay': instance.isUgcpay,
|
||||
'is_cooperation': instance.isCooperation,
|
||||
'is_pgc': instance.isPgc,
|
||||
'is_live_playback': instance.isLivePlayback,
|
||||
'is_pugv': instance.isPugv,
|
||||
'is_fold': instance.isFold,
|
||||
'is_oneself': instance.isOneself,
|
||||
'play': instance.play,
|
||||
'danmaku': instance.danmaku,
|
||||
'ctime': instance.ctime,
|
||||
'ugc_pay': instance.ugcPay,
|
||||
'author': instance.author,
|
||||
'state': instance.state,
|
||||
'bvid': instance.bvid,
|
||||
'videos': instance.videos,
|
||||
'three_point': instance.threePoint,
|
||||
'first_cid': instance.firstCid,
|
||||
'cursor_attr': instance.cursorAttr,
|
||||
'view_content': instance.viewContent,
|
||||
'icon_type': instance.iconType,
|
||||
'publish_time_text': instance.publishTimeText,
|
||||
'badges': instance.badges,
|
||||
'season': instance.season,
|
||||
};
|
||||
Reference in New Issue
Block a user