mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-28 22:35:54 +08:00
precheck video dimension
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -617,11 +617,13 @@ abstract final class PiliScheme {
|
||||
IdUtils.bvRegex.firstMatch(path)?.group(0);
|
||||
if (bvid != 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) {
|
||||
PageUtils.toVideoPage(
|
||||
bvid: bvid,
|
||||
cid: cid,
|
||||
dimension: res!.dimension,
|
||||
extraArguments: {
|
||||
'sourceType': SourceType.playlist,
|
||||
'favTitle': '播放列表',
|
||||
@@ -877,11 +879,12 @@ abstract final class PiliScheme {
|
||||
if (showDialog) {
|
||||
SmartDialog.showLoading<dynamic>(msg: '获取中...');
|
||||
}
|
||||
final int? cid = await SearchHttp.ab2c(
|
||||
final res = await SearchHttp.ab2cWithDimension(
|
||||
bvid: bvid,
|
||||
aid: aid,
|
||||
part: part != null ? int.tryParse(part) : null,
|
||||
);
|
||||
final cid = res?.cid;
|
||||
if (showDialog) {
|
||||
SmartDialog.dismiss();
|
||||
}
|
||||
@@ -892,6 +895,7 @@ abstract final class PiliScheme {
|
||||
cid: cid,
|
||||
progress: progress,
|
||||
off: off,
|
||||
dimension: res!.dimension,
|
||||
);
|
||||
}
|
||||
} 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/dynamics/result.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/publish/publish_route.dart';
|
||||
import 'package:PiliPlus/pages/contact/view.dart';
|
||||
@@ -271,12 +272,14 @@ abstract final class PageUtils {
|
||||
try {
|
||||
String bvid = archive.bvid!;
|
||||
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) {
|
||||
toVideoPage(
|
||||
bvid: bvid,
|
||||
cid: cid,
|
||||
cover: cover,
|
||||
dimension: res!.dimension,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -330,13 +333,15 @@ abstract final class PageUtils {
|
||||
int aid = ugcSeason.aid!;
|
||||
String bvid = IdUtils.av2bv(aid);
|
||||
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) {
|
||||
toVideoPage(
|
||||
aid: aid,
|
||||
bvid: bvid,
|
||||
cid: cid,
|
||||
cover: cover,
|
||||
dimension: res!.dimension,
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -554,6 +559,8 @@ abstract final class PageUtils {
|
||||
int? progress, // milliseconds
|
||||
Map? extraArguments,
|
||||
bool off = false,
|
||||
bool isVertical = false,
|
||||
Dimension? dimension,
|
||||
}) {
|
||||
final arguments = {
|
||||
'aid': aid ?? IdUtils.bv2av(bvid!),
|
||||
@@ -566,6 +573,7 @@ abstract final class PageUtils {
|
||||
'title': ?title,
|
||||
'progress': ?progress,
|
||||
'videoType': videoType,
|
||||
'isVertical': dimension?.isVertical ?? isVertical,
|
||||
'heroTag': Utils.makeHeroTag(cid),
|
||||
...?extraArguments,
|
||||
};
|
||||
|
||||
@@ -49,12 +49,14 @@ abstract final class UrlUtils {
|
||||
final aid = matchRes.av;
|
||||
String? bvid = matchRes.bv;
|
||||
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) {
|
||||
PageUtils.toVideoPage(
|
||||
aid: aid,
|
||||
bvid: bvid,
|
||||
cid: cid,
|
||||
dimension: res!.dimension,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,17 @@ abstract final class Utils {
|
||||
_ => 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) =>
|
||||
'native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user