|
@@ -29,17 +29,16 @@ import { embyApi, EmbyAlbum, EmbyArtist, EmbyPlaylist, EmbySong } from '../commo
|
|
|
import { audioStationApi, AudioStationAlbum, AudioStationArtist, AudioStationPlaylist, AudioStationSong } from '../common/network/AudioStationApi';
|
|
import { audioStationApi, AudioStationAlbum, AudioStationArtist, AudioStationPlaylist, AudioStationSong } from '../common/network/AudioStationApi';
|
|
|
import { plexApi, PlexAlbum, PlexArtist, PlexPlaylist, PlexSong } from '../common/network/PlexApi';
|
|
import { plexApi, PlexAlbum, PlexArtist, PlexPlaylist, PlexSong } from '../common/network/PlexApi';
|
|
|
import { daoLiYuApi, DaoLiYuAlbum, DaoLiYuArtist, DaoLiYuTrack, DaoLiYuPlaylist } from '../common/network/DaoLiYuApi';
|
|
import { daoLiYuApi, DaoLiYuAlbum, DaoLiYuArtist, DaoLiYuTrack, DaoLiYuPlaylist } from '../common/network/DaoLiYuApi';
|
|
|
-import { getRemoteDriveDisplayLabel } from '../common/util/RemoteDriveLabel';
|
|
|
|
|
import NavidromeListCache, { AllCacheData } from '../common/util/NavidromeListCache';
|
|
import NavidromeListCache, { AllCacheData } from '../common/util/NavidromeListCache';
|
|
|
import { LazyDataSource } from '../common/util/LazyDataSource';
|
|
import { LazyDataSource } from '../common/util/LazyDataSource';
|
|
|
import { taskpool } from '@kit.ArkTS';
|
|
import { taskpool } from '@kit.ArkTS';
|
|
|
import { SearchHistoryUtil } from '../common/util/SearchHistoryUtil';
|
|
import { SearchHistoryUtil } from '../common/util/SearchHistoryUtil';
|
|
|
import { PlayingIndicator } from './PlayingIndicator';
|
|
import { PlayingIndicator } from './PlayingIndicator';
|
|
|
import { hdsEffect } from '@kit.UIDesignKit';
|
|
import { hdsEffect } from '@kit.UIDesignKit';
|
|
|
-import { PlaylistPlayRequest, savePendingPlaylistPlay } from '../common/util/PlaylistPlayRequestStore';
|
|
|
|
|
import { filterAlbumsByKeyword, filterArtistsByKeyword, filterPlaylistsByKeyword } from '../common/util/RemoteMusicSearchHelper';
|
|
import { filterAlbumsByKeyword, filterArtistsByKeyword, filterPlaylistsByKeyword } from '../common/util/RemoteMusicSearchHelper';
|
|
|
|
|
+import { MusicPlaybackController } from '../controller/MusicPlaybackController';
|
|
|
|
|
+import { shouldRenderRemoteMusicSongView } from '../common/util/RemoteMusicViewModeHelper';
|
|
|
|
|
|
|
|
-const NAVIDROME_PLAYLIST_ID = 'navidrome-playlist';
|
|
|
|
|
const NAVIDROME_SEARCH_LIMIT = 500;
|
|
const NAVIDROME_SEARCH_LIMIT = 500;
|
|
|
|
|
|
|
|
const ITEM_HEIGHT_SMALL: number = 48; // 列表项小高度
|
|
const ITEM_HEIGHT_SMALL: number = 48; // 列表项小高度
|
|
@@ -342,6 +341,7 @@ export struct RemoteMusicPage {
|
|
|
@State sortType: number = 0; // 排序类型 0:名称升序 1:名称降序 2:时间升序 3:时间降序 4:大小升序 5:大小降序
|
|
@State sortType: number = 0; // 排序类型 0:名称升序 1:名称降序 2:时间升序 3:时间降序 4:大小升序 5:大小降序
|
|
|
@State isSearchLoading: boolean = false;
|
|
@State isSearchLoading: boolean = false;
|
|
|
private readonly REMOTE_SEARCH_LIMIT: number = 500;
|
|
private readonly REMOTE_SEARCH_LIMIT: number = 500;
|
|
|
|
|
+ private playbackController: MusicPlaybackController = MusicPlaybackController.getInstance()
|
|
|
|
|
|
|
|
// SegmentButton选项
|
|
// SegmentButton选项
|
|
|
@State tabOptions: SegmentButtonOptions = this.createTabOptions();
|
|
@State tabOptions: SegmentButtonOptions = this.createTabOptions();
|
|
@@ -3842,22 +3842,16 @@ export struct RemoteMusicPage {
|
|
|
if (this.serverTotalSongCount > 0) {
|
|
if (this.serverTotalSongCount > 0) {
|
|
|
setNavidromeTotalCount(this.serverTotalSongCount);
|
|
setNavidromeTotalCount(this.serverTotalSongCount);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- const playlistData = new PlaylistPlayRequest(
|
|
|
|
|
- NAVIDROME_PLAYLIST_ID,
|
|
|
|
|
- `${getRemoteDriveDisplayLabel(account.webType)} - ${account.name ?? '未知账户'}`,
|
|
|
|
|
- this.serverTotalSongCount > 0 ? this.serverTotalSongCount : playlistSource.length,
|
|
|
|
|
|
|
+ void this.playbackController.playQueue(
|
|
|
|
|
+ playlistSource.slice(),
|
|
|
startIndex,
|
|
startIndex,
|
|
|
- playlistSource.map(item => item.filePath),
|
|
|
|
|
- isJump
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- const eventPlaylistPlay: emitter.InnerEvent = { eventId: EventConstants.EVENT_PLAYLIST_PLAY };
|
|
|
|
|
- savePendingPlaylistPlay(playlistData);
|
|
|
|
|
- emitter.emit(eventPlaylistPlay, { data: playlistData });
|
|
|
|
|
-
|
|
|
|
|
- void ServerLogUtil.info('StreamingPlay', `播放事件已发送`);
|
|
|
|
|
- void ServerLogUtil.debug('StreamingPlay', `播放事件详情: 列表ID=${playlistData.playlistId}, 列表名称=${playlistData.playlistName}, 歌曲数=${playlistData.songCount}, 起始索引=${playlistData.startIndex}, 是否跳转=${playlistData.isJump}`);
|
|
|
|
|
|
|
+ isJump ? 'controller-open' : 'remote-music'
|
|
|
|
|
+ ).then(() => {
|
|
|
|
|
+ void ServerLogUtil.info('StreamingPlay', '播放请求已通过 controller 发送');
|
|
|
|
|
+ }).catch((error: Error) => {
|
|
|
|
|
+ void ServerLogUtil.error('StreamingPlay', `播放失败: ${error.message}`);
|
|
|
|
|
+ ToastUtil.showToast('播放失败');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -4006,7 +4000,7 @@ export struct RemoteMusicPage {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- if (this.selectedTab === 0||this.isDetailView) {
|
|
|
|
|
|
|
+ if (shouldRenderRemoteMusicSongView(this.selectedTab, this.isDetailView)) {
|
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
|
GridItem() {
|
|
GridItem() {
|
|
|
this.buildSongItemGrid(item, index)
|
|
this.buildSongItemGrid(item, index)
|
|
@@ -4579,7 +4573,7 @@ export struct RemoteMusicPage {
|
|
|
getListView() {
|
|
getListView() {
|
|
|
List({scroller:this.scroller, space: 8 }) {
|
|
List({scroller:this.scroller, space: 8 }) {
|
|
|
// 详情视图模式下显示筛选后的歌曲,否则根据标签页显示对应内容
|
|
// 详情视图模式下显示筛选后的歌曲,否则根据标签页显示对应内容
|
|
|
- if (this.selectedTab === 0||this.isDetailView) {
|
|
|
|
|
|
|
+ if (shouldRenderRemoteMusicSongView(this.selectedTab, this.isDetailView)) {
|
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
|
ListItem() {
|
|
ListItem() {
|
|
|
this.buildSongItem(item, index)
|
|
this.buildSongItem(item, index)
|
|
@@ -4742,7 +4736,7 @@ export struct RemoteMusicPage {
|
|
|
layoutMode: WaterFlowLayoutMode.SLIDING_WINDOW
|
|
layoutMode: WaterFlowLayoutMode.SLIDING_WINDOW
|
|
|
}) {
|
|
}) {
|
|
|
|
|
|
|
|
- if (this.selectedTab === 0) {
|
|
|
|
|
|
|
+ if (shouldRenderRemoteMusicSongView(this.selectedTab, this.isDetailView)) {
|
|
|
// 歌曲瀑布流
|
|
// 歌曲瀑布流
|
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
LazyForEach(this.songDataSource, (item: VideoItem, index: number) => {
|
|
|
FlowItem() {
|
|
FlowItem() {
|