mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 12:30:12 +02:00
Handle playqueue with new controller
This commit is contained in:
@@ -6,43 +6,27 @@ import { PlaybackType } from '/@/types';
|
||||
import { Play } from '/@/types';
|
||||
import { LibraryItem } from '/@/types';
|
||||
import { queryKeys } from '../../../api/query-keys';
|
||||
import { apiController } from '/@/api/controller';
|
||||
import { queryClient } from '/@/lib/react-query';
|
||||
import { ndNormalize } from '/@/api/navidrome.api';
|
||||
import type { NDSong } from '/@/api/navidrome.types';
|
||||
import { toast } from '/@/components';
|
||||
import { controller } from '/@/api/controller';
|
||||
|
||||
export const handlePlayQueueAdd = async (options: PlayQueueAddOptions) => {
|
||||
const playerType = useSettingsStore.getState().player.type;
|
||||
const deviceId = useAuthStore.getState().deviceId;
|
||||
const server = useAuthStore.getState().currentServer;
|
||||
|
||||
console.log('options :>> ', options);
|
||||
|
||||
// if (options.byData) {
|
||||
// // dispatchSongsToQueue(options.byData, options.play);
|
||||
// }
|
||||
if (!server) return toast.error({ message: 'No server selected' });
|
||||
|
||||
if (options.byItemType) {
|
||||
let songs = null;
|
||||
// switch (options.byItemType.type) {
|
||||
// case LibraryItem.ALBUM:
|
||||
// const response = await queryClient.fetchQuery(
|
||||
// queryKeys.albums.detail(options.byItemType.id),
|
||||
// async ({ signal }) => apiController.getAlbumDetail({ id: options.byItemType.id }, signal),
|
||||
// );
|
||||
// songs = normalizeFn[currentServer!.type as keyof typeof normalizeFn]?.album(
|
||||
// response?.items,
|
||||
// currentServer,
|
||||
// );
|
||||
// break;
|
||||
// }
|
||||
|
||||
// if (!songs | !response) return;
|
||||
|
||||
if (options.byItemType.type === LibraryItem.ALBUM) {
|
||||
const albumDetail = await queryClient.fetchQuery(
|
||||
queryKeys.albums.detail(options.byItemType.id),
|
||||
async ({ signal }) => apiController.getAlbumDetail({ id: options.byItemType!.id }, signal),
|
||||
queryKeys.albums.detail(server?.id, { id: options.byItemType.id }),
|
||||
async ({ signal }) =>
|
||||
controller.getAlbumDetail({ query: { id: options.byItemType!.id }, server, signal }),
|
||||
);
|
||||
|
||||
if (!albumDetail) return;
|
||||
@@ -58,8 +42,6 @@ export const handlePlayQueueAdd = async (options: PlayQueueAddOptions) => {
|
||||
case 'subsonic':
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('songs :>> ', songs);
|
||||
}
|
||||
|
||||
if (!songs) return;
|
||||
|
||||
Reference in New Issue
Block a user