mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 07:36:14 +08:00
opt audio playlist
Closes #1547 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,10 +1,38 @@
|
||||
import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pbenum.dart'
|
||||
show PlaylistSource;
|
||||
|
||||
enum SourceType {
|
||||
normal(-1),
|
||||
archive(1),
|
||||
watchLater(2),
|
||||
fav(3),
|
||||
playlist(3);
|
||||
normal(
|
||||
mediaType: -1,
|
||||
playlistSource: PlaylistSource.UP_ARCHIVE,
|
||||
),
|
||||
archive(
|
||||
mediaType: 1,
|
||||
extraId: 1,
|
||||
playlistSource: PlaylistSource.MEDIA_LIST,
|
||||
),
|
||||
watchLater(
|
||||
mediaType: 2,
|
||||
extraId: 2,
|
||||
playlistSource: PlaylistSource.MEDIA_LIST,
|
||||
),
|
||||
fav(
|
||||
mediaType: 3,
|
||||
extraId: 2,
|
||||
playlistSource: PlaylistSource.USER_FAVOURITE,
|
||||
),
|
||||
playlist(
|
||||
mediaType: 3,
|
||||
extraId: 4,
|
||||
playlistSource: PlaylistSource.MEDIA_LIST,
|
||||
);
|
||||
|
||||
final int mediaType;
|
||||
const SourceType(this.mediaType);
|
||||
final int? extraId;
|
||||
final PlaylistSource playlistSource;
|
||||
const SourceType({
|
||||
required this.mediaType,
|
||||
this.extraId,
|
||||
required this.playlistSource,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class AudioController extends GetxController
|
||||
late Int64 oid;
|
||||
late List<Int64> subId;
|
||||
late int itemType;
|
||||
Int64? extraId;
|
||||
late final PlaylistSource from;
|
||||
late final isVideo = itemType == 1;
|
||||
|
||||
@@ -86,6 +87,10 @@ class AudioController extends GetxController
|
||||
itemType = args['itemType'];
|
||||
from = args['from'];
|
||||
_start = args['start'];
|
||||
final int? extraId = args['extraId'];
|
||||
if (extraId != null) {
|
||||
this.extraId = Int64(extraId);
|
||||
}
|
||||
if (args['heroTag'] case String heroTag) {
|
||||
try {
|
||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||
@@ -134,6 +139,7 @@ class AudioController extends GetxController
|
||||
: isLoadNext
|
||||
? _next
|
||||
: null,
|
||||
extraId: extraId,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
final PlaylistResp data = res.data;
|
||||
@@ -193,7 +199,7 @@ class AudioController extends GetxController
|
||||
(e) => e.id <= cacheAudioQa,
|
||||
(a, b) => a.id > b.id ? a : b,
|
||||
);
|
||||
_onOpenMedia(VideoUtils.getCdnUrl(audio.baseUrl));
|
||||
_onOpenMedia(VideoUtils.getCdnUrl(audio));
|
||||
} else if (playInfo.hasPlayUrl()) {
|
||||
final playUrl = playInfo.playUrl;
|
||||
final durls = playUrl.durl;
|
||||
|
||||
@@ -39,6 +39,7 @@ class AudioPage extends StatefulWidget {
|
||||
String? heroTag,
|
||||
Duration? start,
|
||||
String? audioUrl,
|
||||
int? extraId,
|
||||
}) => Get.toNamed(
|
||||
'/audio',
|
||||
arguments: {
|
||||
@@ -50,6 +51,7 @@ class AudioPage extends StatefulWidget {
|
||||
'heroTag': ?heroTag,
|
||||
'start': ?start,
|
||||
'audioUrl': ?audioUrl,
|
||||
'extraId': ?extraId,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
|
||||
.counts[LaterViewType.all],
|
||||
'favTitle': '稍后再看',
|
||||
'mediaId': _laterController.accountService.mid,
|
||||
'desc': false,
|
||||
'desc': _laterController.asc.value,
|
||||
'isContinuePlaying': index != 0,
|
||||
}
|
||||
: null,
|
||||
|
||||
@@ -178,7 +178,7 @@ class LaterController extends MultiSelectController<LaterData, LaterItemModel>
|
||||
'count': baseCtr.counts[LaterViewType.all],
|
||||
'favTitle': '稍后再看',
|
||||
'mediaId': accountService.mid,
|
||||
'desc': false,
|
||||
'desc': asc.value,
|
||||
},
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -3,8 +3,6 @@ import 'dart:ui';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pbenum.dart'
|
||||
show PlaylistSource;
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/fav.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
@@ -1753,12 +1751,14 @@ class VideoDetailController extends GetxController
|
||||
void toAudioPage() {
|
||||
AudioPage.toAudioPage(
|
||||
itemType: 1,
|
||||
id: args['mediaId'],
|
||||
oid: aid,
|
||||
subId: [cid.value],
|
||||
from: PlaylistSource.UP_ARCHIVE,
|
||||
from: sourceType.playlistSource,
|
||||
heroTag: autoPlay.value ? heroTag : null,
|
||||
start: playedTime,
|
||||
audioUrl: audioUrl,
|
||||
extraId: sourceType.extraId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user