merge main

This commit is contained in:
guozhigq
2023-08-19 15:33:24 +08:00
208 changed files with 6302 additions and 2205 deletions

View File

@ -0,0 +1,90 @@
class BangumiListDataModel {
BangumiListDataModel({
this.hasNext,
this.list,
this.num,
this.size,
this.total,
});
int? hasNext;
List? list;
int? num;
int? size;
int? total;
BangumiListDataModel.fromJson(Map<String, dynamic> json) {
hasNext = json['has_next'];
list = json['list'] != null
? json['list']
.map<BangumiListItemModel>((e) => BangumiListItemModel.fromJson(e))
.toList()
: [];
num = json['num'];
size = json['size'];
total = json['total'];
}
}
class BangumiListItemModel {
BangumiListItemModel({
this.badge,
this.badgeType,
this.cover,
// this.firstEp,
this.indexShow,
this.isFinish,
this.link,
this.mediaId,
this.order,
this.orderType,
this.score,
this.seasonId,
this.seaconStatus,
this.seasonType,
this.subTitle,
this.title,
this.titleIcon,
this.progress,
});
String? badge;
int? badgeType;
String? cover;
String? indexShow;
int? isFinish;
String? link;
int? mediaId;
String? order;
String? orderType;
String? score;
int? seasonId;
int? seaconStatus;
int? seasonType;
String? subTitle;
String? title;
String? titleIcon;
String? progress;
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
badge = json['badge'] == '' ? null : json['badge'];
badgeType = json['badge_type'];
cover = json['cover'];
indexShow = json['index_show'];
isFinish = json['is_finish'];
link = json['link'];
mediaId = json['media_id'];
order = json['order'];
orderType = json['order_type'];
score = json['score'];
seasonId = json['season_id'];
seaconStatus = json['seacon_status'];
seasonType = json['season_type'];
subTitle = json['sub_title'];
title = json['title'];
titleIcon = json['title_icon'];
progress = json['progress'];
}
}

View File

@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/pages/bangumi/index.dart';
import 'package:pilipala/pages/hot/index.dart';
import 'package:pilipala/pages/live/index.dart';
import 'package:pilipala/pages/rcmd/index.dart';
enum TabType { live, rcmd, hot, bangumi }
extension TabTypeDesc on TabType {
String get description => ['直播', '推荐', '热门', '番剧'][index];
}
List tabsConfig = [
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'label': '直播',
'type': TabType.live,
'ctr': Get.find<LiveController>,
'page': const LivePage(),
},
{
'icon': const Icon(
Icons.thumb_up_off_alt_outlined,
size: 15,
),
'label': '推荐',
'type': TabType.rcmd,
'ctr': Get.find<RcmdController>,
'page': const RcmdPage(),
},
{
'icon': const Icon(
Icons.whatshot_outlined,
size: 15,
),
'label': '热门',
'type': TabType.hot,
'ctr': Get.find<HotController>,
'page': const HotPage(),
},
{
'icon': const Icon(
Icons.play_circle_outlined,
size: 15,
),
'label': '番剧',
'type': TabType.bangumi,
'ctr': Get.find<BangumiController>,
'page': const BangumiPage(),
},
];

View File

@ -0,0 +1,13 @@
enum ThemeType {
light,
dark,
system,
}
extension ThemeTypeDesc on ThemeType {
String get description => ['浅色', '深色', '跟随系统'][index];
}
extension ThemeTypeCode on ThemeType {
int get code => [0, 1, 2][index];
}

View File

@ -478,6 +478,8 @@ class DynamicArchiveModel {
this.stat,
this.title,
this.type,
this.epid,
this.seasonId,
});
int? aid;
@ -491,6 +493,8 @@ class DynamicArchiveModel {
Stat? stat;
String? title;
int? type;
int? epid;
int? seasonId;
DynamicArchiveModel.fromJson(Map<String, dynamic> json) {
aid = json['aid'] is String ? int.parse(json['aid']) : json['aid'];
@ -503,6 +507,8 @@ class DynamicArchiveModel {
stat = json['stat'] != null ? Stat.fromJson(json['stat']) : null;
title = json['title'];
type = json['type'];
epid = json['epid'];
seasonId = json['season_id'];
}
}

View File

@ -0,0 +1,45 @@
class LatestDataModel {
LatestDataModel({
this.url,
this.tagName,
this.createdAt,
this.assets,
});
String? url;
String? tagName;
String? createdAt;
List? assets;
LatestDataModel.fromJson(Map<String, dynamic> json) {
url = json['url'];
tagName = json['tag_name'];
createdAt = json['created_at'];
assets =
json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList();
}
}
class AssetItem {
AssetItem({
this.url,
this.name,
this.size,
this.downloadCount,
this.downloadUrl,
});
String? url;
String? name;
int? size;
int? downloadCount;
String? downloadUrl;
AssetItem.fromJson(Map<String, dynamic> json) {
url = json['url'];
name = json['name'];
size = json['size'];
downloadCount = json['download_count'];
downloadUrl = json['browser_download_url'];
}
}

View File

@ -1,3 +1,8 @@
import 'package:hive/hive.dart';
part 'result.g.dart';
@HiveType(typeId: 0)
class RecVideoItemAppModel {
RecVideoItemAppModel({
this.id,
@ -11,55 +16,141 @@ class RecVideoItemAppModel {
this.isFollowed,
this.owner,
this.rcmdReason,
this.goto,
this.param,
this.uri,
this.talkBack,
this.bangumiView,
this.bangumiFollow,
this.bangumiBadge,
this.cardType,
this.adInfo,
});
@HiveField(0)
int? id;
@HiveField(1)
int? aid;
int? bvid;
@HiveField(2)
String? bvid;
@HiveField(3)
int? cid;
@HiveField(4)
String? pic;
Stat? stat;
int? duration;
@HiveField(5)
RcmdStat? stat;
@HiveField(6)
String? duration;
@HiveField(7)
String? title;
@HiveField(8)
int? isFollowed;
Owner? owner;
String? rcmdReason;
@HiveField(9)
RcmdOwner? owner;
@HiveField(10)
RcmdReason? rcmdReason;
@HiveField(11)
String? goto;
@HiveField(12)
int? param;
@HiveField(13)
String? uri;
@HiveField(14)
String? talkBack;
// 番剧
@HiveField(15)
String? bangumiView;
@HiveField(16)
String? bangumiFollow;
@HiveField(17)
String? bangumiBadge;
@HiveField(18)
String? cardType;
@HiveField(19)
Map? adInfo;
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
id = json['player_args']['aid'];
aid = json['player_args']['aid'];
cid = json['player_args']['cid'];
id = json['player_args'] != null
? json['player_args']['aid']
: int.parse(json['param'] ?? '-1');
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
bvid = null;
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
pic = json['cover'];
stat = Stat.fromJson(json);
duration = json['player_args']['duration'];
stat = RcmdStat.fromJson(json);
duration = json['cover_right_text'];
title = json['title'];
isFollowed = 0;
owner = Owner.fromJson(json);
owner = RcmdOwner.fromJson(json);
rcmdReason = json['rcmd_reason_style'] != null
? RcmdReason.fromJson(json['rcmd_reason_style'])
: null;
goto = json['goto'];
param = int.parse(json['param']);
uri = json['uri'];
talkBack = json['talk_back'];
if (json['goto'] == 'bangumi') {
bangumiView = json['cover_left_text_1'];
bangumiFollow = json['cover_left_text_2'];
bangumiBadge = json['badge'];
}
cardType = json['card_type'];
adInfo = json['ad_info'];
}
}
class Stat {
Stat({
@HiveType(typeId: 1)
class RcmdStat {
RcmdStat({
this.view,
this.like,
this.danmaku,
this.danmu,
});
@HiveField(0)
String? view;
@HiveField(1)
String? like;
String? danmaku;
@HiveField(2)
String? danmu;
Stat.fromJson(Map<String, dynamic> json) {
RcmdStat.fromJson(Map<String, dynamic> json) {
view = json["cover_left_text_1"];
danmaku = json['cover_left_text_2'];
danmu = json['cover_left_text_2'];
}
}
class Owner {
Owner({this.name});
@HiveType(typeId: 2)
class RcmdOwner {
RcmdOwner({this.name, this.mid});
@HiveField(0)
String? name;
@HiveField(1)
int? mid;
Owner.fromJson(Map<String, dynamic> json) {
name = json['args']['up_name'];
RcmdOwner.fromJson(Map<String, dynamic> json) {
name = json['goto'] == 'av'
? json['args']['up_name']
: json['desc_button'] != null
? json['desc_button']['text']
: '';
mid = json['args']['up_id'] ?? -1;
}
}
@HiveType(typeId: 8)
class RcmdReason {
RcmdReason({
this.content,
});
@HiveField(0)
String? content;
RcmdReason.fromJson(Map<String, dynamic> json) {
content = json["text"] ?? '';
}
}

View File

@ -0,0 +1,209 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'result.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class RecVideoItemAppModelAdapter extends TypeAdapter<RecVideoItemAppModel> {
@override
final int typeId = 0;
@override
RecVideoItemAppModel read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RecVideoItemAppModel(
id: fields[0] as int?,
aid: fields[1] as int?,
bvid: fields[2] as String?,
cid: fields[3] as int?,
pic: fields[4] as String?,
stat: fields[5] as RcmdStat?,
duration: fields[6] as String?,
title: fields[7] as String?,
isFollowed: fields[8] as int?,
owner: fields[9] as RcmdOwner?,
rcmdReason: fields[10] as RcmdReason?,
goto: fields[11] as String?,
param: fields[12] as int?,
uri: fields[13] as String?,
talkBack: fields[14] as String?,
bangumiView: fields[15] as String?,
bangumiFollow: fields[16] as String?,
bangumiBadge: fields[17] as String?,
cardType: fields[18] as String?,
adInfo: (fields[19] as Map?)?.cast<dynamic, dynamic>(),
);
}
@override
void write(BinaryWriter writer, RecVideoItemAppModel obj) {
writer
..writeByte(20)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.aid)
..writeByte(2)
..write(obj.bvid)
..writeByte(3)
..write(obj.cid)
..writeByte(4)
..write(obj.pic)
..writeByte(5)
..write(obj.stat)
..writeByte(6)
..write(obj.duration)
..writeByte(7)
..write(obj.title)
..writeByte(8)
..write(obj.isFollowed)
..writeByte(9)
..write(obj.owner)
..writeByte(10)
..write(obj.rcmdReason)
..writeByte(11)
..write(obj.goto)
..writeByte(12)
..write(obj.param)
..writeByte(13)
..write(obj.uri)
..writeByte(14)
..write(obj.talkBack)
..writeByte(15)
..write(obj.bangumiView)
..writeByte(16)
..write(obj.bangumiFollow)
..writeByte(17)
..write(obj.bangumiBadge)
..writeByte(18)
..write(obj.cardType)
..writeByte(19)
..write(obj.adInfo);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RecVideoItemAppModelAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class RcmdStatAdapter extends TypeAdapter<RcmdStat> {
@override
final int typeId = 1;
@override
RcmdStat read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RcmdStat(
view: fields[0] as String?,
like: fields[1] as String?,
danmu: fields[2] as String?,
);
}
@override
void write(BinaryWriter writer, RcmdStat obj) {
writer
..writeByte(3)
..writeByte(0)
..write(obj.view)
..writeByte(1)
..write(obj.like)
..writeByte(2)
..write(obj.danmu);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RcmdStatAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class RcmdOwnerAdapter extends TypeAdapter<RcmdOwner> {
@override
final int typeId = 2;
@override
RcmdOwner read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RcmdOwner(
name: fields[0] as String?,
mid: fields[1] as int?,
);
}
@override
void write(BinaryWriter writer, RcmdOwner obj) {
writer
..writeByte(2)
..writeByte(0)
..write(obj.name)
..writeByte(1)
..write(obj.mid);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RcmdOwnerAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
@override
final int typeId = 8;
@override
RcmdReason read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RcmdReason(
content: fields[0] as String?,
);
}
@override
void write(BinaryWriter writer, RcmdReason obj) {
writer
..writeByte(1)
..writeByte(0)
..write(obj.content);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RcmdReasonAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}

View File

@ -224,10 +224,12 @@ class SearchLiveItemModel {
this.liveTime,
this.uname,
this.uface,
this.face,
this.userCover,
this.type,
this.title,
this.cover,
this.pic,
this.online,
this.rankIndex,
this.rankScore,
@ -242,16 +244,19 @@ class SearchLiveItemModel {
String? liveTime;
String? uname;
String? uface;
String? face;
String? userCover;
String? type;
List? title;
String? cover;
String? pic;
int? online;
int? rankIndex;
int? rankScore;
int? roomid;
int? attentions;
String? cateName;
Map? watchedShow;
SearchLiveItemModel.fromJson(Map<String, dynamic> json) {
rankOffset = json['rank_offset'];
@ -260,10 +265,12 @@ class SearchLiveItemModel {
liveTime = json['live_time'];
uname = json['uname'];
uface = json['uface'];
face = json['uface'];
userCover = json['user_cover'];
type = json['type'];
title = Em.regTitle(json['title']);
cover = json['cover'];
pic = json['cover'];
online = json['online'];
rankIndex = json['rank_index'];
rankScore = json['rank_score'];

View File

@ -0,0 +1,37 @@
class BlackListDataModel {
BlackListDataModel({
this.list,
this.total,
});
List<BlackListItem>? list;
int? total;
BlackListDataModel.fromJson(Map<String, dynamic> json) {
list = json['list']
.map<BlackListItem>((e) => BlackListItem.fromJson(e))
.toList();
total = json['total'];
}
}
class BlackListItem {
BlackListItem({
this.face,
this.mid,
this.mtime,
this.uname,
});
String? face;
int? mid;
int? mtime;
String? uname;
BlackListItem.fromJson(Map<String, dynamic> json) {
face = json['face'];
mid = json['mid'];
mtime = json['mtime'];
uname = json['uname'];
}
}

View File

@ -1,3 +1,5 @@
// ignore_for_file: constant_identifier_names
enum VideoQuality {
speed240,
flunt360,
@ -89,3 +91,46 @@ extension AudioQualityDesc on AudioQuality {
];
get description => _descList[index];
}
enum VideoDecodeFormats {
AV1,
HEVC,
AVC,
}
extension VideoDecodeFormatsDesc on VideoDecodeFormats {
static final List<String> _descList = [
'AV1',
'HEVC',
'AVC',
];
get description => _descList[index];
}
extension VideoDecodeFormatsCode on VideoDecodeFormats {
static final List<String> _codeList = [
'av01',
'hev1',
'avc1',
];
get code => _codeList[index];
static VideoDecodeFormats? fromCode(String code) {
final index = _codeList.indexOf(code);
if (index != -1) {
return VideoDecodeFormats.values[index];
}
return null;
}
static VideoDecodeFormats? fromString(String val) {
var result = VideoDecodeFormats.values.first;
for (var i in _codeList) {
if (val.startsWith(i)) {
result = VideoDecodeFormats.values[_codeList.indexOf(i)];
break;
}
}
return result;
}
}

View File

@ -29,7 +29,7 @@ class PlayUrlModel {
int? timeLength;
String? acceptFormat;
List<dynamic>? acceptDesc;
List<dynamic>? acceptQuality;
List<int>? acceptQuality;
int? videoCodecid;
String? seekParam;
String? seekType;
@ -48,7 +48,7 @@ class PlayUrlModel {
timeLength = json['timelength'];
acceptFormat = json['accept_format'];
acceptDesc = json['accept_description'];
acceptQuality = json['accept_quality'];
acceptQuality = json['accept_quality'].map<int>((e) => e as int).toList();
videoCodecid = json['video_codecid'];
seekParam = json['seek_param'];
seekType = json['seek_type'];

View File

@ -580,9 +580,11 @@ class UgcSeason {
intro = json['intro'];
signState = json['sign_state'];
attribute = json['attribute'];
sections = json['sections']
.map<SectionItem>((e) => SectionItem.fromJson(e))
.toList();
sections = json['sections'] != null
? json['sections']
.map<SectionItem>((e) => SectionItem.fromJson(e))
.toList()
: [];
stat = Stat.fromJson(json['stat']);
epCount = json['ep_count'];
seasonType = json['season_type'];