mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-17 06:40:13 +08:00
precheck video dimension
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:PiliPlus/models/common/stat_type.dart';
|
|||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
import 'package:PiliPlus/models/model_video.dart';
|
import 'package:PiliPlus/models/model_video.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/utils/date_utils.dart';
|
import 'package:PiliPlus/utils/date_utils.dart';
|
||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
@@ -92,30 +93,35 @@ class VideoCardH extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dimension? dimension;
|
||||||
if (videoItem case final HotVideoItemModel item) {
|
if (videoItem case final HotVideoItemModel item) {
|
||||||
if (item.redirectUrl?.isNotEmpty == true &&
|
if (item.redirectUrl?.isNotEmpty == true &&
|
||||||
PageUtils.viewPgcFromUri(item.redirectUrl!)) {
|
PageUtils.viewPgcFromUri(item.redirectUrl!)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
dimension = item.dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
int? cid = videoItem.cid;
|
||||||
final int? cid =
|
if (cid == null) {
|
||||||
videoItem.cid ??
|
if (await SearchHttp.ab2cWithDimension(
|
||||||
await SearchHttp.ab2c(
|
|
||||||
aid: videoItem.aid,
|
aid: videoItem.aid,
|
||||||
bvid: videoItem.bvid,
|
bvid: videoItem.bvid,
|
||||||
);
|
)
|
||||||
if (cid != null) {
|
case final res?) {
|
||||||
PageUtils.toVideoPage(
|
cid = res.cid;
|
||||||
bvid: videoItem.bvid,
|
dimension = res.dimension;
|
||||||
cid: cid,
|
|
||||||
cover: videoItem.cover,
|
|
||||||
title: videoItem.title,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
SmartDialog.showToast(err.toString());
|
if (cid != null) {
|
||||||
|
PageUtils.toVideoPage(
|
||||||
|
bvid: videoItem.bvid,
|
||||||
|
cid: cid,
|
||||||
|
cover: videoItem.cover,
|
||||||
|
title: videoItem.title,
|
||||||
|
dimension: dimension,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
|||||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||||
import 'package:PiliPlus/common/widgets/video_popup_menu.dart';
|
import 'package:PiliPlus/common/widgets/video_popup_menu.dart';
|
||||||
import 'package:PiliPlus/http/search.dart';
|
import 'package:PiliPlus/http/search.dart';
|
||||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
|
||||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||||
|
import 'package:PiliPlus/models/home/rcmd/result.dart';
|
||||||
import 'package:PiliPlus/models/model_rec_video_item.dart';
|
import 'package:PiliPlus/models/model_rec_video_item.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
import 'package:PiliPlus/utils/date_utils.dart';
|
import 'package:PiliPlus/utils/date_utils.dart';
|
||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
@@ -31,17 +32,28 @@ class VideoCardV extends StatelessWidget {
|
|||||||
this.onRemove,
|
this.onRemove,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<void> onPushDetail(String heroTag) async {
|
Future<void> onPushDetail() async {
|
||||||
String? goto = videoItem.goto;
|
switch (videoItem.goto) {
|
||||||
switch (goto) {
|
|
||||||
case 'bangumi':
|
case 'bangumi':
|
||||||
PageUtils.viewPgc(epId: videoItem.param!);
|
PageUtils.viewPgc(epId: videoItem.param!);
|
||||||
break;
|
break;
|
||||||
case 'av':
|
case 'av':
|
||||||
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid!);
|
var bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid!);
|
||||||
int? cid =
|
var cid = videoItem.cid;
|
||||||
videoItem.cid ??
|
bool isVertical = false;
|
||||||
await SearchHttp.ab2c(aid: videoItem.aid, bvid: bvid);
|
Dimension? dimension;
|
||||||
|
if (videoItem is RcmdVideoItemAppModel) {
|
||||||
|
if (videoItem.uri case final uri?) {
|
||||||
|
isVertical = Utils.getDimensionFromUri(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cid == null) {
|
||||||
|
if (await SearchHttp.ab2cWithDimension(aid: videoItem.aid, bvid: bvid)
|
||||||
|
case final res?) {
|
||||||
|
cid = res.cid;
|
||||||
|
dimension = res.dimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
aid: videoItem.aid,
|
aid: videoItem.aid,
|
||||||
@@ -49,6 +61,8 @@ class VideoCardV extends StatelessWidget {
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.cover,
|
cover: videoItem.cover,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
|
isVertical: isVertical,
|
||||||
|
dimension: dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -80,7 +94,7 @@ class VideoCardV extends StatelessWidget {
|
|||||||
Card(
|
Card(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)),
|
onTap: onPushDetail,
|
||||||
onLongPress: onLongPress,
|
onLongPress: onLongPress,
|
||||||
onSecondaryTap: PlatformUtils.isMobile ? null : onLongPress,
|
onSecondaryTap: PlatformUtils.isMobile ? null : onLongPress,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -105,8 +119,8 @@ class VideoCardV extends StatelessWidget {
|
|||||||
PBadge(
|
PBadge(
|
||||||
bottom: 6,
|
bottom: 6,
|
||||||
right: 7,
|
right: 7,
|
||||||
size: PBadgeSize.small,
|
size: .small,
|
||||||
type: PBadgeType.gray,
|
type: .gray,
|
||||||
text: DurationUtils.formatDuration(
|
text: DurationUtils.formatDuration(
|
||||||
videoItem.duration,
|
videoItem.duration,
|
||||||
),
|
),
|
||||||
@@ -163,31 +177,31 @@ class VideoCardV extends StatelessWidget {
|
|||||||
PBadge(
|
PBadge(
|
||||||
text: videoItem.pgcBadge,
|
text: videoItem.pgcBadge,
|
||||||
isStack: false,
|
isStack: false,
|
||||||
size: PBadgeSize.small,
|
size: .small,
|
||||||
type: PBadgeType.line_primary,
|
type: .line_primary,
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
),
|
),
|
||||||
if (videoItem.rcmdReason != null)
|
if (videoItem.rcmdReason != null)
|
||||||
PBadge(
|
PBadge(
|
||||||
text: videoItem.rcmdReason,
|
text: videoItem.rcmdReason,
|
||||||
isStack: false,
|
isStack: false,
|
||||||
size: PBadgeSize.small,
|
size: .small,
|
||||||
type: PBadgeType.secondary,
|
type: .secondary,
|
||||||
),
|
),
|
||||||
if (videoItem.goto == 'picture')
|
if (videoItem.goto == 'picture')
|
||||||
const PBadge(
|
const PBadge(
|
||||||
text: '动态',
|
text: '动态',
|
||||||
isStack: false,
|
isStack: false,
|
||||||
size: PBadgeSize.small,
|
size: .small,
|
||||||
type: PBadgeType.line_primary,
|
type: .line_primary,
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
),
|
),
|
||||||
if (videoItem.isFollowed)
|
if (videoItem.isFollowed)
|
||||||
const PBadge(
|
const PBadge(
|
||||||
text: '已关注',
|
text: '已关注',
|
||||||
isStack: false,
|
isStack: false,
|
||||||
size: PBadgeSize.small,
|
size: .small,
|
||||||
type: PBadgeType.secondary,
|
type: .secondary,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/models_new/dynamic/dyn_topic_pub_search/data.dart';
|
|||||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
||||||
import 'package:PiliPlus/models_new/search/search_rcmd/data.dart';
|
import 'package:PiliPlus/models_new/search/search_rcmd/data.dart';
|
||||||
import 'package:PiliPlus/models_new/search/search_trending/data.dart';
|
import 'package:PiliPlus/models_new/search/search_trending/data.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/utils/request_utils.dart';
|
import 'package:PiliPlus/utils/request_utils.dart';
|
||||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
@@ -172,6 +173,14 @@ abstract final class SearchHttp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<int?> ab2c({dynamic aid, dynamic bvid, int? part}) async {
|
static Future<int?> ab2c({dynamic aid, dynamic bvid, int? part}) async {
|
||||||
|
return (await ab2cWithDimension(aid: aid, bvid: bvid, part: part))?.cid;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<({int? cid, Dimension? dimension})?> ab2cWithDimension({
|
||||||
|
dynamic aid,
|
||||||
|
dynamic bvid,
|
||||||
|
int? part,
|
||||||
|
}) async {
|
||||||
final res = await Request().get(
|
final res = await Request().get(
|
||||||
Api.ab2c,
|
Api.ab2c,
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
@@ -181,13 +190,19 @@ abstract final class SearchHttp {
|
|||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
if (res.data['data'] case List list) {
|
if (res.data['data'] case List list) {
|
||||||
return part != null
|
final target = part != null
|
||||||
? (list.elementAtOrNull(part - 1)?['cid'] ??
|
? (list.elementAtOrNull(part - 1) ?? list.firstOrNull)
|
||||||
list.firstOrNull?['cid'])
|
: list.firstOrNull;
|
||||||
: list.firstOrNull?['cid'];
|
if (target != null) {
|
||||||
} else {
|
return (
|
||||||
return null;
|
cid: target['cid'] as int?,
|
||||||
|
dimension: target['dimension'] == null
|
||||||
|
? null
|
||||||
|
: Dimension.fromJson(target['dimension']),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast("ab2c error: ${res.data['message']}");
|
SmartDialog.showToast("ab2c error: ${res.data['message']}");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ class HotVideoItemModel extends BaseRcmdVideoItemModel with MultiSelectData {
|
|||||||
duration = json["duration"];
|
duration = json["duration"];
|
||||||
owner = Owner.fromJson(json["owner"]);
|
owner = Owner.fromJson(json["owner"]);
|
||||||
stat = HotStat.fromJson(json['stat']);
|
stat = HotStat.fromJson(json['stat']);
|
||||||
dimension = Dimension.fromJson(json['dimension']);
|
dimension = json['dimension'] == null
|
||||||
|
? null
|
||||||
|
: Dimension.fromJson(json['dimension']);
|
||||||
firstFrame = json["first_frame"];
|
firstFrame = json["first_frame"];
|
||||||
pubLocation = json["pub_location"];
|
pubLocation = json["pub_location"];
|
||||||
dynamic rcmd = json['rcmd_reason'];
|
dynamic rcmd = json['rcmd_reason'];
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ class BiliDownloadEntryInfo with MultiSelectData {
|
|||||||
epId: ep?.episodeId,
|
epId: ep?.episodeId,
|
||||||
title: title,
|
title: title,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
isVertical: pageData?.isVertical ?? false,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -262,6 +263,8 @@ class PageInfo {
|
|||||||
|
|
||||||
bool get cacheWidth => width <= height;
|
bool get cacheWidth => width <= height;
|
||||||
|
|
||||||
|
bool get isVertical => rotate == 1 ? width > height : height > width;
|
||||||
|
|
||||||
PageInfo({
|
PageInfo({
|
||||||
required this.cid,
|
required this.cid,
|
||||||
required this.page,
|
required this.page,
|
||||||
|
|||||||
@@ -9,10 +9,21 @@ class Dimension {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isVertical =>
|
||||||
|
width != null && height != null ? height! > width! : false;
|
||||||
|
|
||||||
Dimension({this.width, this.height});
|
Dimension({this.width, this.height});
|
||||||
|
|
||||||
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
|
Dimension.fromJson(Map<String, dynamic> json) {
|
||||||
width: json['width'] as int?,
|
if (json['rotate'] == 1) {
|
||||||
height: json['height'] as int?,
|
width = json['height'] as int?;
|
||||||
);
|
height = json['width'] as int?;
|
||||||
|
} else {
|
||||||
|
width = json['width'] as int?;
|
||||||
|
height = json['height'] as int?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'width: $width, height: $height';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ class DetailItem extends StatelessWidget {
|
|||||||
cid: cid!,
|
cid: cid!,
|
||||||
cover: entry.cover,
|
cover: entry.cover,
|
||||||
title: entry.showTitle,
|
title: entry.showTitle,
|
||||||
|
isVertical: entry.pageData?.isVertical ?? false,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.file,
|
'sourceType': SourceType.file,
|
||||||
'entry': entry,
|
'entry': entry,
|
||||||
|
|||||||
@@ -247,11 +247,15 @@ TextSpan? richNode(
|
|||||||
recognizer: NoDeadlineTapGestureRecognizer()
|
recognizer: NoDeadlineTapGestureRecognizer()
|
||||||
..onTap = () async {
|
..onTap = () async {
|
||||||
try {
|
try {
|
||||||
int? cid = await SearchHttp.ab2c(bvid: i.rid);
|
final res = await SearchHttp.ab2cWithDimension(
|
||||||
|
bvid: i.rid,
|
||||||
|
);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: i.rid,
|
bvid: i.rid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ class FavDetailController
|
|||||||
@override
|
@override
|
||||||
void onViewFav(FavDetailItemModel item, int? index) {
|
void onViewFav(FavDetailItemModel item, int? index) {
|
||||||
final folder = folderInfo.value;
|
final folder = folderInfo.value;
|
||||||
|
// TODO: dimension
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: item.bvid,
|
bvid: item.bvid,
|
||||||
cid: item.ugc!.firstCid!,
|
cid: item.ugc!.firstCid!,
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class FavSearchController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
// TODO: dimension
|
||||||
void onViewFav(FavDetailItemModel item, int? index) => PageUtils.toVideoPage(
|
void onViewFav(FavDetailItemModel item, int? index) => PageUtils.toVideoPage(
|
||||||
bvid: item.bvid,
|
bvid: item.bvid,
|
||||||
cid: item.ugc!.firstCid!,
|
cid: item.ugc!.firstCid!,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/http/search.dart';
|
|||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||||
import 'package:PiliPlus/models_new/history/list.dart';
|
import 'package:PiliPlus/models_new/history/list.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/pages/common/multi_select/base.dart';
|
import 'package:PiliPlus/pages/common/multi_select/base.dart';
|
||||||
import 'package:PiliPlus/utils/date_utils.dart';
|
import 'package:PiliPlus/utils/date_utils.dart';
|
||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
@@ -79,20 +80,28 @@ class HistoryItem extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int? cid =
|
int? cid = item.history.cid;
|
||||||
item.history.cid ??
|
Dimension? dimension;
|
||||||
await SearchHttp.ab2c(
|
if (cid == null) {
|
||||||
aid: aid,
|
if (await SearchHttp.ab2cWithDimension(
|
||||||
bvid: bvid,
|
aid: aid,
|
||||||
part: item.history.page,
|
bvid: bvid,
|
||||||
);
|
part: item.history.page,
|
||||||
|
)
|
||||||
|
case final res?) {
|
||||||
|
cid = res.cid;
|
||||||
|
dimension = res.dimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
|
// TODO: dimension
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
aid: aid,
|
aid: aid,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: item.cover,
|
cover: item.cover,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
dimension: dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.pic,
|
cover: videoItem.pic,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
|
dimension: videoItem.dimension,
|
||||||
extraArguments: _baseCtr.isPlayAll.value
|
extraArguments: _baseCtr.isPlayAll.value
|
||||||
? {
|
? {
|
||||||
'oid': videoItem.aid,
|
'oid': videoItem.aid,
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ class LaterController extends MultiSelectController<LaterData, LaterItemModel>
|
|||||||
cid: item.cid!,
|
cid: item.cid!,
|
||||||
cover: item.pic,
|
cover: item.pic,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
dimension: item.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.watchLater,
|
'sourceType': SourceType.watchLater,
|
||||||
'count': baseCtr.counts[LaterViewType.all.index],
|
'count': baseCtr.counts[LaterViewType.all.index],
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class VideoCardHLater extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final int? cid =
|
final cid =
|
||||||
videoItem.cid ??
|
videoItem.cid ??
|
||||||
await SearchHttp.ab2c(
|
await SearchHttp.ab2c(
|
||||||
aid: videoItem.aid,
|
aid: videoItem.aid,
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class _LaterSearchPageState
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
cover: item.pic,
|
cover: item.pic,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
dimension: item.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'oid': item.aid,
|
'oid': item.aid,
|
||||||
'sourceType': SourceType.watchLater,
|
'sourceType': SourceType.watchLater,
|
||||||
|
|||||||
@@ -42,13 +42,15 @@ class MemberCoinLikeItem extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.param != null) {
|
if (item.param != null) {
|
||||||
int? cid = await SearchHttp.ab2c(aid: item.param);
|
final res = await SearchHttp.ab2cWithDimension(aid: item.param);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
aid: int.parse(item.param!),
|
aid: int.parse(item.param!),
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: item.cover,
|
cover: item.cover,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
|||||||
import 'package:PiliPlus/http/search.dart';
|
import 'package:PiliPlus/http/search.dart';
|
||||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||||
import 'package:PiliPlus/models_new/space/space_archive/item.dart';
|
import 'package:PiliPlus/models_new/space/space_archive/item.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
import 'package:PiliPlus/utils/id_utils.dart';
|
import 'package:PiliPlus/utils/id_utils.dart';
|
||||||
@@ -44,13 +45,22 @@ class VideoCardVMemberHome extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bvid ??= IdUtils.av2bv(int.parse(aid!));
|
bvid ??= IdUtils.av2bv(int.parse(aid!));
|
||||||
int? cid = videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
int? cid = videoItem.cid;
|
||||||
|
Dimension? dimension;
|
||||||
|
if (cid == null) {
|
||||||
|
if (await SearchHttp.ab2cWithDimension(aid: aid, bvid: bvid)
|
||||||
|
case final res?) {
|
||||||
|
cid = res.cid;
|
||||||
|
dimension = res.dimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.cover,
|
cover: videoItem.cover,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
|
dimension: dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class _MemberSearchChildPageState extends State<MemberSearchChildPage>
|
|||||||
if (index == response.length - 1) {
|
if (index == response.length - 1) {
|
||||||
_controller.onLoadMore();
|
_controller.onLoadMore();
|
||||||
}
|
}
|
||||||
|
// TODO: dimension
|
||||||
return VideoCardH(
|
return VideoCardH(
|
||||||
videoItem: response[index],
|
videoItem: response[index],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
|||||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||||
import 'package:PiliPlus/utils/id_utils.dart';
|
import 'package:PiliPlus/utils/id_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class MemberVideoCtr
|
class MemberVideoCtr
|
||||||
@@ -152,12 +153,14 @@ class MemberVideoCtr
|
|||||||
String? oid = params['oid'];
|
String? oid = params['oid'];
|
||||||
if (oid != null) {
|
if (oid != null) {
|
||||||
final bvid = IdUtils.av2bv(int.parse(oid));
|
final bvid = IdUtils.av2bv(int.parse(oid));
|
||||||
final cid = await SearchHttp.ab2c(aid: oid, bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(aid: oid, bvid: bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
aid: int.parse(oid),
|
aid: int.parse(oid),
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
|
dimension: res!.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.archive,
|
'sourceType': SourceType.archive,
|
||||||
'mediaId': seasonId ?? seriesId ?? mid,
|
'mediaId': seasonId ?? seriesId ?? mid,
|
||||||
@@ -190,11 +193,16 @@ class MemberVideoCtr
|
|||||||
(isVideo ? order == .click : sort == .asc)
|
(isVideo ? order == .click : sort == .asc)
|
||||||
? !desc
|
? !desc
|
||||||
: desc;
|
: desc;
|
||||||
|
bool isVertical = false;
|
||||||
|
if (element.uri case final uri?) {
|
||||||
|
isVertical = Utils.getDimensionFromUri(uri);
|
||||||
|
}
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: element.bvid,
|
bvid: element.bvid,
|
||||||
cid: element.cid!,
|
cid: element.cid!,
|
||||||
cover: element.cover,
|
cover: element.cover,
|
||||||
title: element.title,
|
title: element.title,
|
||||||
|
isVertical: isVertical,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.archive,
|
'sourceType': SourceType.archive,
|
||||||
'mediaId': seasonId ?? seriesId ?? mid,
|
'mediaId': seasonId ?? seriesId ?? mid,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import 'package:PiliPlus/utils/date_utils.dart';
|
|||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/material.dart' hide LayoutBuilder;
|
import 'package:flutter/material.dart' hide LayoutBuilder;
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
||||||
|
|
||||||
// 视频卡片 - 水平布局
|
// 视频卡片 - 水平布局
|
||||||
class VideoCardHMemberVideo extends StatelessWidget {
|
class VideoCardHMemberVideo extends StatelessWidget {
|
||||||
@@ -62,16 +62,17 @@ class VideoCardHMemberVideo extends StatelessWidget {
|
|||||||
if (videoItem.bvid == null || videoItem.cid == null) {
|
if (videoItem.bvid == null || videoItem.cid == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
bool isVertical = false;
|
||||||
PageUtils.toVideoPage(
|
if (videoItem.uri case final uri?) {
|
||||||
bvid: videoItem.bvid,
|
isVertical = Utils.getDimensionFromUri(uri);
|
||||||
cid: videoItem.cid!,
|
|
||||||
cover: videoItem.cover,
|
|
||||||
title: videoItem.title,
|
|
||||||
);
|
|
||||||
} catch (err) {
|
|
||||||
SmartDialog.showToast(err.toString());
|
|
||||||
}
|
}
|
||||||
|
PageUtils.toVideoPage(
|
||||||
|
bvid: videoItem.bvid,
|
||||||
|
cid: videoItem.cid!,
|
||||||
|
cover: videoItem.cover,
|
||||||
|
title: videoItem.title,
|
||||||
|
isVertical: isVertical,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ abstract class BaseVideoWebState<
|
|||||||
if (index == response.length - 1) {
|
if (index == response.length - 1) {
|
||||||
controller.onLoadMore();
|
controller.onLoadMore();
|
||||||
}
|
}
|
||||||
|
// TODO: dimension
|
||||||
return VideoCardH(videoItem: response[index]);
|
return VideoCardH(videoItem: response[index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/http/search.dart';
|
|||||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||||
import 'package:PiliPlus/models_new/music/bgm_recommend_list.dart';
|
import 'package:PiliPlus/models_new/music/bgm_recommend_list.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||||
@@ -33,14 +34,22 @@ class MusicVideoCardH extends StatelessWidget {
|
|||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
int? cid =
|
int? cid = videoItem.cid;
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(bvid: videoItem.bvid);
|
Dimension? dimension;
|
||||||
|
if (cid == null) {
|
||||||
|
if (await SearchHttp.ab2cWithDimension(bvid: videoItem.bvid)
|
||||||
|
case final res?) {
|
||||||
|
cid = res.cid;
|
||||||
|
dimension = res.dimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: videoItem.bvid,
|
bvid: videoItem.bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.cover,
|
cover: videoItem.cover,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
|
dimension: dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class _PopularPreciousPageState extends State<PopularPreciousPage>
|
|||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: item.bvid,
|
bvid: item.bvid,
|
||||||
cid: item.cid!,
|
cid: item.cid!,
|
||||||
|
dimension: item.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.playlist,
|
'sourceType': SourceType.playlist,
|
||||||
'favTitle': '入站必刷',
|
'favTitle': '入站必刷',
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class _PopularSeriesPageState extends State<PopularSeriesPage> with GridMixin {
|
|||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: item.bvid,
|
bvid: item.bvid,
|
||||||
cid: item.cid!,
|
cid: item.cid!,
|
||||||
|
dimension: item.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.playlist,
|
'sourceType': SourceType.playlist,
|
||||||
'favTitle': '每周必看 ${config?.label ?? ''}',
|
'favTitle': '每周必看 ${config?.label ?? ''}',
|
||||||
|
|||||||
@@ -36,13 +36,15 @@ class SubVideoCardH extends StatelessWidget {
|
|||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
int? cid = await SearchHttp.ab2c(bvid: videoItem.bvid);
|
final res = await SearchHttp.ab2cWithDimension(bvid: videoItem.bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: videoItem.bvid,
|
bvid: videoItem.bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: videoItem.cover,
|
cover: videoItem.cover,
|
||||||
title: videoItem.title,
|
title: videoItem.title,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class VideoDetailController extends GetxController
|
|||||||
PlayerStatus? playerStatus;
|
PlayerStatus? playerStatus;
|
||||||
|
|
||||||
late final scrollKey = GlobalKey<ExtendedNestedScrollViewState>();
|
late final scrollKey = GlobalKey<ExtendedNestedScrollViewState>();
|
||||||
late final RxBool isVertical = false.obs;
|
late final RxBool isVertical;
|
||||||
late final RxDouble scrollRatio = 0.0.obs;
|
late final RxDouble scrollRatio = 0.0.obs;
|
||||||
ScrollController? _scrollCtr;
|
ScrollController? _scrollCtr;
|
||||||
ScrollController get scrollCtr =>
|
ScrollController get scrollCtr =>
|
||||||
@@ -326,6 +326,7 @@ class VideoDetailController extends GetxController
|
|||||||
pgcType = args['pgcType'];
|
pgcType = args['pgcType'];
|
||||||
heroTag = args['heroTag'];
|
heroTag = args['heroTag'];
|
||||||
cover = RxString(args['cover'] ?? '');
|
cover = RxString(args['cover'] ?? '');
|
||||||
|
isVertical = RxBool(args['isVertical'] ?? false);
|
||||||
|
|
||||||
sourceType = args['sourceType'] ?? SourceType.normal;
|
sourceType = args['sourceType'] ?? SourceType.normal;
|
||||||
isFileSource = sourceType == SourceType.file;
|
isFileSource = sourceType == SourceType.file;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import 'package:PiliPlus/models/common/video/source_type.dart';
|
|||||||
import 'package:PiliPlus/models_new/member_card_info/data.dart';
|
import 'package:PiliPlus/models_new/member_card_info/data.dart';
|
||||||
import 'package:PiliPlus/models_new/relation/data.dart';
|
import 'package:PiliPlus/models_new/relation/data.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_ai_conclusion/model_result.dart';
|
import 'package:PiliPlus/models_new/video/video_ai_conclusion/model_result.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
|
||||||
import 'package:PiliPlus/models_new/video/video_detail/section.dart';
|
import 'package:PiliPlus/models_new/video/video_detail/section.dart';
|
||||||
@@ -485,22 +486,33 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
|||||||
try {
|
try {
|
||||||
final String bvid = episode.bvid ?? this.bvid;
|
final String bvid = episode.bvid ?? this.bvid;
|
||||||
final int aid = episode.aid ?? IdUtils.bv2av(bvid);
|
final int aid = episode.aid ?? IdUtils.bv2av(bvid);
|
||||||
final int? cid =
|
int? cid = episode.cid;
|
||||||
episode.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
Dimension? dimension;
|
||||||
|
if (cid == null) {
|
||||||
|
if (await SearchHttp.ab2cWithDimension(aid: aid, bvid: bvid)
|
||||||
|
case final res?) {
|
||||||
|
cid = res.cid;
|
||||||
|
dimension = res.dimension;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cid == null) {
|
if (cid == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String? cover = episode.cover;
|
final String? cover = episode.cover;
|
||||||
|
|
||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
|
|
||||||
if (videoDetailCtr.isPlayAll) {
|
if (videoDetailCtr.isPlayAll) {
|
||||||
if (videoDetailCtr.mediaList.indexWhere((item) => item.bvid == bvid) ==
|
if (videoDetailCtr.mediaList.indexWhere((item) => item.bvid == bvid) ==
|
||||||
-1) {
|
-1) {
|
||||||
|
if (dimension == null && episode is EpisodeItem) {
|
||||||
|
dimension = episode.page?.dimension;
|
||||||
|
}
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
dimension: dimension,
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,13 +328,17 @@ class ChatItem extends StatelessWidget {
|
|||||||
if (bvid != null) {
|
if (bvid != null) {
|
||||||
try {
|
try {
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
final int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(
|
||||||
|
bvid: bvid,
|
||||||
|
);
|
||||||
|
final cid = res?.cid;
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: i['cover_url'],
|
cover: i['cover_url'],
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -420,13 +424,17 @@ class ChatItem extends StatelessWidget {
|
|||||||
try {
|
try {
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
final bvid = content["bvid"];
|
final bvid = content["bvid"];
|
||||||
final int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(
|
||||||
|
bvid: bvid,
|
||||||
|
);
|
||||||
|
final cid = res?.cid;
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: content['cover'],
|
cover: content['cover'],
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -518,7 +526,10 @@ class ChatItem extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
bvid ??= IdUtils.av2bv(aid);
|
bvid ??= IdUtils.av2bv(aid);
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
final int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(
|
||||||
|
bvid: bvid,
|
||||||
|
);
|
||||||
|
final cid = res?.cid;
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
@@ -526,6 +537,7 @@ class ChatItem extends StatelessWidget {
|
|||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: content['thumb'],
|
cover: content['thumb'],
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -617,11 +617,13 @@ abstract final class PiliScheme {
|
|||||||
IdUtils.bvRegex.firstMatch(path)?.group(0);
|
IdUtils.bvRegex.firstMatch(path)?.group(0);
|
||||||
if (bvid != null) {
|
if (bvid != null) {
|
||||||
if (mediaId != null) {
|
if (mediaId != null) {
|
||||||
final int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(bvid: bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
|
dimension: res!.dimension,
|
||||||
extraArguments: {
|
extraArguments: {
|
||||||
'sourceType': SourceType.playlist,
|
'sourceType': SourceType.playlist,
|
||||||
'favTitle': '播放列表',
|
'favTitle': '播放列表',
|
||||||
@@ -877,11 +879,12 @@ abstract final class PiliScheme {
|
|||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
SmartDialog.showLoading<dynamic>(msg: '获取中...');
|
SmartDialog.showLoading<dynamic>(msg: '获取中...');
|
||||||
}
|
}
|
||||||
final int? cid = await SearchHttp.ab2c(
|
final res = await SearchHttp.ab2cWithDimension(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
aid: aid,
|
aid: aid,
|
||||||
part: part != null ? int.tryParse(part) : null,
|
part: part != null ? int.tryParse(part) : null,
|
||||||
);
|
);
|
||||||
|
final cid = res?.cid;
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
}
|
}
|
||||||
@@ -892,6 +895,7 @@ abstract final class PiliScheme {
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
progress: progress,
|
progress: progress,
|
||||||
off: off,
|
off: off,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'package:PiliPlus/models/common/image_preview_type.dart';
|
|||||||
import 'package:PiliPlus/models/common/video/video_type.dart';
|
import 'package:PiliPlus/models/common/video/video_type.dart';
|
||||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
||||||
|
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||||
import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
||||||
import 'package:PiliPlus/pages/contact/view.dart';
|
import 'package:PiliPlus/pages/contact/view.dart';
|
||||||
@@ -271,12 +272,14 @@ abstract final class PageUtils {
|
|||||||
try {
|
try {
|
||||||
String bvid = archive.bvid!;
|
String bvid = archive.bvid!;
|
||||||
String cover = archive.cover!;
|
String cover = archive.cover!;
|
||||||
int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(bvid: bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
toVideoPage(
|
toVideoPage(
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -330,13 +333,15 @@ abstract final class PageUtils {
|
|||||||
int aid = ugcSeason.aid!;
|
int aid = ugcSeason.aid!;
|
||||||
String bvid = IdUtils.av2bv(aid);
|
String bvid = IdUtils.av2bv(aid);
|
||||||
String cover = ugcSeason.cover!;
|
String cover = ugcSeason.cover!;
|
||||||
int? cid = await SearchHttp.ab2c(bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(bvid: bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
toVideoPage(
|
toVideoPage(
|
||||||
aid: aid,
|
aid: aid,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -554,6 +559,8 @@ abstract final class PageUtils {
|
|||||||
int? progress, // milliseconds
|
int? progress, // milliseconds
|
||||||
Map? extraArguments,
|
Map? extraArguments,
|
||||||
bool off = false,
|
bool off = false,
|
||||||
|
bool isVertical = false,
|
||||||
|
Dimension? dimension,
|
||||||
}) {
|
}) {
|
||||||
final arguments = {
|
final arguments = {
|
||||||
'aid': aid ?? IdUtils.bv2av(bvid!),
|
'aid': aid ?? IdUtils.bv2av(bvid!),
|
||||||
@@ -566,6 +573,7 @@ abstract final class PageUtils {
|
|||||||
'title': ?title,
|
'title': ?title,
|
||||||
'progress': ?progress,
|
'progress': ?progress,
|
||||||
'videoType': videoType,
|
'videoType': videoType,
|
||||||
|
'isVertical': dimension?.isVertical ?? isVertical,
|
||||||
'heroTag': Utils.makeHeroTag(cid),
|
'heroTag': Utils.makeHeroTag(cid),
|
||||||
...?extraArguments,
|
...?extraArguments,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,12 +49,14 @@ abstract final class UrlUtils {
|
|||||||
final aid = matchRes.av;
|
final aid = matchRes.av;
|
||||||
String? bvid = matchRes.bv;
|
String? bvid = matchRes.bv;
|
||||||
bvid ??= IdUtils.av2bv(aid!);
|
bvid ??= IdUtils.av2bv(aid!);
|
||||||
final int? cid = await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
final res = await SearchHttp.ab2cWithDimension(aid: aid, bvid: bvid);
|
||||||
|
final cid = res?.cid;
|
||||||
if (cid != null) {
|
if (cid != null) {
|
||||||
PageUtils.toVideoPage(
|
PageUtils.toVideoPage(
|
||||||
aid: aid,
|
aid: aid,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
|
dimension: res!.dimension,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ abstract final class Utils {
|
|||||||
_ => color,
|
_ => color,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool getDimensionFromUri(String uri) {
|
||||||
|
try {
|
||||||
|
final params = Uri.parse(uri).queryParameters;
|
||||||
|
final width = int.parse(params['player_width']!);
|
||||||
|
final height = int.parse(params['player_height']!);
|
||||||
|
return params['player_rotate'] == '1' ? width > height : height > width;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String themeUrl(bool isDark) =>
|
static String themeUrl(bool isDark) =>
|
||||||
'native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}';
|
'native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user