mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
refa: live page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
73
lib/models/live/live_room/danmu_info.dart
Normal file
73
lib/models/live/live_room/danmu_info.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
class LiveDanmakuInfo {
|
||||
String message;
|
||||
int ttl, code;
|
||||
DanmakuInfoData data;
|
||||
LiveDanmakuInfo(
|
||||
{required this.code,
|
||||
required this.message,
|
||||
required this.ttl,
|
||||
required this.data});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LiveDanmakuInfo{code: $code, message: $message, ttl: $ttl, data: $data}';
|
||||
}
|
||||
|
||||
factory LiveDanmakuInfo.fromJson(dynamic json) {
|
||||
List<HostInfo> hostList = [];
|
||||
for (var host in json['data']['host_list']) {
|
||||
hostList.add(HostInfo(
|
||||
host: host['host'],
|
||||
port: host['port'],
|
||||
wssPort: host['wss_port'],
|
||||
wsPort: host['ws_port']));
|
||||
}
|
||||
return LiveDanmakuInfo(
|
||||
code: json['code'],
|
||||
message: json['message'],
|
||||
ttl: json['ttl'],
|
||||
data: DanmakuInfoData(
|
||||
group: json['data']['group'],
|
||||
businessId: json['data']['business_id'],
|
||||
ttl: json['data']['ttl'] ?? 0,
|
||||
refreshRate: json['data']['refresh_rate'],
|
||||
maxDelay: json['data']['max_delay'],
|
||||
token: json['data']['token'],
|
||||
hostList: hostList));
|
||||
}
|
||||
}
|
||||
|
||||
class DanmakuInfoData {
|
||||
String group;
|
||||
int businessId, ttl, refreshRate, maxDelay;
|
||||
String token;
|
||||
List<HostInfo> hostList;
|
||||
DanmakuInfoData(
|
||||
{required this.group,
|
||||
required this.businessId,
|
||||
required this.ttl,
|
||||
required this.refreshRate,
|
||||
required this.maxDelay,
|
||||
required this.token,
|
||||
required this.hostList});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DanmakuInfoData{group: $group, businessId: $businessId, ttl: $ttl, refreshRate: $refreshRate, maxDelay: $maxDelay, token: $token, hostList: $hostList}';
|
||||
}
|
||||
}
|
||||
|
||||
class HostInfo {
|
||||
String host;
|
||||
int port, wssPort, wsPort;
|
||||
HostInfo(
|
||||
{required this.host,
|
||||
required this.port,
|
||||
required this.wssPort,
|
||||
required this.wsPort});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HostInfo{host: $host, port: $port, wssPort: $wssPort, wsPort: $wsPort}';
|
||||
}
|
||||
}
|
||||
77
lib/models/live/live_room/item.dart
Normal file
77
lib/models/live/live_room/item.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
class LiveItemModel {
|
||||
LiveItemModel({
|
||||
this.roomId,
|
||||
this.uid,
|
||||
this.title,
|
||||
this.uname,
|
||||
this.online,
|
||||
this.userCover,
|
||||
this.userCoverFlag,
|
||||
this.systemCover,
|
||||
this.cover,
|
||||
this.pic,
|
||||
this.link,
|
||||
this.face,
|
||||
this.parentId,
|
||||
this.parentName,
|
||||
this.areaId,
|
||||
this.areaName,
|
||||
this.sessionId,
|
||||
this.groupId,
|
||||
this.pkId,
|
||||
this.verify,
|
||||
this.headBox,
|
||||
this.headBoxType,
|
||||
this.watchedShow,
|
||||
});
|
||||
|
||||
int? roomId;
|
||||
int? uid;
|
||||
String? title;
|
||||
String? uname;
|
||||
int? online;
|
||||
String? userCover;
|
||||
int? userCoverFlag;
|
||||
String? systemCover;
|
||||
String? cover;
|
||||
String? pic;
|
||||
String? link;
|
||||
String? face;
|
||||
int? parentId;
|
||||
String? parentName;
|
||||
int? areaId;
|
||||
String? areaName;
|
||||
String? sessionId;
|
||||
int? groupId;
|
||||
int? pkId;
|
||||
Map? verify;
|
||||
Map? headBox;
|
||||
int? headBoxType;
|
||||
Map? watchedShow;
|
||||
|
||||
LiveItemModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['roomid'];
|
||||
uid = json['uid'];
|
||||
title = json['title'];
|
||||
uname = json['uname'];
|
||||
online = json['online'];
|
||||
userCover = json['user_cover'];
|
||||
userCoverFlag = json['user_cover_flag'];
|
||||
systemCover = json['system_cover'];
|
||||
cover = json['cover'];
|
||||
pic = json['cover'];
|
||||
link = json['link'];
|
||||
face = json['face'];
|
||||
parentId = json['parent_id'];
|
||||
parentName = json['parent_name'];
|
||||
areaId = json['area_id'];
|
||||
areaName = json['area_name'];
|
||||
sessionId = json['session_id'];
|
||||
groupId = json['group_id'];
|
||||
pkId = json['pk_id'];
|
||||
verify = json['verify'];
|
||||
headBox = json['head_box'];
|
||||
headBoxType = json['head_box_type'];
|
||||
watchedShow = json['watched_show'];
|
||||
}
|
||||
}
|
||||
163
lib/models/live/live_room/room_info.dart
Normal file
163
lib/models/live/live_room/room_info.dart
Normal file
@@ -0,0 +1,163 @@
|
||||
class RoomInfoModel {
|
||||
RoomInfoModel({
|
||||
this.roomId,
|
||||
this.liveStatus,
|
||||
this.liveTime,
|
||||
this.playurlInfo,
|
||||
});
|
||||
int? roomId;
|
||||
int? liveStatus;
|
||||
int? liveTime;
|
||||
PlayurlInfo? playurlInfo;
|
||||
bool? isPortrait;
|
||||
|
||||
RoomInfoModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['room_id'];
|
||||
liveStatus = json['live_status'];
|
||||
liveTime = json['live_time'];
|
||||
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
||||
isPortrait = json['is_portrait'];
|
||||
}
|
||||
}
|
||||
|
||||
class PlayurlInfo {
|
||||
PlayurlInfo({
|
||||
this.playurl,
|
||||
});
|
||||
|
||||
Playurl? playurl;
|
||||
|
||||
PlayurlInfo.fromJson(Map<String, dynamic> json) {
|
||||
playurl = Playurl.fromJson(json['playurl']);
|
||||
}
|
||||
}
|
||||
|
||||
class Playurl {
|
||||
Playurl({
|
||||
this.cid,
|
||||
this.gQnDesc,
|
||||
this.stream,
|
||||
});
|
||||
|
||||
int? cid;
|
||||
List<GQnDesc>? gQnDesc;
|
||||
List<Streams>? stream;
|
||||
|
||||
Playurl.fromJson(Map<String, dynamic> json) {
|
||||
cid = json['cid'];
|
||||
gQnDesc = (json['g_qn_desc'] as List?)
|
||||
?.map<GQnDesc>((e) => GQnDesc.fromJson(e))
|
||||
.toList();
|
||||
stream = (json['stream'] as List?)
|
||||
?.map<Streams>((e) => Streams.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
class GQnDesc {
|
||||
GQnDesc({
|
||||
this.qn,
|
||||
this.desc,
|
||||
this.hdrDesc,
|
||||
this.attrDesc,
|
||||
});
|
||||
|
||||
int? qn;
|
||||
String? desc;
|
||||
String? hdrDesc;
|
||||
String? attrDesc;
|
||||
|
||||
GQnDesc.fromJson(Map<String, dynamic> json) {
|
||||
qn = json['qn'];
|
||||
desc = json['desc'];
|
||||
hdrDesc = json['hedr_desc'];
|
||||
attrDesc = json['attr_desc'];
|
||||
}
|
||||
}
|
||||
|
||||
class Streams {
|
||||
Streams({
|
||||
this.protocolName,
|
||||
this.format,
|
||||
});
|
||||
|
||||
String? protocolName;
|
||||
List<FormatItem>? format;
|
||||
|
||||
Streams.fromJson(Map<String, dynamic> json) {
|
||||
protocolName = json['protocol_name'];
|
||||
format = (json['format'] as List?)
|
||||
?.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
class FormatItem {
|
||||
FormatItem({
|
||||
this.formatName,
|
||||
this.codec,
|
||||
});
|
||||
|
||||
String? formatName;
|
||||
List<CodecItem>? codec;
|
||||
|
||||
FormatItem.fromJson(Map<String, dynamic> json) {
|
||||
formatName = json['format_name'];
|
||||
codec = (json['codec'] as List?)
|
||||
?.map<CodecItem>((e) => CodecItem.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
class CodecItem {
|
||||
CodecItem({
|
||||
this.codecName,
|
||||
this.currentQn,
|
||||
this.acceptQn,
|
||||
this.baseUrl,
|
||||
this.urlInfo,
|
||||
this.hdrQn,
|
||||
this.dolbyType,
|
||||
this.attrName,
|
||||
});
|
||||
|
||||
String? codecName;
|
||||
int? currentQn;
|
||||
List? acceptQn;
|
||||
String? baseUrl;
|
||||
List<UrlInfoItem>? urlInfo;
|
||||
String? hdrQn;
|
||||
int? dolbyType;
|
||||
String? attrName;
|
||||
|
||||
CodecItem.fromJson(Map<String, dynamic> json) {
|
||||
codecName = json['codec_name'];
|
||||
currentQn = json['current_qn'];
|
||||
acceptQn = json['accept_qn'];
|
||||
baseUrl = json['base_url'];
|
||||
urlInfo = (json['url_info'] as List?)
|
||||
?.map<UrlInfoItem>((e) => UrlInfoItem.fromJson(e))
|
||||
.toList();
|
||||
hdrQn = json['hdr_n'];
|
||||
dolbyType = json['dolby_type'];
|
||||
attrName = json['attr_name'];
|
||||
}
|
||||
}
|
||||
|
||||
class UrlInfoItem {
|
||||
UrlInfoItem({
|
||||
this.host,
|
||||
this.extra,
|
||||
this.streamTtl,
|
||||
});
|
||||
|
||||
String? host;
|
||||
String? extra;
|
||||
int? streamTtl;
|
||||
|
||||
UrlInfoItem.fromJson(Map<String, dynamic> json) {
|
||||
host = json['host'];
|
||||
extra = json['extra'];
|
||||
streamTtl = json['stream_ttl'];
|
||||
}
|
||||
}
|
||||
138
lib/models/live/live_room/room_info_h5.dart
Normal file
138
lib/models/live/live_room/room_info_h5.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
class RoomInfoH5Model {
|
||||
RoomInfoH5Model({
|
||||
this.roomInfo,
|
||||
this.anchorInfo,
|
||||
this.isRoomFeed,
|
||||
this.watchedShow,
|
||||
this.likeInfoV3,
|
||||
this.blockInfo,
|
||||
});
|
||||
|
||||
RoomInfo? roomInfo;
|
||||
AnchorInfo? anchorInfo;
|
||||
int? isRoomFeed;
|
||||
Map? watchedShow;
|
||||
LikeInfoV3? likeInfoV3;
|
||||
Map? blockInfo;
|
||||
|
||||
RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
|
||||
roomInfo =
|
||||
json['room_info'] == null ? null : RoomInfo.fromJson(json['room_info']);
|
||||
anchorInfo = json['anchor_info'] == null
|
||||
? null
|
||||
: AnchorInfo.fromJson(json['anchor_info']);
|
||||
isRoomFeed = json['is_room_feed'];
|
||||
watchedShow = json['watched_show'];
|
||||
likeInfoV3 = json['like_info_v3'] == null
|
||||
? null
|
||||
: LikeInfoV3.fromJson(json['like_info_v3']);
|
||||
blockInfo = json['block_info'];
|
||||
}
|
||||
}
|
||||
|
||||
class RoomInfo {
|
||||
RoomInfo({
|
||||
this.uid,
|
||||
this.roomId,
|
||||
this.title,
|
||||
this.cover,
|
||||
this.description,
|
||||
this.liveStatus,
|
||||
this.liveStartTime,
|
||||
this.areaId,
|
||||
this.areaName,
|
||||
this.parentAreaId,
|
||||
this.parentAreaName,
|
||||
this.online,
|
||||
this.background,
|
||||
this.appBackground,
|
||||
this.liveId,
|
||||
});
|
||||
|
||||
int? uid;
|
||||
int? roomId;
|
||||
String? title;
|
||||
String? cover;
|
||||
String? description;
|
||||
int? liveStatus;
|
||||
int? liveStartTime;
|
||||
int? areaId;
|
||||
String? areaName;
|
||||
int? parentAreaId;
|
||||
String? parentAreaName;
|
||||
int? online;
|
||||
String? background;
|
||||
String? appBackground;
|
||||
String? liveId;
|
||||
|
||||
RoomInfo.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
roomId = json['room_id'];
|
||||
title = json['title'];
|
||||
cover = json['cover'];
|
||||
description = json['description'];
|
||||
liveStatus = json['liveS_satus'];
|
||||
liveStartTime = json['live_start_time'];
|
||||
areaId = json['area_id'];
|
||||
areaName = json['area_name'];
|
||||
parentAreaId = json['parent_area_id'];
|
||||
parentAreaName = json['parent_area_name'];
|
||||
online = json['online'];
|
||||
background = json['background'];
|
||||
appBackground = json['app_background'];
|
||||
liveId = json['live_id'];
|
||||
}
|
||||
}
|
||||
|
||||
class AnchorInfo {
|
||||
AnchorInfo({
|
||||
this.baseInfo,
|
||||
// this.relationInfo,
|
||||
});
|
||||
|
||||
BaseInfo? baseInfo;
|
||||
// RelationInfo? relationInfo;
|
||||
|
||||
AnchorInfo.fromJson(Map<String, dynamic> json) {
|
||||
baseInfo =
|
||||
json['base_info'] == null ? null : BaseInfo.fromJson(json['base_info']);
|
||||
// relationInfo = json['relation_info'] == null
|
||||
// ? null
|
||||
// : RelationInfo.fromJson(json['relation_info']);
|
||||
}
|
||||
}
|
||||
|
||||
class BaseInfo {
|
||||
BaseInfo({
|
||||
this.uname,
|
||||
this.face,
|
||||
});
|
||||
|
||||
String? uname;
|
||||
String? face;
|
||||
|
||||
BaseInfo.fromJson(Map<String, dynamic> json) {
|
||||
uname = json['uname'];
|
||||
face = json['face'];
|
||||
}
|
||||
}
|
||||
|
||||
class RelationInfo {
|
||||
RelationInfo({this.attention});
|
||||
|
||||
int? attention;
|
||||
|
||||
RelationInfo.fromJson(Map<String, dynamic> json) {
|
||||
attention = json['attention'];
|
||||
}
|
||||
}
|
||||
|
||||
class LikeInfoV3 {
|
||||
LikeInfoV3({this.totalLikes});
|
||||
|
||||
int? totalLikes;
|
||||
|
||||
LikeInfoV3.fromJson(Map<String, dynamic> json) {
|
||||
totalLikes = json['total_likes'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user