diff --git a/lib/common/widgets/dialog/report_member.dart b/lib/common/widgets/dialog/report_member.dart index 079ab1fae..05b5da079 100644 --- a/lib/common/widgets/dialog/report_member.dart +++ b/lib/common/widgets/dialog/report_member.dart @@ -83,7 +83,7 @@ class _MemberReportPanelState extends State { SmartDialog.showToast('至少选择一项作为举报内容'); } else { Get.back(); - dynamic result = await MemberHttp.reportMember( + var result = await MemberHttp.reportMember( widget.mid, reason: _reason.join(','), reasonV2: _reasonV2 != null ? _reasonV2! + 1 : null, diff --git a/lib/common/widgets/video_card/video_card_h.dart b/lib/common/widgets/video_card/video_card_h.dart index 94ca237b8..7c1f9cfd1 100644 --- a/lib/common/widgets/video_card/video_card_h.dart +++ b/lib/common/widgets/video_card/video_card_h.dart @@ -45,8 +45,8 @@ class VideoCardH extends StatelessWidget { final int aid = videoItem.aid!; final String bvid = videoItem.bvid!; String type = 'video'; - if (videoItem is SearchVideoItemModel) { - var typeOrNull = (videoItem as SearchVideoItemModel).type; + if (videoItem case SearchVideoItemModel item) { + var typeOrNull = item.type; if (typeOrNull?.isNotEmpty == true) { type = typeOrNull!; } @@ -79,8 +79,8 @@ class VideoCardH extends StatelessWidget { SmartDialog.showToast('课堂视频暂不支持播放'); return; } else if (type == 'live_room') { - if (videoItem is SearchVideoItemModel) { - int? roomId = (videoItem as SearchVideoItemModel).id; + if (videoItem case SearchVideoItemModel item) { + int? roomId = item.id; if (roomId != null) { Get.toNamed('/liveRoom?roomid=$roomId'); } @@ -90,11 +90,9 @@ class VideoCardH extends StatelessWidget { } return; } - if ((videoItem is HotVideoItemModel) && - (videoItem as HotVideoItemModel).redirectUrl?.isNotEmpty == - true) { - if (PageUtils.viewPgcFromUri( - (videoItem as HotVideoItemModel).redirectUrl!)) { + if (videoItem case HotVideoItemModel item) { + if (item.redirectUrl?.isNotEmpty == true && + PageUtils.viewPgcFromUri(item.redirectUrl!)) { return; } } @@ -132,9 +130,8 @@ class VideoCardH extends StatelessWidget { final double maxWidth = boxConstraints.maxWidth; final double maxHeight = boxConstraints.maxHeight; num? progress; - if (videoItem is HotVideoItemModel) { - progress = - (videoItem as HotVideoItemModel).progress; + if (videoItem case HotVideoItemModel item) { + progress = item.progress; } return Stack( @@ -145,10 +142,9 @@ class VideoCardH extends StatelessWidget { width: maxWidth, height: maxHeight, ), - if (videoItem is HotVideoItemModel) + if (videoItem case HotVideoItemModel item) PBadge( - text: - (videoItem as HotVideoItemModel).pgcLabel, + text: item.pgcLabel, top: 6.0, right: 6.0, ), @@ -222,32 +218,31 @@ class VideoCardH extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if ((videoItem is SearchVideoItemModel) && - (videoItem as SearchVideoItemModel).titleList?.isNotEmpty == true) - Expanded( - child: Text.rich( - overflow: TextOverflow.ellipsis, - maxLines: 2, - TextSpan( - children: [ - for (var i - in (videoItem as SearchVideoItemModel).titleList!) - TextSpan( - text: i['text'], - style: TextStyle( - fontSize: theme.textTheme.bodyMedium!.fontSize, - height: 1.42, - letterSpacing: 0.3, - color: i['type'] == 'em' - ? theme.colorScheme.primary - : theme.colorScheme.onSurface, + if (videoItem case SearchVideoItemModel item) ...[ + if (item.titleList?.isNotEmpty == true) + Expanded( + child: Text.rich( + overflow: TextOverflow.ellipsis, + maxLines: 2, + TextSpan( + children: [ + for (var i in item.titleList!) + TextSpan( + text: i['text'], + style: TextStyle( + fontSize: theme.textTheme.bodyMedium!.fontSize, + height: 1.42, + letterSpacing: 0.3, + color: i['type'] == 'em' + ? theme.colorScheme.primary + : theme.colorScheme.onSurface, + ), ), - ), - ], + ], + ), ), - ), - ) - else + ) + ] else Expanded( child: Text( videoItem.title, diff --git a/lib/common/widgets/video_popup_menu.dart b/lib/common/widgets/video_popup_menu.dart index e9f48230c..32b832140 100644 --- a/lib/common/widgets/video_popup_menu.dart +++ b/lib/common/widgets/video_popup_menu.dart @@ -72,9 +72,8 @@ class VideoCustomActions { SmartDialog.showToast("请退出账号后重新登录"); return; } - if (videoItem is RecVideoItemAppModel) { - RecVideoItemAppModel v = videoItem as RecVideoItemAppModel; - ThreePoint? tp = v.threePoint; + if (videoItem case RecVideoItemAppModel item) { + ThreePoint? tp = item.threePoint; if (tp == null) { SmartDialog.showToast("未能获取threePoint"); return; @@ -92,8 +91,8 @@ class VideoCustomActions { var res = await VideoHttp.feedDislike( reasonId: r?.id, feedbackId: f?.id, - id: v.param!, - goto: v.goto!, + id: item.param!, + goto: item.goto!, ); SmartDialog.dismiss(); SmartDialog.showToast( @@ -143,8 +142,8 @@ class VideoCustomActions { onPressed: () async { SmartDialog.showLoading(msg: '正在提交'); var res = await VideoHttp.feedDislikeCancel( - id: v.param!, - goto: v.goto!, + id: item.param!, + goto: item.goto!, ); SmartDialog.dismiss(); SmartDialog.showToast( @@ -183,8 +182,7 @@ class VideoCustomActions { Get.back(); SmartDialog.showLoading(msg: '正在提交'); var res = await VideoHttp.dislikeVideo( - bvid: videoItem.bvid as String, - type: true); + bvid: videoItem.bvid!, type: true); SmartDialog.dismiss(); SmartDialog.showToast( res['status'] ? "点踩成功" : res['msg'], @@ -203,8 +201,7 @@ class VideoCustomActions { Get.back(); SmartDialog.showLoading(msg: '正在提交'); var res = await VideoHttp.dislikeVideo( - bvid: videoItem.bvid as String, - type: false); + bvid: videoItem.bvid!, type: false); SmartDialog.dismiss(); SmartDialog.showToast( res['status'] ? "取消踩" : res['msg']); diff --git a/lib/http/api.dart b/lib/http/api.dart index 5c7402fcf..1f0c78c07 100644 --- a/lib/http/api.dart +++ b/lib/http/api.dart @@ -24,7 +24,7 @@ class Api { // 字幕 // aid, cid - static const String subtitleUrl = '/x/player/wbi/v2'; + static const String playInfo = '/x/player/wbi/v2'; // 视频详情 // 竖屏 https://api.bilibili.com/x/web-interface/view?aid=527403921 diff --git a/lib/http/bangumi.dart b/lib/http/bangumi.dart index c01a890f3..88bb69a43 100644 --- a/lib/http/bangumi.dart +++ b/lib/http/bangumi.dart @@ -19,7 +19,7 @@ class BangumiHttp { type, indexType, }) async { - dynamic res = await Request().get( + var res = await Request().get( Api.pgcIndexResult, queryParameters: { ...params, @@ -42,7 +42,7 @@ class BangumiHttp { type, indexType, }) async { - dynamic res = await Request().get( + var res = await Request().get( Api.pgcIndexCondition, queryParameters: { if (seasonType != null) 'season_type': seasonType, diff --git a/lib/http/dynamics.dart b/lib/http/dynamics.dart index 06ed89e34..fda945a31 100644 --- a/lib/http/dynamics.dart +++ b/lib/http/dynamics.dart @@ -3,9 +3,11 @@ import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/article_info/data.dart'; import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart'; import 'package:PiliPlus/models/common/reply/reply_option_type.dart'; import 'package:PiliPlus/models/dynamics/article_list/data.dart'; +import 'package:PiliPlus/models/dynamics/dyn_reserve/data.dart'; import 'package:PiliPlus/models/dynamics/dyn_topic_feed/topic_card_list.dart'; import 'package:PiliPlus/models/dynamics/dyn_topic_top/top_details.dart'; import 'package:PiliPlus/models/dynamics/result.dart'; @@ -300,7 +302,10 @@ class DynamicsHttp { }), ); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return { + 'status': true, + 'data': ArticleInfoData.fromJson(res.data['data']) + }; } else { return {'status': false, 'msg': res.data['message']}; } @@ -459,7 +464,10 @@ class DynamicsHttp { }, ); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return { + 'status': true, + 'data': DynReserveData.fromJson(res.data['data']) + }; } else { return {'status': false, 'msg': res.data['message']}; } diff --git a/lib/http/login.dart b/lib/http/login.dart index e07bd27b3..866bc1c30 100644 --- a/lib/http/login.dart +++ b/lib/http/login.dart @@ -478,7 +478,7 @@ class LoginHttp { } static Future logout(Account account) async { - dynamic res = await Request().post( + var res = await Request().post( Api.logout, data: {'biliCSRF': account.csrf}, options: Options( diff --git a/lib/http/member.dart b/lib/http/member.dart index 2423bc7a6..f2c88cb4f 100644 --- a/lib/http/member.dart +++ b/lib/http/member.dart @@ -66,7 +66,7 @@ class MemberHttp { 'statistics': Constants.statisticsApp, 'vmid': mid.toString(), }; - dynamic res = await Request().get( + var res = await Request().get( Api.spaceArticle, queryParameters: data, options: Options( @@ -96,7 +96,7 @@ class MemberHttp { 'statistics': Constants.statisticsApp, 'up_mid': mid.toString(), }; - dynamic res = await Request().get( + var res = await Request().get( Api.spaceFav, queryParameters: data, options: Options( @@ -117,7 +117,7 @@ class MemberHttp { required int? mid, required int pn, }) async { - dynamic res = await Request().get( + var res = await Request().get( Api.seasonSeries, queryParameters: { 'mid': mid, @@ -165,7 +165,7 @@ class MemberHttp { 'statistics': Constants.statisticsApp, 'vmid': mid.toString(), }; - dynamic res = await Request().get( + var res = await Request().get( switch (type) { ContributeType.video => Api.spaceArchive, ContributeType.charging => Api.spaceChargingArchive, @@ -213,7 +213,7 @@ class MemberHttp { 'statistics': Constants.statisticsApp, 'vmid': mid.toString(), }; - dynamic res = await Request().get( + var res = await Request().get( Api.spaceStory, queryParameters: data, options: Options( @@ -245,7 +245,7 @@ class MemberHttp { 'statistics': Constants.statisticsApp, 'vmid': mid.toString(), }; - dynamic res = await Request().get( + var res = await Request().get( Api.space, queryParameters: data, options: Options( diff --git a/lib/http/msg.dart b/lib/http/msg.dart index 52fabf3fd..46993e904 100644 --- a/lib/http/msg.dart +++ b/lib/http/msg.dart @@ -2,6 +2,7 @@ import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/bfs_res/data.dart'; import 'package:PiliPlus/models/msg/account.dart'; import 'package:PiliPlus/models/msg/im_user_infos/datum.dart'; import 'package:PiliPlus/models/msg/msg_dnd/uid_setting.dart'; @@ -151,7 +152,7 @@ class MsgHttp { if (res.data['code'] == 0) { return { 'status': true, - 'data': res.data['data']..['img_size'] = file.length, + 'data': BfsResData.fromJson(res.data['data']), }; } else { return { diff --git a/lib/http/search.dart b/lib/http/search.dart index 9a2877178..5150cda9c 100644 --- a/lib/http/search.dart +++ b/lib/http/search.dart @@ -4,7 +4,7 @@ import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/search_type.dart'; -import 'package:PiliPlus/models/pgc/info.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/result.dart'; import 'package:PiliPlus/models/search/result.dart'; import 'package:PiliPlus/models/search/search_trending/trending_data.dart'; import 'package:PiliPlus/models/search/suggest.dart'; @@ -166,7 +166,7 @@ class SearchHttp { } else if (bvid != null) { data['bvid'] = bvid; } - final dynamic res = await Request().get(Api.ab2c, queryParameters: data); + var res = await Request().get(Api.ab2c, queryParameters: data); if (res.data['code'] == 0) { return part != null ? ((res.data['data'] as List).getOrNull(part - 1)?['cid'] ?? @@ -180,7 +180,7 @@ class SearchHttp { static Future> bangumiInfoNew( {int? seasonId, int? epId}) async { - final dynamic res = await Request().get( + var res = await Request().get( Api.bangumiInfo, queryParameters: { if (seasonId != null) 'season_id': seasonId, @@ -195,7 +195,7 @@ class SearchHttp { } static Future episodeInfo({int? epId}) async { - final dynamic res = await Request().get( + var res = await Request().get( Api.episodeInfo, queryParameters: { if (epId != null) 'ep_id': epId, @@ -218,8 +218,7 @@ class SearchHttp { } else if (epId != null) { data['ep_id'] = epId; } - final dynamic res = - await Request().get(Api.bangumiInfo, queryParameters: data); + var res = await Request().get(Api.bangumiInfo, queryParameters: data); if (res.data['code'] == 0) { return { diff --git a/lib/http/user.dart b/lib/http/user.dart index 14057a005..82dd3ae05 100644 --- a/lib/http/user.dart +++ b/lib/http/user.dart @@ -3,6 +3,8 @@ import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/fav_article/data.dart'; +import 'package:PiliPlus/models/folder_info/data.dart'; +import 'package:PiliPlus/models/media_list/data.dart'; import 'package:PiliPlus/models/model_hot_video_item.dart'; import 'package:PiliPlus/models/user/fav_detail.dart'; import 'package:PiliPlus/models/user/fav_folder.dart'; @@ -12,7 +14,6 @@ import 'package:PiliPlus/models/user/info.dart'; import 'package:PiliPlus/models/user/stat.dart'; import 'package:PiliPlus/models/user/sub_detail.dart'; import 'package:PiliPlus/models/user/sub_folder.dart'; -import 'package:PiliPlus/models/video/later.dart'; import 'package:PiliPlus/models/video_tag/data.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/storage.dart'; @@ -189,11 +190,14 @@ class UserHttp { static Future folderInfo({ dynamic mediaId, }) async { - var res = await Request().get(Api.folderInfo, queryParameters: { - 'media_id': mediaId, - }); + var res = await Request().get( + Api.folderInfo, + queryParameters: { + 'media_id': mediaId, + }, + ); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return {'status': true, 'data': FolderInfo.fromJson(res.data['data'])}; } else { return {'status': false, 'msg': res.data['message']}; } @@ -254,7 +258,7 @@ class UserHttp { } return Success({ 'list': list, - 'count': res.data['data']['count'], + 'count': res.data['data']?['count'] ?? 0, }); } else { return Error(res.data['message']); @@ -341,7 +345,7 @@ class UserHttp { 'csrf': Accounts.main.csrf, 'resources': aids.join(',') }; - dynamic res = await Request().post( + var res = await Request().post( Api.toViewDel, data: params, options: Options(contentType: Headers.formUrlEncodedContentType), @@ -651,7 +655,7 @@ class UserHttp { // 取消订阅 static Future cancelSub({required int id, required int type}) async { - late dynamic res; + late Response res; if (type == 11) { res = await Request().post( Api.unfavFolder, @@ -719,15 +723,7 @@ class UserHttp { }, ); if (res.data['code'] == 0) { - return { - 'status': true, - 'data': res.data['data']['media_list'] != null - ? res.data['data']['media_list'] - .map( - (e) => MediaVideoItemModel.fromJson(e)) - .toList() - : [] - }; + return {'status': true, 'data': MediaListData.fromJson(res.data['data'])}; } else { return {'status': false, 'msg': res.data['message']}; } diff --git a/lib/http/video.dart b/lib/http/video.dart index 0a948b9b1..fa7a0048c 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -12,11 +12,15 @@ import 'package:PiliPlus/models/member/article.dart'; import 'package:PiliPlus/models/model_hot_video_item.dart'; import 'package:PiliPlus/models/model_rec_video_item.dart'; import 'package:PiliPlus/models/pgc/pgc_rank/pgc_rank_item_model.dart'; +import 'package:PiliPlus/models/pgc_lcf.dart'; +import 'package:PiliPlus/models/play_info/data.dart'; +import 'package:PiliPlus/models/triple/pgc_triple.dart'; import 'package:PiliPlus/models/user/fav_folder.dart'; import 'package:PiliPlus/models/video/ai.dart'; import 'package:PiliPlus/models/video/note_list/data.dart'; import 'package:PiliPlus/models/video/play/url.dart'; -import 'package:PiliPlus/models/video_detail_res.dart'; +import 'package:PiliPlus/models/video_detail/video_detail_response.dart'; +import 'package:PiliPlus/models/video_relation/data.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/id_utils.dart'; import 'package:PiliPlus/utils/recommend_filter.dart'; @@ -314,7 +318,7 @@ class VideoHttp { if (res.data['code'] == 0) { return { 'status': true, - 'data': res.data['data'], + 'data': VideoRelation.fromJson(res.data['data']), }; } else { return { @@ -348,7 +352,7 @@ class VideoHttp { queryParameters: {'ep_id': epId}, ); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return {'status': true, 'data': PgcLCF.fromJson(res.data['data'])}; } else { return {'status': false, 'msg': res.data['message']}; } @@ -396,7 +400,7 @@ class VideoHttp { ), ); if (res.data['code'] == 0) { - return {'status': true, 'data': res.data['data']}; + return {'status': true, 'data': PgcTriple.fromJson(res.data['data'])}; } else { return {'status': false, 'msg': res.data['message']}; } @@ -892,11 +896,10 @@ class VideoHttp { } } - static Future> subtitlesJson( - {String? aid, String? bvid, required int cid}) async { + static Future playInfo({String? aid, String? bvid, required int cid}) async { assert(aid != null || bvid != null); var res = await Request().get( - Api.subtitleUrl, + Api.playInfo, queryParameters: { if (aid != null) 'aid': aid, if (bvid != null) 'bvid': bvid, @@ -904,20 +907,16 @@ class VideoHttp { }, ); if (res.data['code'] == 0) { - dynamic data = res.data['data']; return { 'status': true, - 'subtitles': data['subtitle']?['subtitles'], - 'view_points': data['view_points'], - 'last_play_cid': data['last_play_cid'], - 'interaction': data['interaction'], + 'data': PlayInfoData.fromJson(res.data['data']), }; } else { return {'status': false, 'msg': res.data['message']}; } } - static Future vttSubtitles(Map subtile) async { + static Future vttSubtitles(String subtitleUrl) async { String subtitleTimecode(num seconds) { int h = seconds ~/ 3600; seconds %= 3600; @@ -938,7 +937,7 @@ class VideoHttp { return sb.toString(); } - var res = await Request().get("https:${subtile['subtitle_url']}"); + var res = await Request().get("https:$subtitleUrl"); if (res.data?['body'] is List) { return await compute(processList, res.data['body'] as List); diff --git a/lib/models/article_info/data.dart b/lib/models/article_info/data.dart new file mode 100644 index 000000000..0b3aa31b9 --- /dev/null +++ b/lib/models/article_info/data.dart @@ -0,0 +1,85 @@ +import 'package:PiliPlus/models/article_info/share_channel.dart'; +import 'package:PiliPlus/models/article_info/stats.dart'; + +class ArticleInfoData { + int? like; + bool? attention; + bool? favorite; + int? coin; + Stats? stats; + String? title; + String? bannerUrl; + int? mid; + String? authorName; + bool? isAuthor; + List? imageUrls; + List? originImageUrls; + bool? shareable; + bool? showLaterWatch; + bool? showSmallWindow; + bool? inList; + int? pre; + int? next; + List? shareChannels; + int? type; + String? videoUrl; + String? location; + bool? disableShare; + + ArticleInfoData({ + this.like, + this.attention, + this.favorite, + this.coin, + this.stats, + this.title, + this.bannerUrl, + this.mid, + this.authorName, + this.isAuthor, + this.imageUrls, + this.originImageUrls, + this.shareable, + this.showLaterWatch, + this.showSmallWindow, + this.inList, + this.pre, + this.next, + this.shareChannels, + this.type, + this.videoUrl, + this.location, + this.disableShare, + }); + + factory ArticleInfoData.fromJson(Map json) => + ArticleInfoData( + like: json['like'] as int?, + attention: json['attention'] as bool?, + favorite: json['favorite'] as bool?, + coin: json['coin'] as int?, + stats: json['stats'] == null + ? null + : Stats.fromJson(json['stats'] as Map), + title: json['title'] as String?, + bannerUrl: json['banner_url'] as String?, + mid: json['mid'] as int?, + authorName: json['author_name'] as String?, + isAuthor: json['is_author'] as bool?, + imageUrls: json['image_urls'], + originImageUrls: json['origin_image_urls'], + shareable: json['shareable'] as bool?, + showLaterWatch: json['show_later_watch'] as bool?, + showSmallWindow: json['show_small_window'] as bool?, + inList: json['in_list'] as bool?, + pre: json['pre'] as int?, + next: json['next'] as int?, + shareChannels: (json['share_channels'] as List?) + ?.map((e) => ShareChannel.fromJson(e as Map)) + .toList(), + type: json['type'] as int?, + videoUrl: json['video_url'] as String?, + location: json['location'] as String?, + disableShare: json['disable_share'] as bool?, + ); +} diff --git a/lib/models/article_info/share_channel.dart b/lib/models/article_info/share_channel.dart new file mode 100644 index 000000000..eec687e3a --- /dev/null +++ b/lib/models/article_info/share_channel.dart @@ -0,0 +1,13 @@ +class ShareChannel { + String? name; + String? picture; + String? shareChannel; + + ShareChannel({this.name, this.picture, this.shareChannel}); + + factory ShareChannel.fromJson(Map json) => ShareChannel( + name: json['name'] as String?, + picture: json['picture'] as String?, + shareChannel: json['share_channel'] as String?, + ); +} diff --git a/lib/models/article_info/stats.dart b/lib/models/article_info/stats.dart new file mode 100644 index 000000000..ddd0702ec --- /dev/null +++ b/lib/models/article_info/stats.dart @@ -0,0 +1,32 @@ +class Stats { + int? view; + int? favorite; + int? like; + int? dislike; + int? reply; + int? share; + int? coin; + int? dynam1c; + + Stats({ + this.view, + this.favorite, + this.like, + this.dislike, + this.reply, + this.share, + this.coin, + this.dynam1c, + }); + + factory Stats.fromJson(Map json) => Stats( + view: json['view'] as int?, + favorite: json['favorite'] as int?, + like: json['like'] as int?, + dislike: json['dislike'] as int?, + reply: json['reply'] as int?, + share: json['share'] as int?, + coin: json['coin'] as int?, + dynam1c: json['dynamic'] as int?, + ); +} diff --git a/lib/models/bfs_res/data.dart b/lib/models/bfs_res/data.dart new file mode 100644 index 000000000..f8bfa4283 --- /dev/null +++ b/lib/models/bfs_res/data.dart @@ -0,0 +1,22 @@ +class BfsResData { + String? imageUrl; + int? imageWidth; + int? imageHeight; + double? imgSize; + + BfsResData({this.imageUrl, this.imageWidth, this.imageHeight, this.imgSize}); + + factory BfsResData.fromJson(Map json) => BfsResData( + imageUrl: json['image_url'] as String?, + imageWidth: json['image_width'] as int?, + imageHeight: json['image_height'] as int?, + imgSize: (json['img_size'] as num?)?.toDouble(), + ); + + Map toJson() => { + 'image_url': imageUrl, + 'image_width': imageWidth, + 'image_height': imageHeight, + 'img_size': imgSize, + }; +} diff --git a/lib/models/dynamics/article_content_model.dart b/lib/models/dynamics/article_content_model.dart index 84e4f0e51..b274dbe96 100644 --- a/lib/models/dynamics/article_content_model.dart +++ b/lib/models/dynamics/article_content_model.dart @@ -311,6 +311,7 @@ class Live { class Common { Common({ this.cover, + this.desc, this.desc1, this.desc2, this.headText, @@ -321,6 +322,7 @@ class Common { this.title, }); String? cover; + String? desc; String? desc1; String? desc2; String? headText; @@ -332,6 +334,7 @@ class Common { Common.fromJson(Map json) { cover = json['cover']; + desc = json['desc']; desc1 = json['desc1']; desc2 = json['desc2']; headText = json['head_text']; diff --git a/lib/models/dynamics/dyn_reserve/data.dart b/lib/models/dynamics/dyn_reserve/data.dart new file mode 100644 index 000000000..31ca8afa5 --- /dev/null +++ b/lib/models/dynamics/dyn_reserve/data.dart @@ -0,0 +1,31 @@ +class DynReserveData { + int? finalBtnStatus; + int? btnMode; + int? reserveUpdate; + String? descUpdate; + String? toast; + + DynReserveData({ + this.finalBtnStatus, + this.btnMode, + this.reserveUpdate, + this.descUpdate, + this.toast, + }); + + factory DynReserveData.fromJson(Map json) => DynReserveData( + finalBtnStatus: json['final_btn_status'] as int?, + btnMode: json['btn_mode'] as int?, + reserveUpdate: json['reserve_update'] as int?, + descUpdate: json['desc_update'] as String?, + toast: json['toast'] as String?, + ); + + Map toJson() => { + 'final_btn_status': finalBtnStatus, + 'btn_mode': btnMode, + 'reserve_update': reserveUpdate, + 'desc_update': descUpdate, + 'toast': toast, + }; +} diff --git a/lib/models/dynamics/result.dart b/lib/models/dynamics/result.dart index fff6ead60..7883befc5 100644 --- a/lib/models/dynamics/result.dart +++ b/lib/models/dynamics/result.dart @@ -297,7 +297,7 @@ class ModuleAuthorModel extends Avatar { String? pubTime; int? pubTs; String? type; - Map? decorate; + Decorate? decorate; ModuleAuthorModel.fromJson(Map json) : super.fromJson(json) { if (json['official'] != null) { @@ -311,13 +311,65 @@ class ModuleAuthorModel extends Avatar { pubTs = json['pub_ts'] == 0 ? null : json['pub_ts']; type = json['type']; if (PendantAvatar.showDynDecorate) { - decorate = json['decorate']; + decorate = + json['decorate'] == null ? null : Decorate.fromJson(json['decorate']); } else { pendant = null; } } } +class Decorate { + String? cardUrl; + Fan? fan; + int? id; + String? jumpUrl; + String? name; + int? type; + + Decorate({ + this.cardUrl, + this.fan, + this.id, + this.jumpUrl, + this.name, + this.type, + }); + + factory Decorate.fromJson(Map json) => Decorate( + cardUrl: json["card_url"], + fan: json["fan"] == null ? null : Fan.fromJson(json["fan"]), + id: json["id"], + jumpUrl: json["jump_url"], + name: json["name"], + type: json["type"], + ); +} + +class Fan { + String? color; + bool? isFan; + String? numPrefix; + String? numStr; + int? number; + + Fan({ + this.color, + this.isFan, + this.numPrefix, + this.numStr, + this.number, + }); + + factory Fan.fromJson(Map json) => Fan( + color: json["color"], + isFan: json["is_fan"], + numPrefix: json["num_prefix"], + numStr: json["num_str"], + number: json["number"], + ); +} + // 单个动态详情 - 动态信息 class ModuleDynamicModel { ModuleDynamicModel({ @@ -843,10 +895,10 @@ class DynamicMajorModel { // MAJOR_TYPE_OPUS 图文/文章 String? type; Map? courses; - Map? common; + Common? common; Map? music; ModuleBlocked? blocked; - Map? medialist; + Medialist? medialist; SubscriptionNew? subscriptionNew; @@ -871,19 +923,39 @@ class DynamicMajorModel { none = json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null; type = json['type']; - courses = json['courses'] ?? {}; - common = json['common'] ?? {}; - music = json['music'] ?? {}; + courses = json['courses']; + common = json['common'] == null ? null : Common.fromJson(json['common']); + music = json['music']; blocked = json['blocked'] == null ? null : ModuleBlocked.fromJson(json['blocked']); - medialist = json['medialist']; + medialist = json['medialist'] == null + ? null + : Medialist.fromJson(json['medialist']); subscriptionNew = json['subscription_new'] == null ? null : SubscriptionNew.fromJson(json['subscription_new']); } } +class Medialist { + dynamic id; + String? cover; + String? title; + String? subTitle; + String? jumpUrl; + Badge? badge; + + Medialist.fromJson(Map json) { + id = json['id']; + cover = json['cover']; + title = json['title']; + subTitle = json['sub_title']; + jumpUrl = json['jump_url']; + badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); + } +} + class SubscriptionNew { LiveRcmd? liveRcmd; String? style; @@ -1004,18 +1076,12 @@ class WatchedShow { int? num; String? textSmall; String? textLarge; - String? icon; - String? iconLocation; - String? iconWeb; WatchedShow({ this.watchedShowSwitch, this.num, this.textSmall, this.textLarge, - this.icon, - this.iconLocation, - this.iconWeb, }); factory WatchedShow.fromJson(Map json) => WatchedShow( @@ -1023,9 +1089,6 @@ class WatchedShow { num: json["num"], textSmall: json["text_small"], textLarge: json["text_large"], - icon: json["icon"], - iconLocation: json["icon_location"], - iconWeb: json["icon_web"], ); } @@ -1065,7 +1128,7 @@ class DynamicArchiveModel { }); int? aid; - Map? badge; + Badge? badge; String? bvid; String? cover; String? desc; @@ -1080,7 +1143,7 @@ class DynamicArchiveModel { DynamicArchiveModel.fromJson(Map json) { aid = json['aid'] is String ? int.parse(json['aid']) : json['aid']; - badge = json['badge']; + badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); bvid = json['bvid'] ?? json['epid'].toString() ?? ' '; cover = json['cover']; disablePreview = json['disable_preview']; @@ -1094,6 +1157,18 @@ class DynamicArchiveModel { } } +class Badge { + Badge({ + this.text, + }); + + String? text; + + Badge.fromJson(Map json) { + text = json['text']; + } +} + class DynamicDrawModel { DynamicDrawModel({ this.id, @@ -1317,7 +1392,7 @@ class DynamicLive2Model { this.title, }); - Map? badge; + Badge? badge; String? cover; String? descFirst; String? descSecond; @@ -1328,7 +1403,7 @@ class DynamicLive2Model { String? title; DynamicLive2Model.fromJson(Map json) { - badge = json['badge']; + badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); cover = json['cover']; descFirst = json['desc_first']; descSecond = json['desc_second']; diff --git a/lib/models/fans/result.dart b/lib/models/fans/result.dart index d716e5da6..e9accb1e8 100644 --- a/lib/models/fans/result.dart +++ b/lib/models/fans/result.dart @@ -1,3 +1,5 @@ +import 'package:PiliPlus/models/model_avatar.dart'; + class FansDataModel { FansDataModel({ this.total, @@ -36,7 +38,7 @@ class FansItemModel { String? uname; String? face; String? sign; - Map? officialVerify; + BaseOfficialVerify? officialVerify; FansItemModel.fromJson(Map json) { mid = json['mid']; @@ -47,6 +49,8 @@ class FansItemModel { uname = json['uname']; face = json['face']; sign = json['sign'] == '' ? '还没有签名' : json['sign']; - officialVerify = json['official_verify']; + officialVerify = json['official_verify'] == null + ? null + : BaseOfficialVerify.fromJson(json['official_verify']); } } diff --git a/lib/models/folder_info/cnt_info.dart b/lib/models/folder_info/cnt_info.dart new file mode 100644 index 000000000..5a6597cb0 --- /dev/null +++ b/lib/models/folder_info/cnt_info.dart @@ -0,0 +1,22 @@ +class CntInfo { + int? collect; + int? play; + int? thumbUp; + int? share; + + CntInfo({this.collect, this.play, this.thumbUp, this.share}); + + factory CntInfo.fromJson(Map json) => CntInfo( + collect: json['collect'] as int?, + play: json['play'] as int?, + thumbUp: json['thumb_up'] as int?, + share: json['share'] as int?, + ); + + Map toJson() => { + 'collect': collect, + 'play': play, + 'thumb_up': thumbUp, + 'share': share, + }; +} diff --git a/lib/models/folder_info/data.dart b/lib/models/folder_info/data.dart new file mode 100644 index 000000000..cf1c02f3f --- /dev/null +++ b/lib/models/folder_info/data.dart @@ -0,0 +1,90 @@ +import 'package:PiliPlus/models/folder_info/cnt_info.dart'; +import 'package:PiliPlus/models/folder_info/upper.dart'; + +class FolderInfo { + int? id; + int? fid; + int? mid; + int? attr; + String? title; + String? cover; + Upper? upper; + int? coverType; + CntInfo? cntInfo; + int? type; + String? intro; + int? ctime; + int? mtime; + int? state; + int? favState; + int? likeState; + int? mediaCount; + bool? isTop; + + FolderInfo({ + this.id, + this.fid, + this.mid, + this.attr, + this.title, + this.cover, + this.upper, + this.coverType, + this.cntInfo, + this.type, + this.intro, + this.ctime, + this.mtime, + this.state, + this.favState, + this.likeState, + this.mediaCount, + this.isTop, + }); + + factory FolderInfo.fromJson(Map json) => FolderInfo( + id: json['id'] as int?, + fid: json['fid'] as int?, + mid: json['mid'] as int?, + attr: json['attr'] as int?, + title: json['title'] as String?, + cover: json['cover'] as String?, + upper: json['upper'] == null + ? null + : Upper.fromJson(json['upper'] as Map), + coverType: json['cover_type'] as int?, + cntInfo: json['cnt_info'] == null + ? null + : CntInfo.fromJson(json['cnt_info'] as Map), + type: json['type'] as int?, + intro: json['intro'] as String?, + ctime: json['ctime'] as int?, + mtime: json['mtime'] as int?, + state: json['state'] as int?, + favState: json['fav_state'] as int?, + likeState: json['like_state'] as int?, + mediaCount: json['media_count'] as int?, + isTop: json['is_top'] as bool?, + ); + + Map toJson() => { + 'id': id, + 'fid': fid, + 'mid': mid, + 'attr': attr, + 'title': title, + 'cover': cover, + 'upper': upper?.toJson(), + 'cover_type': coverType, + 'cnt_info': cntInfo?.toJson(), + 'type': type, + 'intro': intro, + 'ctime': ctime, + 'mtime': mtime, + 'state': state, + 'fav_state': favState, + 'like_state': likeState, + 'media_count': mediaCount, + 'is_top': isTop, + }; +} diff --git a/lib/models/folder_info/upper.dart b/lib/models/folder_info/upper.dart new file mode 100644 index 000000000..38541d7e7 --- /dev/null +++ b/lib/models/folder_info/upper.dart @@ -0,0 +1,35 @@ +class Upper { + int? mid; + String? name; + String? face; + bool? followed; + int? vipType; + int? vipStatue; + + Upper({ + this.mid, + this.name, + this.face, + this.followed, + this.vipType, + this.vipStatue, + }); + + factory Upper.fromJson(Map json) => Upper( + mid: json['mid'] as int?, + name: json['name'] as String?, + face: json['face'] as String?, + followed: json['followed'] as bool?, + vipType: json['vip_type'] as int?, + vipStatue: json['vip_statue'] as int?, + ); + + Map toJson() => { + 'mid': mid, + 'name': name, + 'face': face, + 'followed': followed, + 'vip_type': vipType, + 'vip_statue': vipStatue, + }; +} diff --git a/lib/models/follow/result.dart b/lib/models/follow/result.dart index 24ff29d19..81e43fc00 100644 --- a/lib/models/follow/result.dart +++ b/lib/models/follow/result.dart @@ -1,3 +1,5 @@ +import 'package:PiliPlus/models/model_avatar.dart'; + class FollowDataModel { FollowDataModel({ this.total, @@ -37,7 +39,7 @@ class FollowItemModel { String? uname; String? face; String? sign; - Map? officialVerify; + BaseOfficialVerify? officialVerify; FollowItemModel.fromJson(Map json) { mid = json['mid']; @@ -48,6 +50,8 @@ class FollowItemModel { uname = json['uname']; face = json['face']; sign = json['sign'] == '' ? '还没有签名' : json['sign']; - officialVerify = json['official_verify']; + officialVerify = json['official_verify'] == null + ? null + : BaseOfficialVerify.fromJson(json['official_verify']); } } diff --git a/lib/models/home/rcmd/result.dart b/lib/models/home/rcmd/result.dart index 590da0a34..89ed4930d 100644 --- a/lib/models/home/rcmd/result.dart +++ b/lib/models/home/rcmd/result.dart @@ -8,7 +8,6 @@ class RecVideoItemAppModel extends BaseRecVideoItemModel { String? talkBack; String? cardType; - Map? adInfo; ThreePoint? threePoint; RecVideoItemAppModel.fromJson(Map json) { @@ -46,7 +45,6 @@ class RecVideoItemAppModel extends BaseRecVideoItemModel { } cardType = json['card_type']; - adInfo = json['ad_info']; threePoint = json['three_point_v2'] != null ? ThreePoint.fromJson(json['three_point_v2']) : null; diff --git a/lib/models/live/live_room/item.dart b/lib/models/live/live_room/item.dart index d3789d5b5..1d07f990e 100644 --- a/lib/models/live/live_room/item.dart +++ b/lib/models/live/live_room/item.dart @@ -1,3 +1,5 @@ +import 'package:PiliPlus/models/dynamics/result.dart'; + class LiveItemModel { LiveItemModel({ this.roomId, @@ -19,9 +21,6 @@ class LiveItemModel { this.sessionId, this.groupId, this.pkId, - this.verify, - this.headBox, - this.headBoxType, this.watchedShow, }); @@ -44,10 +43,7 @@ class LiveItemModel { String? sessionId; int? groupId; int? pkId; - Map? verify; - Map? headBox; - int? headBoxType; - Map? watchedShow; + WatchedShow? watchedShow; LiveItemModel.fromJson(Map json) { roomId = json['roomid']; @@ -69,9 +65,6 @@ class LiveItemModel { 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']; } } diff --git a/lib/models/live/live_room/room_info_h5.dart b/lib/models/live/live_room/room_info_h5.dart index f57c333d2..b8d93ce48 100644 --- a/lib/models/live/live_room/room_info_h5.dart +++ b/lib/models/live/live_room/room_info_h5.dart @@ -1,3 +1,5 @@ +import 'package:PiliPlus/models/dynamics/result.dart'; + class RoomInfoH5Model { RoomInfoH5Model({ this.roomInfo, @@ -5,15 +7,13 @@ class RoomInfoH5Model { this.isRoomFeed, this.watchedShow, this.likeInfoV3, - this.blockInfo, }); RoomInfo? roomInfo; AnchorInfo? anchorInfo; int? isRoomFeed; - Map? watchedShow; + WatchedShow? watchedShow; LikeInfoV3? likeInfoV3; - Map? blockInfo; RoomInfoH5Model.fromJson(Map json) { roomInfo = @@ -22,11 +22,12 @@ class RoomInfoH5Model { ? null : AnchorInfo.fromJson(json['anchor_info']); isRoomFeed = json['is_room_feed']; - watchedShow = json['watched_show']; + watchedShow = json['watched_show'] == null + ? null + : WatchedShow.fromJson(json['watched_show']); likeInfoV3 = json['like_info_v3'] == null ? null : LikeInfoV3.fromJson(json['like_info_v3']); - blockInfo = json['block_info']; } } diff --git a/lib/models/media_list/badge.dart b/lib/models/media_list/badge.dart new file mode 100644 index 000000000..04f09315f --- /dev/null +++ b/lib/models/media_list/badge.dart @@ -0,0 +1,13 @@ +class Badge { + String? text; + int? bgStyle; + String? img; + + Badge({this.text, this.bgStyle, this.img}); + + factory Badge.fromJson(Map json) => Badge( + text: json['text'] as String?, + bgStyle: json['bg_style'] as int?, + img: json['img'] as String?, + ); +} diff --git a/lib/models/media_list/cnt_info.dart b/lib/models/media_list/cnt_info.dart new file mode 100644 index 000000000..73b824998 --- /dev/null +++ b/lib/models/media_list/cnt_info.dart @@ -0,0 +1,41 @@ +class CntInfo { + int? collect; + int? play; + int? thumbUp; + int? thumbDown; + int? share; + int? reply; + int? danmaku; + int? coin; + int? vt; + int? playSwitch; + String? viewText1; + + CntInfo({ + this.collect, + this.play, + this.thumbUp, + this.thumbDown, + this.share, + this.reply, + this.danmaku, + this.coin, + this.vt, + this.playSwitch, + this.viewText1, + }); + + factory CntInfo.fromJson(Map json) => CntInfo( + collect: json['collect'] as int?, + play: json['play'] as int?, + thumbUp: json['thumb_up'] as int?, + thumbDown: json['thumb_down'] as int?, + share: json['share'] as int?, + reply: json['reply'] as int?, + danmaku: json['danmaku'] as int?, + coin: json['coin'] as int?, + vt: json['vt'] as int?, + playSwitch: json['play_switch'] as int?, + viewText1: json['view_text_1'] as String?, + ); +} diff --git a/lib/models/media_list/coin.dart b/lib/models/media_list/coin.dart new file mode 100644 index 000000000..3306d1433 --- /dev/null +++ b/lib/models/media_list/coin.dart @@ -0,0 +1,11 @@ +class Coin { + int? maxNum; + int? coinNumber; + + Coin({this.maxNum, this.coinNumber}); + + factory Coin.fromJson(Map json) => Coin( + maxNum: json['max_num'] as int?, + coinNumber: json['coin_number'] as int?, + ); +} diff --git a/lib/models/media_list/data.dart b/lib/models/media_list/data.dart new file mode 100644 index 000000000..1bcf7de2a --- /dev/null +++ b/lib/models/media_list/data.dart @@ -0,0 +1,20 @@ +import 'package:PiliPlus/models/media_list/media_list.dart'; + +class MediaListData { + List? mediaList; + bool? hasMore; + int? totalCount; + String? nextStartKey; + + MediaListData( + {this.mediaList, this.hasMore, this.totalCount, this.nextStartKey}); + + factory MediaListData.fromJson(Map json) => MediaListData( + mediaList: (json['media_list'] as List?) + ?.map((e) => MediaListItemModel.fromJson(e as Map)) + .toList(), + hasMore: json['has_more'] as bool?, + totalCount: json['total_count'] as int?, + nextStartKey: json['next_start_key'] as String?, + ); +} diff --git a/lib/models/media_list/dimension.dart b/lib/models/media_list/dimension.dart new file mode 100644 index 000000000..3de7639ce --- /dev/null +++ b/lib/models/media_list/dimension.dart @@ -0,0 +1,13 @@ +class Dimension { + int? width; + int? height; + int? rotate; + + Dimension({this.width, this.height, this.rotate}); + + factory Dimension.fromJson(Map json) => Dimension( + width: json['width'] as int?, + height: json['height'] as int?, + rotate: json['rotate'] as int?, + ); +} diff --git a/lib/models/media_list/media_list.dart b/lib/models/media_list/media_list.dart new file mode 100644 index 000000000..93b1dd503 --- /dev/null +++ b/lib/models/media_list/media_list.dart @@ -0,0 +1,113 @@ +import 'package:PiliPlus/models/media_list/badge.dart'; +import 'package:PiliPlus/models/media_list/cnt_info.dart'; +import 'package:PiliPlus/models/media_list/coin.dart'; +import 'package:PiliPlus/models/media_list/ogv_info.dart'; +import 'package:PiliPlus/models/media_list/page.dart'; +import 'package:PiliPlus/models/media_list/rights.dart'; +import 'package:PiliPlus/models/media_list/upper.dart'; +import 'package:PiliPlus/utils/extension.dart'; + +class MediaListItemModel { + int? get id => aid; + int? aid; + int? offset; + int? index; + String? intro; + int? attr; + int? tid; + int? copyRight; + CntInfo? cntInfo; + String? cover; + int? duration; + int? pubtime; + int? likeState; + int? favState; + int? page; + List? pages; + String? title; + int? type; + Upper? upper; + String? link; + String? bvid; + String? shortLink; + Rights? rights; + dynamic elecInfo; + Coin? coin; + OgvInfo? ogvInfo; + double? progressPercent; + Badge? badge; + bool? forbidFav; + int? moreType; + int? businessOid; + int? cid; + + MediaListItemModel({ + this.aid, + this.offset, + this.index, + this.intro, + this.attr, + this.tid, + this.copyRight, + this.cntInfo, + this.cover, + this.duration, + this.pubtime, + this.likeState, + this.favState, + this.page, + this.pages, + this.title, + this.type, + this.upper, + this.link, + this.bvid, + this.shortLink, + this.rights, + this.elecInfo, + this.coin, + this.ogvInfo, + this.progressPercent, + this.badge, + this.forbidFav, + this.moreType, + this.businessOid, + this.cid, + }); + + MediaListItemModel.fromJson(Map json) { + aid = json['id'] as int?; + offset = json['offset'] as int?; + index = json['index'] as int?; + intro = json['intro'] as String?; + attr = json['attr'] as int?; + tid = json['tid'] as int?; + copyRight = json['copy_right'] as int?; + cntInfo = + json['cnt_info'] == null ? null : CntInfo.fromJson(json['cnt_info']); + cover = json['cover'] as String?; + duration = json['duration'] as int?; + pubtime = json['pubtime'] as int?; + likeState = json['like_state'] as int?; + favState = json['fav_state'] as int?; + page = json['page'] as int?; + pages = (json['pages'] as List?)?.map((e) => Page.fromJson(e)).toList(); + title = json['title'] as String?; + type = json['type'] as int?; + upper = json['upper'] == null ? null : Upper.fromJson(json['upper']); + link = json['link'] as String?; + bvid = json['bv_id'] as String?; + shortLink = json['short_link'] as String?; + rights = json['rights'] == null ? null : Rights.fromJson(json['rights']); + elecInfo = json['elec_info'] as dynamic; + coin = json['coin'] == null ? null : Coin.fromJson(json['coin']); + ogvInfo = + json['ogv_info'] == null ? null : OgvInfo.fromJson(json['ogv_info']); + progressPercent = (json['progress_percent'] as num?)?.toDouble(); + badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); + forbidFav = json['forbid_fav'] as bool?; + moreType = json['more_type'] as int?; + businessOid = json['business_oid'] as int?; + cid = pages.getOrNull((page ?? 1) - 1)?.id; + } +} diff --git a/lib/models/media_list/ogv_info.dart b/lib/models/media_list/ogv_info.dart new file mode 100644 index 000000000..412b5b595 --- /dev/null +++ b/lib/models/media_list/ogv_info.dart @@ -0,0 +1,21 @@ +import 'package:PiliPlus/models/media_list/dimension.dart'; + +class OgvInfo { + int? epid; + int? seasonId; + int? aid; + int? cid; + Dimension? dimension; + + OgvInfo({this.epid, this.seasonId, this.aid, this.cid, this.dimension}); + + factory OgvInfo.fromJson(Map json) => OgvInfo( + epid: json['epid'] as int?, + seasonId: json['season_id'] as int?, + aid: json['aid'] as int?, + cid: json['cid'] as int?, + dimension: json['dimension'] == null + ? null + : Dimension.fromJson(json['dimension'] as Map), + ); +} diff --git a/lib/models/media_list/page.dart b/lib/models/media_list/page.dart new file mode 100644 index 000000000..14bd42de3 --- /dev/null +++ b/lib/models/media_list/page.dart @@ -0,0 +1,36 @@ +import 'package:PiliPlus/models/media_list/dimension.dart'; + +class Page { + int? id; + String? title; + String? intro; + int? duration; + String? link; + int? page; + String? from; + Dimension? dimension; + + Page({ + this.id, + this.title, + this.intro, + this.duration, + this.link, + this.page, + this.from, + this.dimension, + }); + + factory Page.fromJson(Map json) => Page( + id: json["id"], + title: json["title"], + intro: json["intro"], + duration: json["duration"], + link: json["link"], + page: json["page"], + from: json["from"], + dimension: json["dimension"] == null + ? null + : Dimension.fromJson(json["dimension"]), + ); +} diff --git a/lib/models/media_list/rights.dart b/lib/models/media_list/rights.dart new file mode 100644 index 000000000..df6c21182 --- /dev/null +++ b/lib/models/media_list/rights.dart @@ -0,0 +1,38 @@ +class Rights { + int? bp; + int? elec; + int? download; + int? movie; + int? pay; + int? ugcPay; + int? hd5; + int? noReprint; + int? autoplay; + int? noBackground; + + Rights({ + this.bp, + this.elec, + this.download, + this.movie, + this.pay, + this.ugcPay, + this.hd5, + this.noReprint, + this.autoplay, + this.noBackground, + }); + + factory Rights.fromJson(Map json) => Rights( + bp: json['bp'] as int?, + elec: json['elec'] as int?, + download: json['download'] as int?, + movie: json['movie'] as int?, + pay: json['pay'] as int?, + ugcPay: json['ugc_pay'] as int?, + hd5: json['hd5'] as int?, + noReprint: json['no_reprint'] as int?, + autoplay: json['autoplay'] as int?, + noBackground: json['no_background'] as int?, + ); +} diff --git a/lib/models/media_list/upper.dart b/lib/models/media_list/upper.dart new file mode 100644 index 000000000..5e488a09e --- /dev/null +++ b/lib/models/media_list/upper.dart @@ -0,0 +1,47 @@ +class Upper { + int? mid; + String? name; + String? face; + int? followed; + int? fans; + int? vipType; + int? vipStatue; + int? vipDueDate; + int? vipPayType; + int? officialRole; + String? officialTitle; + String? officialDesc; + String? displayName; + + Upper({ + this.mid, + this.name, + this.face, + this.followed, + this.fans, + this.vipType, + this.vipStatue, + this.vipDueDate, + this.vipPayType, + this.officialRole, + this.officialTitle, + this.officialDesc, + this.displayName, + }); + + factory Upper.fromJson(Map json) => Upper( + mid: json['mid'] as int?, + name: json['name'] as String?, + face: json['face'] as String?, + followed: json['followed'] as int?, + fans: json['fans'] as int?, + vipType: json['vip_type'] as int?, + vipStatue: json['vip_statue'] as int?, + vipDueDate: json['vip_due_date'] as int?, + vipPayType: json['vip_pay_type'] as int?, + officialRole: json['official_role'] as int?, + officialTitle: json['official_title'] as String?, + officialDesc: json['official_desc'] as String?, + displayName: json['display_name'] as String?, + ); +} diff --git a/lib/models/member/info.dart b/lib/models/member/info.dart index e602d3164..61e576ffb 100644 --- a/lib/models/member/info.dart +++ b/lib/models/member/info.dart @@ -1,3 +1,4 @@ +import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/models/model_avatar.dart'; class MemberInfoModel { @@ -24,7 +25,7 @@ class MemberInfoModel { int? level; bool? isFollowed; String? topPhoto; - Map? official; + BaseOfficialVerify? official; Vip? vip; LiveRoom? liveRoom; int? isSeniorMember; @@ -38,7 +39,9 @@ class MemberInfoModel { level = json['level']; isFollowed = json['is_followed']; topPhoto = json['top_photo']; - official = json['official']; + official = json['official'] == null + ? null + : BaseOfficialVerify.fromJson(json['official']); vip = Vip.fromJson(json['vip']); liveRoom = json['live_room'] != null ? LiveRoom.fromJson(json['live_room']) : null; @@ -65,7 +68,7 @@ class LiveRoom { String? cover; int? roomId; int? roundStatus; - Map? watchedShow; + WatchedShow? watchedShow; LiveRoom.fromJson(Map json) { roomStatus = json['roomStatus']; @@ -75,6 +78,8 @@ class LiveRoom { cover = json['cover']; roomId = json['roomid']; roundStatus = json['roundStatus']; - watchedShow = json['watched_show']; + watchedShow = json['watched_show'] == null + ? null + : WatchedShow.fromJson(json['watched_show']); } } diff --git a/lib/models/msg/msgfeed_sys_msg.dart b/lib/models/msg/msgfeed_sys_msg.dart index a89215420..6e856aa02 100644 --- a/lib/models/msg/msgfeed_sys_msg.dart +++ b/lib/models/msg/msgfeed_sys_msg.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + class SystemNotifyList { int? id; int? cursor; @@ -46,7 +48,18 @@ class SystemNotifyList { : null; type = json['type']; title = json['title']; - content = json['content']; + if (json['content'] != null) { + try { + dynamic jsonContent = jsonDecode(json['content']); + if (jsonContent?['web'] != null) { + content = jsonContent['web']; + } else { + content = json['content']; + } + } catch (_) { + content = json['content']; + } + } source = json['source'] != null ? Source.fromJson(json['source']) : null; timeAt = json['time_at']; cardType = json['card_type']; diff --git a/lib/models/pgc/info.dart b/lib/models/pgc/info.dart deleted file mode 100644 index 5c33d11ab..000000000 --- a/lib/models/pgc/info.dart +++ /dev/null @@ -1,315 +0,0 @@ -class BangumiInfoModel { - BangumiInfoModel({ - this.activity, - this.actors, - this.alias, - this.areas, - this.bkgCover, - this.cover, - this.enableVt, - this.episodes, - this.evaluate, - this.freya, - this.jpTitle, - this.link, - this.mediaId, - this.newEp, - this.playStrategy, - this.positive, - this.publish, - this.rating, - this.record, - this.rights, - this.seasonId, - this.seasonTitle, - this.seasons, - this.series, - this.shareCopy, - this.shareSubTitle, - this.shareUrl, - this.show, - this.showSeasonType, - this.squareCover, - this.stat, - this.status, - this.styles, - this.subTitle, - this.title, - this.total, - this.type, - this.userStatus, - this.staff, - }); - - Map? activity; - String? actors; - String? alias; - List? areas; - String? bkgCover; - String? cover; - String? enableVt; - List? episodes; - String? evaluate; - Map? freya; - String? jpTitle; - String? link; - int? mediaId; - Map? newEp; - Map? playStrategy; - Map? positive; - Map? publish; - Map? rating; - String? record; - Map? rights; - int? seasonId; - String? seasonTitle; - List? seasons; - Map? series; - String? shareCopy; - String? shareSubTitle; - String? shareUrl; - Map? show; - int? showSeasonType; - String? squareCover; - Map? stat; - int? status; - List? styles; - String? subTitle; - String? title; - int? total; - int? type; - UserStatus? userStatus; - String? staff; - List
? section; - - BangumiInfoModel.fromJson(Map json) { - activity = json['activity']; - actors = json['actors']; - alias = json['alias']; - areas = json['areas']; - bkgCover = json['bkg_cover']; - cover = json['cover']; - enableVt = json['enableVt']; - episodes = (json['episodes'] as List?) - ?.map((e) => EpisodeItem.fromJson(e)) - .toList(); - evaluate = json['evaluate']; - freya = json['freya']; - jpTitle = json['jp_title']; - link = json['link']; - mediaId = json['media_id']; - newEp = json['new_ep']; - playStrategy = json['play_strategy']; - positive = json['positive']; - publish = json['publish']; - rating = json['rating']; - record = json['record']; - rights = json['rights']; - seasonId = json['season_id']; - seasonTitle = json['season_title']; - seasons = json['seasons']; - series = json['series']; - shareCopy = json['share_copy']; - shareSubTitle = json['share_sub_title']; - shareUrl = json['share_url']; - show = json['show']; - showSeasonType = json['show_season_type']; - squareCover = json['square_cover']; - stat = json['stat']; - status = json['status']; - styles = json['styles']; - subTitle = json['sub_title']; - title = json['title']; - total = json['total']; - type = json['type']; - if (json['user_status'] != null) { - userStatus = UserStatus.fromJson(json['user_status']); - } - staff = json['staff']; - section = (json['section'] as List?) - ?.map((item) => Section.fromJson(item)) - .toList(); - } -} - -class Section { - Section({ - this.episodes, - }); - List? episodes; - - Section.fromJson(Map json) { - episodes = (json['episodes'] as List?) - ?.map((e) => EpisodeItem.fromJson(e)) - .toList(); - } -} - -class EpisodeItem { - EpisodeItem({ - this.aid, - this.badge, - this.badgeInfo, - this.badgeType, - this.bvid, - this.cid, - this.cover, - this.dimension, - this.duration, - this.enableVt, - this.epId, - this.from, - this.id, - this.isViewHide, - this.link, - this.longTitle, - this.pubTime, - this.pv, - this.releaseDate, - this.rights, - this.shareCopy, - this.shareUrl, - this.shortLink, - this.skip, - this.status, - this.subtitle, - this.title, - this.vid, - this.showTitle, - }); - - int? aid; - String? badge; - Map? badgeInfo; - int? badgeType; - String? bvid; - int? cid; - String? cover; - Map? dimension; - int? duration; - bool? enableVt; - int? epId; - String? from; - int? id; - bool? isViewHide; - String? link; - String? longTitle; - int? pubTime; - int? pv; - String? releaseDate; - Map? rights; - String? shareCopy; - String? shareUrl; - String? shortLink; - Map? skip; - int? status; - String? subtitle; - String? title; - String? vid; - String? showTitle; - - EpisodeItem.fromJson(Map json) { - aid = json['aid']; - badge = json['badge'] != '' ? json['badge'] : null; - badgeInfo = json['badge_info']; - badgeType = json['badge_type']; - bvid = json['bvid']; - cid = json['cid']; - cover = json['cover']; - dimension = json['dimension']; - duration = json['duration']; - enableVt = json['enable_vt']; - epId = json['ep_id']; - from = json['from']; - id = json['id']; - isViewHide = json['is_view_hide']; - link = json['link']; - longTitle = json['long_title']; - pubTime = json['pub_time']; - pv = json['pv']; - releaseDate = json['release_date']; - rights = json['rights']; - shareCopy = json['share_copy']; - shareUrl = json['share_url']; - shortLink = json['short_link']; - skip = json['skip']; - status = json['status']; - subtitle = json['subtitle']; - title = json['title']; - vid = json['vid']; - showTitle = json['show_title']; - } -} - -class UserStatus { - UserStatus({ - this.areaLimit, - this.banAreaShow, - this.follow, - this.followStatus, - this.login, - this.pay, - this.payPackPaid, - this.progress, - this.sponsor, - this.vipInfo, - }); - int? areaLimit; - int? banAreaShow; - int? follow; - int? followStatus; - int? login; - int? pay; - int? payPackPaid; - UserProgress? progress; - int? sponsor; - VipInfo? vipInfo; - UserStatus.fromJson(Map json) { - areaLimit = json['area_limit']; - banAreaShow = json['ban_area_show']; - follow = json['follow']; - followStatus = json['follow_status']; - login = json['login']; - pay = json['pay']; - payPackPaid = json['pay_pack_paid']; - if (json['progress'] != null) { - progress = UserProgress.fromJson(json['progress']); - } - sponsor = json['sponsor']; - if (json['vip_info'] != null) { - vipInfo = VipInfo.fromJson(json['vip_info']); - } - } -} - -class UserProgress { - UserProgress({ - this.lastEpId, - this.lastEpIndex, - this.lastTime, - }); - int? lastEpId; - String? lastEpIndex; - int? lastTime; - UserProgress.fromJson(Map json) { - lastEpId = json['last_ep_id']; - lastEpIndex = json['last_ep_index']; - lastTime = json['last_time']; - } -} - -class VipInfo { - VipInfo({ - this.dueDate, - this.status, - this.type, - }); - int? dueDate; - int? status; - int? type; - VipInfo.fromJson(Map json) { - dueDate = json['due_date']; - status = json['status']; - type = json['type']; - } -} diff --git a/lib/models/pgc/pgc_info_model/activity.dart b/lib/models/pgc/pgc_info_model/activity.dart new file mode 100644 index 000000000..5cf410342 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/activity.dart @@ -0,0 +1,13 @@ +class Activity { + String? headBgUrl; + int? id; + String? title; + + Activity({this.headBgUrl, this.id, this.title}); + + factory Activity.fromJson(Map json) => Activity( + headBgUrl: json['head_bg_url'] as String?, + id: json['id'] as int?, + title: json['title'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/area.dart b/lib/models/pgc/pgc_info_model/area.dart new file mode 100644 index 000000000..5f1e57637 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/area.dart @@ -0,0 +1,11 @@ +class Area { + int? id; + String? name; + + Area({this.id, this.name}); + + factory Area.fromJson(Map json) => Area( + id: json['id'] as int?, + name: json['name'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/badge_info.dart b/lib/models/pgc/pgc_info_model/badge_info.dart new file mode 100644 index 000000000..3b929ee6c --- /dev/null +++ b/lib/models/pgc/pgc_info_model/badge_info.dart @@ -0,0 +1,13 @@ +class BadgeInfo { + String? bgColor; + String? bgColorNight; + String? text; + + BadgeInfo({this.bgColor, this.bgColorNight, this.text}); + + factory BadgeInfo.fromJson(Map json) => BadgeInfo( + bgColor: json['bg_color'] as String?, + bgColorNight: json['bg_color_night'] as String?, + text: json['text'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/danmaku.dart b/lib/models/pgc/pgc_info_model/danmaku.dart new file mode 100644 index 000000000..ea31c5ef4 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/danmaku.dart @@ -0,0 +1,15 @@ +class Danmaku { + String? icon; + String? pureText; + String? text; + int? value; + + Danmaku({this.icon, this.pureText, this.text, this.value}); + + factory Danmaku.fromJson(Map json) => Danmaku( + icon: json['icon'] as String?, + pureText: json['pure_text'] as String?, + text: json['text'] as String?, + value: json['value'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/dimension.dart b/lib/models/pgc/pgc_info_model/dimension.dart new file mode 100644 index 000000000..5b7cb9018 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/dimension.dart @@ -0,0 +1,13 @@ +class Dimension { + int? height; + int? rotate; + int? width; + + Dimension({this.height, this.rotate, this.width}); + + factory Dimension.fromJson(Map json) => Dimension( + height: json['height'] as int?, + rotate: json['rotate'] as int?, + width: json['width'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/ed.dart b/lib/models/pgc/pgc_info_model/ed.dart new file mode 100644 index 000000000..012f33da5 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/ed.dart @@ -0,0 +1,11 @@ +class Ed { + int? end; + int? start; + + Ed({this.end, this.start}); + + factory Ed.fromJson(Map json) => Ed( + end: json['end'] as int?, + start: json['start'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/episode.dart b/lib/models/pgc/pgc_info_model/episode.dart new file mode 100644 index 000000000..e16738f4c --- /dev/null +++ b/lib/models/pgc/pgc_info_model/episode.dart @@ -0,0 +1,114 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/badge_info.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/dimension.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/rights.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/skip.dart'; + +class EpisodeItem { + int? aid; + String? badge; + BadgeInfo? badgeInfo; + int? badgeType; + String? bvid; + int? cid; + String? cover; + Dimension? dimension; + int? duration; + bool? enableVt; + int? epId; + String? from; + int? id; + bool? isViewHide; + String? link; + String? longTitle; + int? pubTime; + int? pv; + String? releaseDate; + Rights? rights; + int? sectionType; + String? shareCopy; + String? shareUrl; + String? shortLink; + bool? showDrmLoginDialog; + String? showTitle; + Skip? skip; + int? status; + String? subtitle; + String? title; + String? vid; + + EpisodeItem({ + this.aid, + this.badge, + this.badgeInfo, + this.badgeType, + this.bvid, + this.cid, + this.cover, + this.dimension, + this.duration, + this.enableVt, + this.epId, + this.from, + this.id, + this.isViewHide, + this.link, + this.longTitle, + this.pubTime, + this.pv, + this.releaseDate, + this.rights, + this.sectionType, + this.shareCopy, + this.shareUrl, + this.shortLink, + this.showDrmLoginDialog, + this.showTitle, + this.skip, + this.status, + this.subtitle, + this.title, + this.vid, + }); + + factory EpisodeItem.fromJson(Map json) => EpisodeItem( + aid: json['aid'] as int?, + badge: json['badge'] as String?, + badgeInfo: json['badge_info'] == null + ? null + : BadgeInfo.fromJson(json['badge_info'] as Map), + badgeType: json['badge_type'] as int?, + bvid: json['bvid'] as String?, + cid: json['cid'] as int?, + cover: json['cover'] as String?, + dimension: json['dimension'] == null + ? null + : Dimension.fromJson(json['dimension'] as Map), + duration: json['duration'] as int?, + enableVt: json['enable_vt'] as bool?, + epId: json['ep_id'] as int?, + from: json['from'] as String?, + id: json['id'] as int?, + isViewHide: json['is_view_hide'] as bool?, + link: json['link'] as String?, + longTitle: json['long_title'] as String?, + pubTime: json['pub_time'] as int?, + pv: json['pv'] as int?, + releaseDate: json['release_date'] as String?, + rights: json['rights'] == null + ? null + : Rights.fromJson(json['rights'] as Map), + sectionType: json['section_type'] as int?, + shareCopy: json['share_copy'] as String?, + shareUrl: json['share_url'] as String?, + shortLink: json['short_link'] as String?, + showDrmLoginDialog: json['showDrmLoginDialog'] as bool?, + showTitle: json['show_title'] as String?, + skip: json['skip'] == null + ? null + : Skip.fromJson(json['skip'] as Map), + status: json['status'] as int?, + subtitle: json['subtitle'] as String?, + title: json['title'] as String?, + vid: json['vid'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/freya.dart b/lib/models/pgc/pgc_info_model/freya.dart new file mode 100644 index 000000000..ad9705e76 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/freya.dart @@ -0,0 +1,11 @@ +class Freya { + int? bubbleShowCnt; + int? iconShow; + + Freya({this.bubbleShowCnt, this.iconShow}); + + factory Freya.fromJson(Map json) => Freya( + bubbleShowCnt: json['bubble_show_cnt'] as int?, + iconShow: json['icon_show'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/icon_font.dart b/lib/models/pgc/pgc_info_model/icon_font.dart new file mode 100644 index 000000000..ce163b037 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/icon_font.dart @@ -0,0 +1,11 @@ +class IconFont { + String? name; + String? text; + + IconFont({this.name, this.text}); + + factory IconFont.fromJson(Map json) => IconFont( + name: json['name'] as String?, + text: json['text'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/new_ep.dart b/lib/models/pgc/pgc_info_model/new_ep.dart new file mode 100644 index 000000000..5ff26beaf --- /dev/null +++ b/lib/models/pgc/pgc_info_model/new_ep.dart @@ -0,0 +1,15 @@ +class NewEp { + String? desc; + int? id; + int? isNew; + String? title; + + NewEp({this.desc, this.id, this.isNew, this.title}); + + factory NewEp.fromJson(Map json) => NewEp( + desc: json['desc'] as String?, + id: json['id'] as int?, + isNew: json['is_new'] as int?, + title: json['title'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/op.dart b/lib/models/pgc/pgc_info_model/op.dart new file mode 100644 index 000000000..e5bb3dfd2 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/op.dart @@ -0,0 +1,11 @@ +class Op { + int? end; + int? start; + + Op({this.end, this.start}); + + factory Op.fromJson(Map json) => Op( + end: json['end'] as int?, + start: json['start'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/pay_type.dart b/lib/models/pgc/pgc_info_model/pay_type.dart new file mode 100644 index 000000000..935d5de9b --- /dev/null +++ b/lib/models/pgc/pgc_info_model/pay_type.dart @@ -0,0 +1,26 @@ +class PayType { + int? allowDiscount; + int? allowPack; + int? allowTicket; + int? allowTimeLimit; + int? allowVipDiscount; + int? forbidBb; + + PayType({ + this.allowDiscount, + this.allowPack, + this.allowTicket, + this.allowTimeLimit, + this.allowVipDiscount, + this.forbidBb, + }); + + factory PayType.fromJson(Map json) => PayType( + allowDiscount: json['allow_discount'] as int?, + allowPack: json['allow_pack'] as int?, + allowTicket: json['allow_ticket'] as int?, + allowTimeLimit: json['allow_time_limit'] as int?, + allowVipDiscount: json['allow_vip_discount'] as int?, + forbidBb: json['forbid_bb'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/payment.dart b/lib/models/pgc/pgc_info_model/payment.dart new file mode 100644 index 000000000..3f4accb06 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/payment.dart @@ -0,0 +1,42 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/pay_type.dart'; + +class Payment { + int? discount; + PayType? payType; + String? price; + String? promotion; + String? tip; + int? viewStartTime; + int? vipDiscount; + String? vipFirstPromotion; + String? vipPrice; + String? vipPromotion; + + Payment({ + this.discount, + this.payType, + this.price, + this.promotion, + this.tip, + this.viewStartTime, + this.vipDiscount, + this.vipFirstPromotion, + this.vipPrice, + this.vipPromotion, + }); + + factory Payment.fromJson(Map json) => Payment( + discount: json['discount'] as int?, + payType: json['pay_type'] == null + ? null + : PayType.fromJson(json['pay_type'] as Map), + price: json['price'] as String?, + promotion: json['promotion'] as String?, + tip: json['tip'] as String?, + viewStartTime: json['view_start_time'] as int?, + vipDiscount: json['vip_discount'] as int?, + vipFirstPromotion: json['vip_first_promotion'] as String?, + vipPrice: json['vip_price'] as String?, + vipPromotion: json['vip_promotion'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/pendant.dart b/lib/models/pgc/pgc_info_model/pendant.dart new file mode 100644 index 000000000..0044518fd --- /dev/null +++ b/lib/models/pgc/pgc_info_model/pendant.dart @@ -0,0 +1,13 @@ +class Pendant { + String? image; + String? name; + int? pid; + + Pendant({this.image, this.name, this.pid}); + + factory Pendant.fromJson(Map json) => Pendant( + image: json['image'] as String?, + name: json['name'] as String?, + pid: json['pid'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/play_strategy.dart b/lib/models/pgc/pgc_info_model/play_strategy.dart new file mode 100644 index 000000000..5bf729d02 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/play_strategy.dart @@ -0,0 +1,9 @@ +class PlayStrategy { + List? strategies; + + PlayStrategy({this.strategies}); + + factory PlayStrategy.fromJson(Map json) => PlayStrategy( + strategies: json['strategies'], + ); +} diff --git a/lib/models/pgc/pgc_info_model/positive.dart b/lib/models/pgc/pgc_info_model/positive.dart new file mode 100644 index 000000000..41c859a73 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/positive.dart @@ -0,0 +1,11 @@ +class Positive { + int? id; + String? title; + + Positive({this.id, this.title}); + + factory Positive.fromJson(Map json) => Positive( + id: json['id'] as int?, + title: json['title'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/publish.dart b/lib/models/pgc/pgc_info_model/publish.dart new file mode 100644 index 000000000..071511247 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/publish.dart @@ -0,0 +1,26 @@ +class Publish { + int? isFinish; + int? isStarted; + String? pubTime; + String? pubTimeShow; + int? unknowPubDate; + int? weekday; + + Publish({ + this.isFinish, + this.isStarted, + this.pubTime, + this.pubTimeShow, + this.unknowPubDate, + this.weekday, + }); + + factory Publish.fromJson(Map json) => Publish( + isFinish: json['is_finish'] as int?, + isStarted: json['is_started'] as int?, + pubTime: json['pub_time'] as String?, + pubTimeShow: json['pub_time_show'] as String?, + unknowPubDate: json['unknow_pub_date'] as int?, + weekday: json['weekday'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/rating.dart b/lib/models/pgc/pgc_info_model/rating.dart new file mode 100644 index 000000000..23300acdf --- /dev/null +++ b/lib/models/pgc/pgc_info_model/rating.dart @@ -0,0 +1,11 @@ +class Rating { + int? count; + double? score; + + Rating({this.count, this.score}); + + factory Rating.fromJson(Map json) => Rating( + count: json['count'] as int?, + score: (json['score'] as num?)?.toDouble(), + ); +} diff --git a/lib/models/pgc/pgc_info_model/result.dart b/lib/models/pgc/pgc_info_model/result.dart new file mode 100644 index 000000000..0a02162ed --- /dev/null +++ b/lib/models/pgc/pgc_info_model/result.dart @@ -0,0 +1,206 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/activity.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/area.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/episode.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/freya.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/icon_font.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/new_ep.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/payment.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/play_strategy.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/positive.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/publish.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/rating.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/rights.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/season.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/section.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/series.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/show.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/stat.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/up_info.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/user_status.dart'; + +class BangumiInfoModel { + Activity? activity; + String? actors; + String? alias; + List? areas; + String? bkgCover; + String? cover; + bool? deliveryFragmentVideo; + bool? enableVt; + List? episodes; + String? evaluate; + Freya? freya; + int? hideEpVvVtDm; + IconFont? iconFont; + String? jpTitle; + String? link; + int? mediaId; + int? mode; + NewEp? newEp; + Payment? payment; + PlayStrategy? playStrategy; + Positive? positive; + Publish? publish; + Rating? rating; + String? record; + Rights? rights; + int? seasonId; + String? seasonTitle; + List? seasons; + List
? section; + Series? series; + String? shareCopy; + String? shareSubTitle; + String? shareUrl; + Show? show; + int? showSeasonType; + String? squareCover; + String? staff; + Stat? stat; + int? status; + List? styles; + String? subtitle; + String? title; + int? total; + int? type; + UpInfo? upInfo; + UserStatus? userStatus; + + BangumiInfoModel({ + this.activity, + this.actors, + this.alias, + this.areas, + this.bkgCover, + this.cover, + this.deliveryFragmentVideo, + this.enableVt, + this.episodes, + this.evaluate, + this.freya, + this.hideEpVvVtDm, + this.iconFont, + this.jpTitle, + this.link, + this.mediaId, + this.mode, + this.newEp, + this.payment, + this.playStrategy, + this.positive, + this.publish, + this.rating, + this.record, + this.rights, + this.seasonId, + this.seasonTitle, + this.seasons, + this.section, + this.series, + this.shareCopy, + this.shareSubTitle, + this.shareUrl, + this.show, + this.showSeasonType, + this.squareCover, + this.staff, + this.stat, + this.status, + this.styles, + this.subtitle, + this.title, + this.total, + this.type, + this.upInfo, + this.userStatus, + }); + + factory BangumiInfoModel.fromJson(Map json) => + BangumiInfoModel( + activity: json['activity'] == null + ? null + : Activity.fromJson(json['activity'] as Map), + actors: json['actors'] as String?, + alias: json['alias'] as String?, + areas: (json['areas'] as List?) + ?.map((e) => Area.fromJson(e as Map)) + .toList(), + bkgCover: json['bkg_cover'] as String?, + cover: json['cover'] as String?, + deliveryFragmentVideo: json['delivery_fragment_video'] as bool?, + enableVt: json['enable_vt'] as bool?, + episodes: (json['episodes'] as List?) + ?.map((e) => EpisodeItem.fromJson(e as Map)) + .toList(), + evaluate: json['evaluate'] as String?, + freya: json['freya'] == null + ? null + : Freya.fromJson(json['freya'] as Map), + hideEpVvVtDm: json['hide_ep_vv_vt_dm'] as int?, + iconFont: json['icon_font'] == null + ? null + : IconFont.fromJson(json['icon_font'] as Map), + jpTitle: json['jp_title'] as String?, + link: json['link'] as String?, + mediaId: json['media_id'] as int?, + mode: json['mode'] as int?, + newEp: json['new_ep'] == null + ? null + : NewEp.fromJson(json['new_ep'] as Map), + payment: json['payment'] == null + ? null + : Payment.fromJson(json['payment'] as Map), + playStrategy: json['play_strategy'] == null + ? null + : PlayStrategy.fromJson( + json['play_strategy'] as Map), + positive: json['positive'] == null + ? null + : Positive.fromJson(json['positive'] as Map), + publish: json['publish'] == null + ? null + : Publish.fromJson(json['publish'] as Map), + rating: json['rating'] == null + ? null + : Rating.fromJson(json['rating'] as Map), + record: json['record'] as String?, + rights: json['rights'] == null + ? null + : Rights.fromJson(json['rights'] as Map), + seasonId: json['season_id'] as int?, + seasonTitle: json['season_title'] as String?, + seasons: (json['seasons'] as List?) + ?.map((e) => Season.fromJson(e as Map)) + .toList(), + section: (json['section'] as List?) + ?.map((e) => Section.fromJson(e as Map)) + .toList(), + series: json['series'] == null + ? null + : Series.fromJson(json['series'] as Map), + shareCopy: json['share_copy'] as String?, + shareSubTitle: json['share_sub_title'] as String?, + shareUrl: json['share_url'] as String?, + show: json['show'] == null + ? null + : Show.fromJson(json['show'] as Map), + showSeasonType: json['show_season_type'] as int?, + squareCover: json['square_cover'] as String?, + staff: json['staff'] as String?, + stat: json['stat'] == null + ? null + : Stat.fromJson(json['stat'] as Map), + status: json['status'] as int?, + styles: json['styles'], + subtitle: json['subtitle'] as String?, + title: json['title'] as String?, + total: json['total'] as int?, + type: json['type'] as int?, + upInfo: json['up_info'] == null + ? null + : UpInfo.fromJson(json['up_info'] as Map), + userStatus: json['user_status'] == null + ? null + : UserStatus.fromJson(json['user_status'] as Map), + ); +} diff --git a/lib/models/pgc/pgc_info_model/rights.dart b/lib/models/pgc/pgc_info_model/rights.dart new file mode 100644 index 000000000..b774a73a9 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/rights.dart @@ -0,0 +1,13 @@ +class Rights { + int? allowDm; + int? allowDownload; + int? areaLimit; + + Rights({this.allowDm, this.allowDownload, this.areaLimit}); + + factory Rights.fromJson(Map json) => Rights( + allowDm: json['allow_dm'] as int?, + allowDownload: json['allow_download'] as int?, + areaLimit: json['area_limit'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/season.dart b/lib/models/pgc/pgc_info_model/season.dart new file mode 100644 index 000000000..794fd8d97 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/season.dart @@ -0,0 +1,63 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/badge_info.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/icon_font.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/new_ep.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/stat.dart'; + +class Season { + String? badge; + BadgeInfo? badgeInfo; + int? badgeType; + String? cover; + bool? enableVt; + String? horizontalCover1610; + String? horizontalCover169; + IconFont? iconFont; + int? mediaId; + NewEp? newEp; + int? seasonId; + String? seasonTitle; + int? seasonType; + Stat? stat; + + Season({ + this.badge, + this.badgeInfo, + this.badgeType, + this.cover, + this.enableVt, + this.horizontalCover1610, + this.horizontalCover169, + this.iconFont, + this.mediaId, + this.newEp, + this.seasonId, + this.seasonTitle, + this.seasonType, + this.stat, + }); + + factory Season.fromJson(Map json) => Season( + badge: json['badge'] as String?, + badgeInfo: json['badge_info'] == null + ? null + : BadgeInfo.fromJson(json['badge_info'] as Map), + badgeType: json['badge_type'] as int?, + cover: json['cover'] as String?, + enableVt: json['enable_vt'] as bool?, + horizontalCover1610: json['horizontal_cover_1610'] as String?, + horizontalCover169: json['horizontal_cover_169'] as String?, + iconFont: json['icon_font'] == null + ? null + : IconFont.fromJson(json['icon_font'] as Map), + mediaId: json['media_id'] as int?, + newEp: json['new_ep'] == null + ? null + : NewEp.fromJson(json['new_ep'] as Map), + seasonId: json['season_id'] as int?, + seasonTitle: json['season_title'] as String?, + seasonType: json['season_type'] as int?, + stat: json['stat'] == null + ? null + : Stat.fromJson(json['stat'] as Map), + ); +} diff --git a/lib/models/pgc/pgc_info_model/section.dart b/lib/models/pgc/pgc_info_model/section.dart new file mode 100644 index 000000000..36f2b2863 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/section.dart @@ -0,0 +1,36 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/episode.dart'; + +class Section { + int? attr; + int? episodeId; + List? episodeIds; + List? episodes; + int? id; + String? title; + int? type; + int? type2; + + Section({ + this.attr, + this.episodeId, + this.episodeIds, + this.episodes, + this.id, + this.title, + this.type, + this.type2, + }); + + factory Section.fromJson(Map json) => Section( + attr: json['attr'] as int?, + episodeId: json['episode_id'] as int?, + episodeIds: json['episode_ids'] as List?, + episodes: (json['episodes'] as List?) + ?.map((e) => EpisodeItem.fromJson(e as Map)) + .toList(), + id: json['id'] as int?, + title: json['title'] as String?, + type: json['type'] as int?, + type2: json['type2'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/series.dart b/lib/models/pgc/pgc_info_model/series.dart new file mode 100644 index 000000000..9ac034d98 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/series.dart @@ -0,0 +1,13 @@ +class Series { + int? displayType; + int? seriesId; + String? seriesTitle; + + Series({this.displayType, this.seriesId, this.seriesTitle}); + + factory Series.fromJson(Map json) => Series( + displayType: json['display_type'] as int?, + seriesId: json['series_id'] as int?, + seriesTitle: json['series_title'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/show.dart b/lib/models/pgc/pgc_info_model/show.dart new file mode 100644 index 000000000..3e4b1184c --- /dev/null +++ b/lib/models/pgc/pgc_info_model/show.dart @@ -0,0 +1,9 @@ +class Show { + int? wideScreen; + + Show({this.wideScreen}); + + factory Show.fromJson(Map json) => Show( + wideScreen: json['wide_screen'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/skip.dart b/lib/models/pgc/pgc_info_model/skip.dart new file mode 100644 index 000000000..d5acbb8dc --- /dev/null +++ b/lib/models/pgc/pgc_info_model/skip.dart @@ -0,0 +1,18 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/ed.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/op.dart'; + +class Skip { + Ed? ed; + Op? op; + + Skip({this.ed, this.op}); + + factory Skip.fromJson(Map json) => Skip( + ed: json['ed'] == null + ? null + : Ed.fromJson(json['ed'] as Map), + op: json['op'] == null + ? null + : Op.fromJson(json['op'] as Map), + ); +} diff --git a/lib/models/pgc/pgc_info_model/stat.dart b/lib/models/pgc/pgc_info_model/stat.dart new file mode 100644 index 000000000..52357a96f --- /dev/null +++ b/lib/models/pgc/pgc_info_model/stat.dart @@ -0,0 +1,38 @@ +class Stat { + int? coins; + int? danmakus; + int? favorite; + int? favorites; + String? followText; + int? likes; + int? reply; + int? share; + int? views; + int? vt; + + Stat({ + this.coins, + this.danmakus, + this.favorite, + this.favorites, + this.followText, + this.likes, + this.reply, + this.share, + this.views, + this.vt, + }); + + factory Stat.fromJson(Map json) => Stat( + coins: json["coins"], + danmakus: json["danmakus"], + favorite: json["favorite"], + favorites: json["favorites"], + followText: json["follow_text"], + likes: json["likes"], + reply: json["reply"], + share: json["share"], + views: json["views"], + vt: json["vt"], + ); +} diff --git a/lib/models/pgc/pgc_info_model/stat_for_unity.dart b/lib/models/pgc/pgc_info_model/stat_for_unity.dart new file mode 100644 index 000000000..a19ea654e --- /dev/null +++ b/lib/models/pgc/pgc_info_model/stat_for_unity.dart @@ -0,0 +1,24 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/danmaku.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/vt.dart'; + +class StatForUnity { + int? coin; + Danmaku? danmaku; + int? likes; + int? reply; + Vt? vt; + + StatForUnity({this.coin, this.danmaku, this.likes, this.reply, this.vt}); + + factory StatForUnity.fromJson(Map json) => StatForUnity( + coin: json['coin'] as int?, + danmaku: json['danmaku'] == null + ? null + : Danmaku.fromJson(json['danmaku'] as Map), + likes: json['likes'] as int?, + reply: json['reply'] as int?, + vt: json['vt'] == null + ? null + : Vt.fromJson(json['vt'] as Map), + ); +} diff --git a/lib/models/pgc/pgc_info_model/up_info.dart b/lib/models/pgc/pgc_info_model/up_info.dart new file mode 100644 index 000000000..209aad9cc --- /dev/null +++ b/lib/models/pgc/pgc_info_model/up_info.dart @@ -0,0 +1,54 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/pendant.dart'; +import 'package:PiliPlus/models/pgc/pgc_info_model/vip_label.dart'; + +class UpInfo { + String? avatar; + String? avatarSubscriptUrl; + int? follower; + int? isFollow; + int? mid; + String? nicknameColor; + Pendant? pendant; + int? themeType; + String? uname; + int? verifyType; + VipLabel? vipLabel; + int? vipStatus; + int? vipType; + + UpInfo({ + this.avatar, + this.avatarSubscriptUrl, + this.follower, + this.isFollow, + this.mid, + this.nicknameColor, + this.pendant, + this.themeType, + this.uname, + this.verifyType, + this.vipLabel, + this.vipStatus, + this.vipType, + }); + + factory UpInfo.fromJson(Map json) => UpInfo( + avatar: json['avatar'] as String?, + avatarSubscriptUrl: json['avatar_subscript_url'] as String?, + follower: json['follower'] as int?, + isFollow: json['is_follow'] as int?, + mid: json['mid'] as int?, + nicknameColor: json['nickname_color'] as String?, + pendant: json['pendant'] == null + ? null + : Pendant.fromJson(json['pendant'] as Map), + themeType: json['theme_type'] as int?, + uname: json['uname'] as String?, + verifyType: json['verify_type'] as int?, + vipLabel: json['vip_label'] == null + ? null + : VipLabel.fromJson(json['vip_label'] as Map), + vipStatus: json['vip_status'] as int?, + vipType: json['vip_type'] as int?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/user_progress.dart b/lib/models/pgc/pgc_info_model/user_progress.dart new file mode 100644 index 000000000..7cc426e0c --- /dev/null +++ b/lib/models/pgc/pgc_info_model/user_progress.dart @@ -0,0 +1,15 @@ +class UserProgress { + UserProgress({ + this.lastEpId, + this.lastEpIndex, + this.lastTime, + }); + int? lastEpId; + String? lastEpIndex; + int? lastTime; + UserProgress.fromJson(Map json) { + lastEpId = json['last_ep_id']; + lastEpIndex = json['last_ep_index']; + lastTime = json['last_time']; + } +} diff --git a/lib/models/pgc/pgc_info_model/user_status.dart b/lib/models/pgc/pgc_info_model/user_status.dart new file mode 100644 index 000000000..80d92b49b --- /dev/null +++ b/lib/models/pgc/pgc_info_model/user_status.dart @@ -0,0 +1,39 @@ +import 'package:PiliPlus/models/pgc/pgc_info_model/user_progress.dart'; + +class UserStatus { + int? areaLimit; + int? banAreaShow; + int? follow; + int? followStatus; + int? login; + int? pay; + int? payPackPaid; + int? sponsor; + UserProgress? progress; + + UserStatus({ + this.areaLimit, + this.banAreaShow, + this.follow, + this.followStatus, + this.login, + this.pay, + this.payPackPaid, + this.sponsor, + this.progress, + }); + + factory UserStatus.fromJson(Map json) => UserStatus( + areaLimit: json['area_limit'] as int?, + banAreaShow: json['ban_area_show'] as int?, + follow: json['follow'] as int?, + followStatus: json['follow_status'] as int?, + login: json['login'] as int?, + pay: json['pay'] as int?, + payPackPaid: json['pay_pack_paid'] as int?, + sponsor: json['sponsor'] as int?, + progress: json['progress'] == null + ? null + : UserProgress.fromJson(json['progress']), + ); +} diff --git a/lib/models/pgc/pgc_info_model/vip_label.dart b/lib/models/pgc/pgc_info_model/vip_label.dart new file mode 100644 index 000000000..074284d26 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/vip_label.dart @@ -0,0 +1,23 @@ +class VipLabel { + String? bgColor; + int? bgStyle; + String? borderColor; + String? text; + String? textColor; + + VipLabel({ + this.bgColor, + this.bgStyle, + this.borderColor, + this.text, + this.textColor, + }); + + factory VipLabel.fromJson(Map json) => VipLabel( + bgColor: json['bg_color'] as String?, + bgStyle: json['bg_style'] as int?, + borderColor: json['border_color'] as String?, + text: json['text'] as String?, + textColor: json['text_color'] as String?, + ); +} diff --git a/lib/models/pgc/pgc_info_model/vt.dart b/lib/models/pgc/pgc_info_model/vt.dart new file mode 100644 index 000000000..6f269ed50 --- /dev/null +++ b/lib/models/pgc/pgc_info_model/vt.dart @@ -0,0 +1,15 @@ +class Vt { + String? icon; + String? pureText; + String? text; + int? value; + + Vt({this.icon, this.pureText, this.text, this.value}); + + factory Vt.fromJson(Map json) => Vt( + icon: json['icon'] as String?, + pureText: json['pure_text'] as String?, + text: json['text'] as String?, + value: json['value'] as int?, + ); +} diff --git a/lib/models/pgc_lcf.dart b/lib/models/pgc_lcf.dart new file mode 100644 index 000000000..76e60f56a --- /dev/null +++ b/lib/models/pgc_lcf.dart @@ -0,0 +1,20 @@ +class PgcLCF { + int? coinNumber; + int? favorite; + int? isOriginal; + int? like; + + PgcLCF({ + this.coinNumber, + this.favorite, + this.isOriginal, + this.like, + }); + + factory PgcLCF.fromJson(Map json) => PgcLCF( + coinNumber: json["coin_number"], + favorite: json["favorite"], + isOriginal: json["is_original"], + like: json["like"], + ); +} diff --git a/lib/models/play_info/data.dart b/lib/models/play_info/data.dart new file mode 100644 index 000000000..bbb7ebffd --- /dev/null +++ b/lib/models/play_info/data.dart @@ -0,0 +1,30 @@ +import 'package:PiliPlus/models/play_info/interaction.dart'; +import 'package:PiliPlus/models/play_info/subtitle_info.dart'; +import 'package:PiliPlus/models/play_info/view_point'; + +class PlayInfoData { + int? lastPlayCid; + SubtitleInfo? subtitle; + List? viewPoints; + Interaction? interaction; + + PlayInfoData({ + this.lastPlayCid, + this.subtitle, + this.viewPoints, + this.interaction, + }); + + factory PlayInfoData.fromJson(Map json) => PlayInfoData( + lastPlayCid: json['last_play_cid'] as int?, + subtitle: json['subtitle'] == null + ? null + : SubtitleInfo.fromJson(json['subtitle'] as Map), + viewPoints: (json['view_points'] as List?) + ?.map((e) => ViewPoint.fromJson(e)) + .toList(), + interaction: json["interaction"] == null + ? null + : Interaction.fromJson(json["interaction"]), + ); +} diff --git a/lib/models/play_info/interaction.dart b/lib/models/play_info/interaction.dart new file mode 100644 index 000000000..0ce3d7c1c --- /dev/null +++ b/lib/models/play_info/interaction.dart @@ -0,0 +1,34 @@ +class Interaction { + HistoryNode? historyNode; + int? graphVersion; + + Interaction({ + this.historyNode, + this.graphVersion, + }); + + factory Interaction.fromJson(Map json) => Interaction( + historyNode: json["history_node"] == null + ? null + : HistoryNode.fromJson(json["history_node"]), + graphVersion: json["graph_version"], + ); +} + +class HistoryNode { + int? nodeId; + String? title; + int? cid; + + HistoryNode({ + this.nodeId, + this.title, + this.cid, + }); + + factory HistoryNode.fromJson(Map json) => HistoryNode( + nodeId: json["node_id"], + title: json["title"], + cid: json["cid"], + ); +} diff --git a/lib/models/play_info/subtitle.dart b/lib/models/play_info/subtitle.dart new file mode 100644 index 000000000..82e9db4fc --- /dev/null +++ b/lib/models/play_info/subtitle.dart @@ -0,0 +1,20 @@ +class Subtitle { + String? lan; + String? lanDoc; + String? subtitleUrl; + String? subtitleUrlV2; + + Subtitle({ + this.lan, + this.lanDoc, + this.subtitleUrl, + this.subtitleUrlV2, + }); + + factory Subtitle.fromJson(Map json) => Subtitle( + lan: json["lan"], + lanDoc: json["lan_doc"], + subtitleUrl: json["subtitle_url"], + subtitleUrlV2: json["subtitle_url_v2"], + ); +} diff --git a/lib/models/play_info/subtitle_info.dart b/lib/models/play_info/subtitle_info.dart new file mode 100644 index 000000000..7a639db47 --- /dev/null +++ b/lib/models/play_info/subtitle_info.dart @@ -0,0 +1,17 @@ +import 'package:PiliPlus/models/play_info/subtitle.dart'; + +class SubtitleInfo { + String? lan; + String? lanDoc; + List? subtitles; + + SubtitleInfo({this.lan, this.lanDoc, this.subtitles}); + + factory SubtitleInfo.fromJson(Map json) => SubtitleInfo( + lan: json['lan'] as String?, + lanDoc: json['lan_doc'] as String?, + subtitles: (json['subtitles'] as List?) + ?.map((e) => Subtitle.fromJson(e as Map)) + .toList(), + ); +} diff --git a/lib/models/play_info/view_point b/lib/models/play_info/view_point new file mode 100644 index 000000000..09f23467b --- /dev/null +++ b/lib/models/play_info/view_point @@ -0,0 +1,34 @@ + +class ViewPoint { + int? type; + int? from; + int? to; + String? content; + String? imgUrl; + String? logoUrl; + String? teamType; + String? teamName; + + ViewPoint({ + this.type, + this.from, + this.to, + this.content, + this.imgUrl, + this.logoUrl, + this.teamType, + this.teamName, + }); + + factory ViewPoint.fromJson(Map json) => ViewPoint( + type: json["type"], + from: json["from"], + to: json["to"], + content: json["content"], + imgUrl: json["imgUrl"], + logoUrl: json["logoUrl"], + teamType: json["team_type"], + teamName: json["team_name"], + ); + +} \ No newline at end of file diff --git a/lib/models/relation/data.dart b/lib/models/relation/data.dart new file mode 100644 index 000000000..113b2fa74 --- /dev/null +++ b/lib/models/relation/data.dart @@ -0,0 +1,17 @@ +class Relation { + int? mid; + int? attribute; + int? mtime; + dynamic tag; + int? special; + + Relation({this.mid, this.attribute, this.mtime, this.tag, this.special}); + + factory Relation.fromJson(Map json) => Relation( + mid: json['mid'] as int?, + attribute: json['attribute'] as int?, + mtime: json['mtime'] as int?, + tag: json['tag'] as dynamic, + special: json['special'] as int?, + ); +} diff --git a/lib/models/sponsor_block/segment_item.dart b/lib/models/sponsor_block/segment_item.dart new file mode 100644 index 000000000..5137a1623 --- /dev/null +++ b/lib/models/sponsor_block/segment_item.dart @@ -0,0 +1,28 @@ +class SegmentItemModel { + String cid; + String category; + String actionType; + List segment; + String uuid; + double videoDuration; + + SegmentItemModel({ + required this.cid, + required this.category, + required this.actionType, + required this.segment, + required this.uuid, + required this.videoDuration, + }); + + factory SegmentItemModel.fromJson(Map json) => + SegmentItemModel( + cid: json["cid"], + category: json["category"], + actionType: json["actionType"], + segment: + List.from(json["segment"]!.map((x) => (x as num).round())), + uuid: json["UUID"], + videoDuration: (json["videoDuration"] as num).toDouble(), + ); +} diff --git a/lib/models/stein_edgeinfo/choice.dart b/lib/models/stein_edgeinfo/choice.dart new file mode 100644 index 000000000..954d2bb13 --- /dev/null +++ b/lib/models/stein_edgeinfo/choice.dart @@ -0,0 +1,29 @@ +class Choice { + int? id; + String? platformAction; + String? nativeAction; + String? condition; + int? cid; + String? option; + int? isDefault; + + Choice({ + this.id, + this.platformAction, + this.nativeAction, + this.condition, + this.cid, + this.option, + this.isDefault, + }); + + factory Choice.fromJson(Map json) => Choice( + id: json['id'] as int?, + platformAction: json['platform_action'] as String?, + nativeAction: json['native_action'] as String?, + condition: json['condition'] as String?, + cid: json['cid'] as int?, + option: json['option'] as String?, + isDefault: json['is_default'] as int?, + ); +} diff --git a/lib/models/stein_edgeinfo/data.dart b/lib/models/stein_edgeinfo/data.dart new file mode 100644 index 000000000..feb882543 --- /dev/null +++ b/lib/models/stein_edgeinfo/data.dart @@ -0,0 +1,39 @@ +import 'package:PiliPlus/models/stein_edgeinfo/edges.dart'; +import 'package:PiliPlus/models/stein_edgeinfo/preload.dart'; +import 'package:PiliPlus/models/stein_edgeinfo/story_list.dart'; + +class EdgeInfoData { + String? title; + int? edgeId; + List? storyList; + Edges? edges; + String? buvid; + Preload? preload; + int? isLeaf; + + EdgeInfoData({ + this.title, + this.edgeId, + this.storyList, + this.edges, + this.buvid, + this.preload, + this.isLeaf, + }); + + factory EdgeInfoData.fromJson(Map json) => EdgeInfoData( + title: json['title'] as String?, + edgeId: json['edge_id'] as int?, + storyList: (json['story_list'] as List?) + ?.map((e) => StoryList.fromJson(e as Map)) + .toList(), + edges: json['edges'] == null + ? null + : Edges.fromJson(json['edges'] as Map), + buvid: json['buvid'] as String?, + preload: json['preload'] == null + ? null + : Preload.fromJson(json['preload'] as Map), + isLeaf: json['is_leaf'] as int?, + ); +} diff --git a/lib/models/stein_edgeinfo/dimension.dart b/lib/models/stein_edgeinfo/dimension.dart new file mode 100644 index 000000000..6837c0b77 --- /dev/null +++ b/lib/models/stein_edgeinfo/dimension.dart @@ -0,0 +1,15 @@ +class Dimension { + int? width; + int? height; + int? rotate; + String? sar; + + Dimension({this.width, this.height, this.rotate, this.sar}); + + factory Dimension.fromJson(Map json) => Dimension( + width: json['width'] as int?, + height: json['height'] as int?, + rotate: json['rotate'] as int?, + sar: json['sar'] as String?, + ); +} diff --git a/lib/models/stein_edgeinfo/edges.dart b/lib/models/stein_edgeinfo/edges.dart new file mode 100644 index 000000000..cc7312ff9 --- /dev/null +++ b/lib/models/stein_edgeinfo/edges.dart @@ -0,0 +1,23 @@ +import 'package:PiliPlus/models/stein_edgeinfo/dimension.dart'; +import 'package:PiliPlus/models/stein_edgeinfo/question.dart'; +import 'package:PiliPlus/models/stein_edgeinfo/skin.dart'; + +class Edges { + Dimension? dimension; + List? questions; + Skin? skin; + + Edges({this.dimension, this.questions, this.skin}); + + factory Edges.fromJson(Map json) => Edges( + dimension: json['dimension'] == null + ? null + : Dimension.fromJson(json['dimension'] as Map), + questions: (json['questions'] as List?) + ?.map((e) => Question.fromJson(e as Map)) + .toList(), + skin: json['skin'] == null + ? null + : Skin.fromJson(json['skin'] as Map), + ); +} diff --git a/lib/models/stein_edgeinfo/preload.dart b/lib/models/stein_edgeinfo/preload.dart new file mode 100644 index 000000000..4440ddc14 --- /dev/null +++ b/lib/models/stein_edgeinfo/preload.dart @@ -0,0 +1,13 @@ +import 'package:PiliPlus/models/stein_edgeinfo/video.dart'; + +class Preload { + List