Skip to content

Commit

Permalink
Merge pull request #665 from 3flex/playrequest-typing
Browse files Browse the repository at this point in the history
Add PlayRequest typing
  • Loading branch information
nielsvanvelzen authored Nov 3, 2024
2 parents 200a91d + dddb29b commit aa84761
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/components/maincontroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,12 @@ export async function translateItems(
export async function instantMix(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: any,
options: PlayRequest,
item: BaseItemDto
): Promise<void> {
const result = await getInstantMixItems(data.userId, item);

options.items = result.Items;
options.items = result.Items ?? [];
PlaybackManager.playFromOptions(data.options);
}

Expand All @@ -613,13 +612,12 @@ export async function instantMix(
export async function shuffle(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: any,
options: PlayRequest,
item: BaseItemDto
): Promise<void> {
const result = await getShuffleItems(data.userId, item);

options.items = result.Items;
options.items = result.Items ?? [];
PlaybackManager.playFromOptions(data.options);
}

Expand Down
5 changes: 2 additions & 3 deletions src/components/playbackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
checkDirectPlay,
createMediaInformation
} from './maincontroller';
import { ItemIndex } from '~/types/global';
import { ItemIndex, PlayRequest } from '~/types/global';

export interface PlaybackState {
startPositionTicks: number;
Expand Down Expand Up @@ -104,8 +104,7 @@ export abstract class PlaybackManager {
);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
static async playFromOptions(options: any): Promise<void> {
static async playFromOptions(options: PlayRequest): Promise<void> {
const firstItem = options.items[0];

if (options.startPositionTicks || firstItem.MediaType !== 'Video') {
Expand Down

0 comments on commit aa84761

Please sign in to comment.