opt audio playlist

Closes #1547

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-14 21:19:36 +08:00
parent 5035495043
commit 5249ceccdb
6 changed files with 48 additions and 12 deletions

View File

@@ -1,10 +1,38 @@
import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pbenum.dart'
show PlaylistSource;
enum SourceType { enum SourceType {
normal(-1), normal(
archive(1), mediaType: -1,
watchLater(2), playlistSource: PlaylistSource.UP_ARCHIVE,
fav(3), ),
playlist(3); 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; final int mediaType;
const SourceType(this.mediaType); final int? extraId;
final PlaylistSource playlistSource;
const SourceType({
required this.mediaType,
this.extraId,
required this.playlistSource,
});
} }

View File

@@ -40,6 +40,7 @@ class AudioController extends GetxController
late Int64 oid; late Int64 oid;
late List<Int64> subId; late List<Int64> subId;
late int itemType; late int itemType;
Int64? extraId;
late final PlaylistSource from; late final PlaylistSource from;
late final isVideo = itemType == 1; late final isVideo = itemType == 1;
@@ -86,6 +87,10 @@ class AudioController extends GetxController
itemType = args['itemType']; itemType = args['itemType'];
from = args['from']; from = args['from'];
_start = args['start']; _start = args['start'];
final int? extraId = args['extraId'];
if (extraId != null) {
this.extraId = Int64(extraId);
}
if (args['heroTag'] case String heroTag) { if (args['heroTag'] case String heroTag) {
try { try {
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag); _videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
@@ -134,6 +139,7 @@ class AudioController extends GetxController
: isLoadNext : isLoadNext
? _next ? _next
: null, : null,
extraId: extraId,
); );
if (res.isSuccess) { if (res.isSuccess) {
final PlaylistResp data = res.data; final PlaylistResp data = res.data;
@@ -193,7 +199,7 @@ class AudioController extends GetxController
(e) => e.id <= cacheAudioQa, (e) => e.id <= cacheAudioQa,
(a, b) => a.id > b.id ? a : b, (a, b) => a.id > b.id ? a : b,
); );
_onOpenMedia(VideoUtils.getCdnUrl(audio.baseUrl)); _onOpenMedia(VideoUtils.getCdnUrl(audio));
} else if (playInfo.hasPlayUrl()) { } else if (playInfo.hasPlayUrl()) {
final playUrl = playInfo.playUrl; final playUrl = playInfo.playUrl;
final durls = playUrl.durl; final durls = playUrl.durl;

View File

@@ -39,6 +39,7 @@ class AudioPage extends StatefulWidget {
String? heroTag, String? heroTag,
Duration? start, Duration? start,
String? audioUrl, String? audioUrl,
int? extraId,
}) => Get.toNamed( }) => Get.toNamed(
'/audio', '/audio',
arguments: { arguments: {
@@ -50,6 +51,7 @@ class AudioPage extends StatefulWidget {
'heroTag': ?heroTag, 'heroTag': ?heroTag,
'start': ?start, 'start': ?start,
'audioUrl': ?audioUrl, 'audioUrl': ?audioUrl,
'extraId': ?extraId,
}, },
); );
} }

View File

@@ -87,7 +87,7 @@ class _LaterViewChildPageState extends State<LaterViewChildPage>
.counts[LaterViewType.all], .counts[LaterViewType.all],
'favTitle': '稍后再看', 'favTitle': '稍后再看',
'mediaId': _laterController.accountService.mid, 'mediaId': _laterController.accountService.mid,
'desc': false, 'desc': _laterController.asc.value,
'isContinuePlaying': index != 0, 'isContinuePlaying': index != 0,
} }
: null, : null,

View File

@@ -178,7 +178,7 @@ class LaterController extends MultiSelectController<LaterData, LaterItemModel>
'count': baseCtr.counts[LaterViewType.all], 'count': baseCtr.counts[LaterViewType.all],
'favTitle': '稍后再看', 'favTitle': '稍后再看',
'mediaId': accountService.mid, 'mediaId': accountService.mid,
'desc': false, 'desc': asc.value,
}, },
); );
break; break;

View File

@@ -3,8 +3,6 @@ import 'dart:ui';
import 'package:PiliPlus/common/widgets/pair.dart'; import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.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/constants.dart';
import 'package:PiliPlus/http/fav.dart'; import 'package:PiliPlus/http/fav.dart';
import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/init.dart';
@@ -1753,12 +1751,14 @@ class VideoDetailController extends GetxController
void toAudioPage() { void toAudioPage() {
AudioPage.toAudioPage( AudioPage.toAudioPage(
itemType: 1, itemType: 1,
id: args['mediaId'],
oid: aid, oid: aid,
subId: [cid.value], subId: [cid.value],
from: PlaylistSource.UP_ARCHIVE, from: sourceType.playlistSource,
heroTag: autoPlay.value ? heroTag : null, heroTag: autoPlay.value ? heroTag : null,
start: playedTime, start: playedTime,
audioUrl: audioUrl, audioUrl: audioUrl,
extraId: sourceType.extraId,
); );
} }
} }