mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +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 { Play } from '/@/types';
|
||||||
import { LibraryItem } from '/@/types';
|
import { LibraryItem } from '/@/types';
|
||||||
import { queryKeys } from '../../../api/query-keys';
|
import { queryKeys } from '../../../api/query-keys';
|
||||||
import { apiController } from '/@/api/controller';
|
|
||||||
import { queryClient } from '/@/lib/react-query';
|
import { queryClient } from '/@/lib/react-query';
|
||||||
import { ndNormalize } from '/@/api/navidrome.api';
|
import { ndNormalize } from '/@/api/navidrome.api';
|
||||||
import type { NDSong } from '/@/api/navidrome.types';
|
import type { NDSong } from '/@/api/navidrome.types';
|
||||||
|
import { toast } from '/@/components';
|
||||||
|
import { controller } from '/@/api/controller';
|
||||||
|
|
||||||
export const handlePlayQueueAdd = async (options: PlayQueueAddOptions) => {
|
export const handlePlayQueueAdd = async (options: PlayQueueAddOptions) => {
|
||||||
const playerType = useSettingsStore.getState().player.type;
|
const playerType = useSettingsStore.getState().player.type;
|
||||||
const deviceId = useAuthStore.getState().deviceId;
|
const deviceId = useAuthStore.getState().deviceId;
|
||||||
const server = useAuthStore.getState().currentServer;
|
const server = useAuthStore.getState().currentServer;
|
||||||
|
|
||||||
console.log('options :>> ', options);
|
if (!server) return toast.error({ message: 'No server selected' });
|
||||||
|
|
||||||
// if (options.byData) {
|
|
||||||
// // dispatchSongsToQueue(options.byData, options.play);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (options.byItemType) {
|
if (options.byItemType) {
|
||||||
let songs = null;
|
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) {
|
if (options.byItemType.type === LibraryItem.ALBUM) {
|
||||||
const albumDetail = await queryClient.fetchQuery(
|
const albumDetail = await queryClient.fetchQuery(
|
||||||
queryKeys.albums.detail(options.byItemType.id),
|
queryKeys.albums.detail(server?.id, { id: options.byItemType.id }),
|
||||||
async ({ signal }) => apiController.getAlbumDetail({ id: options.byItemType!.id }, signal),
|
async ({ signal }) =>
|
||||||
|
controller.getAlbumDetail({ query: { id: options.byItemType!.id }, server, signal }),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!albumDetail) return;
|
if (!albumDetail) return;
|
||||||
@@ -58,8 +42,6 @@ export const handlePlayQueueAdd = async (options: PlayQueueAddOptions) => {
|
|||||||
case 'subsonic':
|
case 'subsonic':
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('songs :>> ', songs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!songs) return;
|
if (!songs) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user