clean up models

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-05 12:10:18 +08:00
parent b897103af0
commit 279f21857d
308 changed files with 156 additions and 6243 deletions

View File

@@ -2,39 +2,24 @@ import 'package:PiliPlus/models_new/live/live_room_play_info/url_info.dart';
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
class CodecItem {
String? codecName;
int? currentQn;
List<int>? acceptQn;
String? baseUrl;
List<UrlInfo>? urlInfo;
dynamic hdrQn;
int? dolbyType;
String? attrName;
int? hdrType;
CodecItem({
this.codecName,
this.currentQn,
this.acceptQn,
this.baseUrl,
this.urlInfo,
this.hdrQn,
this.dolbyType,
this.attrName,
this.hdrType,
});
factory CodecItem.fromJson(Map<String, dynamic> json) => CodecItem(
codecName: json['codec_name'] as String?,
currentQn: json['current_qn'] as int?,
acceptQn: (json['accept_qn'] as List?)?.fromCast(),
baseUrl: json['base_url'] as String?,
urlInfo: (json['url_info'] as List<dynamic>?)
?.map((e) => UrlInfo.fromJson(e as Map<String, dynamic>))
.toList(),
hdrQn: json['hdr_qn'] as dynamic,
dolbyType: json['dolby_type'] as int?,
attrName: json['attr_name'] as String?,
hdrType: json['hdr_type'] as int?,
);
}

View File

@@ -1,17 +1,13 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
class Format {
String? formatName;
List<CodecItem>? codec;
String? masterUrl;
Format({this.formatName, this.codec, this.masterUrl});
Format({this.codec});
factory Format.fromJson(Map<String, dynamic> json) => Format(
formatName: json['format_name'] as String?,
codec: (json['codec'] as List<dynamic>?)
?.map((e) => CodecItem.fromJson(e as Map<String, dynamic>))
.toList(),
masterUrl: json['master_url'] as String?,
);
}

View File

@@ -1,16 +1,13 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/stream.dart';
class Playurl {
int? cid;
List<Stream>? stream;
Playurl({
this.cid,
this.stream,
});
factory Playurl.fromJson(Map<String, dynamic> json) => Playurl(
cid: json['cid'] as int?,
stream: (json['stream'] as List<dynamic>?)
?.map((e) => Stream.fromJson(e as Map<String, dynamic>))
.toList(),

View File

@@ -1,13 +1,11 @@
import 'package:PiliPlus/models_new/live/live_room_play_info/format.dart';
class Stream {
String? protocolName;
List<Format>? format;
Stream({this.protocolName, this.format});
Stream({this.format});
factory Stream.fromJson(Map<String, dynamic> json) => Stream(
protocolName: json['protocol_name'] as String?,
format: (json['format'] as List<dynamic>?)
?.map((e) => Format.fromJson(e as Map<String, dynamic>))
.toList(),

View File

@@ -1,13 +1,11 @@
class UrlInfo {
String? host;
String? extra;
int? streamTtl;
UrlInfo({this.host, this.extra, this.streamTtl});
UrlInfo({this.host, this.extra});
factory UrlInfo.fromJson(Map<String, dynamic> json) => UrlInfo(
host: json['host'] as String?,
extra: json['extra'] as String?,
streamTtl: json['stream_ttl'] as int?,
);
}