mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 包月充电视频异常处理(部分)
This commit is contained in:
@@ -52,7 +52,15 @@ class PlayUrlModel {
|
||||
videoCodecid = json['video_codecid'];
|
||||
seekParam = json['seek_param'];
|
||||
seekType = json['seek_type'];
|
||||
dash = Dash.fromJson(json['dash']);
|
||||
if (json['dash'] != null) {
|
||||
dash = Dash.fromJson(json['dash']);
|
||||
} else if (json['durl'] != null) {
|
||||
//试看的充电包月视频可能出现没有dash只有durl的情况
|
||||
var durlList = json['durl']
|
||||
.map<Durl>((e) => Durl.fromJson(e))
|
||||
.toList();
|
||||
//TODO
|
||||
}
|
||||
supportFormats = json['support_formats'] != null
|
||||
? json['support_formats']
|
||||
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||
@@ -92,6 +100,40 @@ class Dash {
|
||||
}
|
||||
}
|
||||
|
||||
class Durl {
|
||||
int? order;
|
||||
int? length;
|
||||
int? size;
|
||||
String? ahead;
|
||||
String? vhead;
|
||||
String? url;
|
||||
List<String>? backupUrl;
|
||||
|
||||
Durl({
|
||||
this.order,
|
||||
this.length,
|
||||
this.size,
|
||||
this.ahead,
|
||||
this.vhead,
|
||||
this.url,
|
||||
this.backupUrl,
|
||||
});
|
||||
|
||||
factory Durl.fromJson(Map<String, dynamic> json) {
|
||||
return Durl(
|
||||
order: json['order'],
|
||||
length: json['length'],
|
||||
size: json['size'],
|
||||
ahead: json['ahead'],
|
||||
vhead: json['vhead'],
|
||||
url: json['url'],
|
||||
backupUrl: json['backup_url'] != null
|
||||
? List<String>.from(json['backup_url'])
|
||||
: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VideoItem {
|
||||
VideoItem({
|
||||
this.id,
|
||||
|
||||
@@ -246,6 +246,16 @@ class VideoDetailController extends GetxController
|
||||
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid);
|
||||
if (result['status']) {
|
||||
data = result['data'];
|
||||
if (data.dash == null) {
|
||||
// isEffective.value = false;
|
||||
if (data.acceptDesc != null) {
|
||||
SmartDialog.showToast('当前视频acceptDesc为:${data.acceptDesc},不支持获取视频链接');
|
||||
} else {
|
||||
SmartDialog.showToast('当前视频未能获取视频链接');
|
||||
}
|
||||
result['status'] = false;
|
||||
return result;
|
||||
}
|
||||
final List<VideoItem> allVideosList = data.dash!.video!;
|
||||
try {
|
||||
// 当前可播放的最高质量视频
|
||||
@@ -349,7 +359,11 @@ class VideoDetailController extends GetxController
|
||||
if (result['code'] == -404) {
|
||||
isShowCover.value = false;
|
||||
}
|
||||
SmartDialog.showToast(result['msg'].toString());
|
||||
if (result['code'] == 87008){
|
||||
SmartDialog.showToast("当前视频可能是专属视频,可能需包月充电观看(${result['msg']})");
|
||||
} else {
|
||||
SmartDialog.showToast("错误(${result['code']}):${result['msg']}");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user