mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: fix bugs in MPRIS, and improve MPRIS (#1760)
Co-authored-by: JellyBrick <shlee1503@naver.com> Co-authored-by: Totto <32566573+Totto16@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import type { PlayerConfig } from '@/types/get-player-response';
|
||||
|
||||
export interface GetState {
|
||||
castStatus: CastStatus;
|
||||
entities: Entities;
|
||||
@ -32,17 +34,11 @@ export interface Download {
|
||||
export interface Entities {}
|
||||
|
||||
export interface LikeStatus {
|
||||
videos: Videos;
|
||||
videos: Record<string, LikeType>;
|
||||
playlists: Entities;
|
||||
}
|
||||
|
||||
export interface Videos {
|
||||
tNVTuUEeWP0: Kqp1PyPRBzA;
|
||||
KQP1PyPrBzA: Kqp1PyPRBzA;
|
||||
'o1iz4L-5zkQ': Kqp1PyPRBzA;
|
||||
}
|
||||
|
||||
export enum Kqp1PyPRBzA {
|
||||
export enum LikeType {
|
||||
Dislike = 'DISLIKE',
|
||||
Indifferent = 'INDIFFERENT',
|
||||
Like = 'LIKE',
|
||||
@ -195,14 +191,10 @@ export interface Target {
|
||||
|
||||
export interface CommandWatchEndpoint {
|
||||
videoId: string;
|
||||
params: PurpleParams;
|
||||
params: string;
|
||||
watchEndpointMusicSupportedConfigs: PurpleWatchEndpointMusicSupportedConfigs;
|
||||
}
|
||||
|
||||
export enum PurpleParams {
|
||||
WAEB = 'wAEB',
|
||||
}
|
||||
|
||||
export interface PurpleWatchEndpointMusicSupportedConfigs {
|
||||
watchEndpointMusicConfig: PurpleWatchEndpointMusicConfig;
|
||||
}
|
||||
@ -381,7 +373,7 @@ export enum SharePanelType {
|
||||
export interface PurpleWatchEndpoint {
|
||||
videoId: string;
|
||||
playlistId: string;
|
||||
params: PurpleParams;
|
||||
params: string;
|
||||
loggingContext: LoggingContext;
|
||||
watchEndpointMusicSupportedConfigs: PurpleWatchEndpointMusicSupportedConfigs;
|
||||
}
|
||||
@ -466,7 +458,7 @@ export interface FeedbackEndpoint {
|
||||
}
|
||||
|
||||
export interface PurpleLikeEndpoint {
|
||||
status: Kqp1PyPRBzA;
|
||||
status: LikeType;
|
||||
target: Target;
|
||||
actions?: LikeEndpointAction[];
|
||||
}
|
||||
@ -488,7 +480,7 @@ export interface PurpleToggledServiceEndpoint {
|
||||
}
|
||||
|
||||
export interface FluffyLikeEndpoint {
|
||||
status: Kqp1PyPRBzA;
|
||||
status: LikeType;
|
||||
target: Target;
|
||||
}
|
||||
|
||||
@ -690,7 +682,7 @@ export interface FluffyDefaultServiceEndpoint {
|
||||
}
|
||||
|
||||
export interface TentacledLikeEndpoint {
|
||||
status: Kqp1PyPRBzA;
|
||||
status: LikeType;
|
||||
target: AddToPlaylistEndpoint;
|
||||
actions?: LikeEndpointAction[];
|
||||
}
|
||||
@ -702,7 +694,7 @@ export interface FluffyToggledServiceEndpoint {
|
||||
}
|
||||
|
||||
export interface StickyLikeEndpoint {
|
||||
status: Kqp1PyPRBzA;
|
||||
status: LikeType;
|
||||
target: AddToPlaylistEndpoint;
|
||||
}
|
||||
|
||||
@ -1185,81 +1177,6 @@ export interface PtrackingURLClass {
|
||||
headers: HeaderElement[];
|
||||
}
|
||||
|
||||
export interface PlayerConfig {
|
||||
audioConfig: AudioConfig;
|
||||
streamSelectionConfig: StreamSelectionConfig;
|
||||
mediaCommonConfig: MediaCommonConfig;
|
||||
webPlayerConfig: WebPlayerConfig;
|
||||
}
|
||||
|
||||
export interface AudioConfig {
|
||||
loudnessDb: number;
|
||||
perceptualLoudnessDb: number;
|
||||
enablePerFormatLoudness: boolean;
|
||||
}
|
||||
|
||||
export interface MediaCommonConfig {
|
||||
dynamicReadaheadConfig: DynamicReadaheadConfig;
|
||||
}
|
||||
|
||||
export interface DynamicReadaheadConfig {
|
||||
maxReadAheadMediaTimeMs: number;
|
||||
minReadAheadMediaTimeMs: number;
|
||||
readAheadGrowthRateMs: number;
|
||||
}
|
||||
|
||||
export interface StreamSelectionConfig {
|
||||
maxBitrate: string;
|
||||
}
|
||||
|
||||
export interface WebPlayerConfig {
|
||||
useCobaltTvosDash: boolean;
|
||||
webPlayerActionsPorting: WebPlayerActionsPorting;
|
||||
gatewayExperimentGroup: string;
|
||||
}
|
||||
|
||||
export interface WebPlayerActionsPorting {
|
||||
subscribeCommand: SubscribeCommand;
|
||||
unsubscribeCommand: UnsubscribeCommand;
|
||||
addToWatchLaterCommand: AddToWatchLaterCommand;
|
||||
removeFromWatchLaterCommand: RemoveFromWatchLaterCommand;
|
||||
}
|
||||
|
||||
export interface AddToWatchLaterCommand {
|
||||
clickTrackingParams: string;
|
||||
playlistEditEndpoint: AddToWatchLaterCommandPlaylistEditEndpoint;
|
||||
}
|
||||
|
||||
export interface AddToWatchLaterCommandPlaylistEditEndpoint {
|
||||
playlistId: string;
|
||||
actions: PurpleAction[];
|
||||
}
|
||||
|
||||
export interface PurpleAction {
|
||||
addedVideoId: string;
|
||||
action: string;
|
||||
}
|
||||
|
||||
export interface RemoveFromWatchLaterCommand {
|
||||
clickTrackingParams: string;
|
||||
playlistEditEndpoint: RemoveFromWatchLaterCommandPlaylistEditEndpoint;
|
||||
}
|
||||
|
||||
export interface RemoveFromWatchLaterCommandPlaylistEditEndpoint {
|
||||
playlistId: string;
|
||||
actions: FluffyAction[];
|
||||
}
|
||||
|
||||
export interface FluffyAction {
|
||||
action: string;
|
||||
removedVideoId: string;
|
||||
}
|
||||
|
||||
export interface SubscribeCommand {
|
||||
clickTrackingParams: string;
|
||||
subscribeEndpoint: SubscribeEndpoint;
|
||||
}
|
||||
|
||||
export interface Storyboards {
|
||||
playerStoryboardSpecRenderer: PlayerStoryboardSpecRenderer;
|
||||
}
|
||||
@ -1384,7 +1301,7 @@ export interface PlayerOverlayRendererAction {
|
||||
|
||||
export interface LikeButtonRenderer {
|
||||
target: Target;
|
||||
likeStatus: Kqp1PyPRBzA;
|
||||
likeStatus: LikeType;
|
||||
trackingParams: string;
|
||||
likesAllowed: boolean;
|
||||
serviceEndpoints: ServiceEndpoint[];
|
||||
@ -1396,13 +1313,14 @@ export interface ServiceEndpoint {
|
||||
}
|
||||
|
||||
export interface ServiceEndpointLikeEndpoint {
|
||||
status: Kqp1PyPRBzA;
|
||||
status: LikeType;
|
||||
target: Target;
|
||||
likeParams?: LikeParams;
|
||||
dislikeParams?: LikeParams;
|
||||
removeLikeParams?: LikeParams;
|
||||
}
|
||||
|
||||
// TODO: Add more
|
||||
export enum LikeParams {
|
||||
Oai3D = 'OAI%3D',
|
||||
}
|
||||
@ -1467,16 +1385,12 @@ export interface CurrentVideoEndpoint {
|
||||
|
||||
export interface CurrentVideoEndpointWatchEndpoint {
|
||||
videoId: string;
|
||||
playlistId: PlaylistID;
|
||||
playlistId: string;
|
||||
index: number;
|
||||
playlistSetVideoId: string;
|
||||
loggingContext: LoggingContext;
|
||||
}
|
||||
|
||||
export enum PlaylistID {
|
||||
RDAMVMrkaNKAvksDE = 'RDAMVMrkaNKAvksDE',
|
||||
}
|
||||
|
||||
export interface PlayerPageWatchNextResponseResponseContext {
|
||||
serviceTrackingParams: ServiceTrackingParam[];
|
||||
}
|
||||
@ -1536,6 +1450,8 @@ export interface FlagEndpoint {
|
||||
flagAction: string;
|
||||
}
|
||||
|
||||
export type RepeatMode = 'NONE' | 'ONE' | 'ALL';
|
||||
|
||||
export interface Queue {
|
||||
automixItems: unknown[];
|
||||
autoplay: boolean;
|
||||
@ -1553,7 +1469,7 @@ export interface Queue {
|
||||
nextQueueItemId: number;
|
||||
playbackContentMode: string;
|
||||
queueContextParams: string;
|
||||
repeatMode: string;
|
||||
repeatMode: RepeatMode;
|
||||
responsiveSignals: ResponsiveSignals;
|
||||
selectedItemIndex: number;
|
||||
shuffleEnabled: boolean;
|
||||
@ -1642,23 +1558,15 @@ export interface PlaylistPanelVideoRendererNavigationEndpoint {
|
||||
|
||||
export interface FluffyWatchEndpoint {
|
||||
videoId: string;
|
||||
playlistId?: PlaylistID;
|
||||
playlistId?: string;
|
||||
index: number;
|
||||
params: FluffyParams;
|
||||
playerParams?: PlayerParams;
|
||||
params: string;
|
||||
playerParams?: string;
|
||||
playlistSetVideoId?: string;
|
||||
loggingContext?: LoggingContext;
|
||||
watchEndpointMusicSupportedConfigs: FluffyWatchEndpointMusicSupportedConfigs;
|
||||
}
|
||||
|
||||
export enum FluffyParams {
|
||||
OAHyAQIIAQ3D3D = 'OAHyAQIIAQ%3D%3D',
|
||||
}
|
||||
|
||||
export enum PlayerParams {
|
||||
The8Aub = '8AUB',
|
||||
}
|
||||
|
||||
export interface FluffyWatchEndpointMusicSupportedConfigs {
|
||||
watchEndpointMusicConfig: FluffyWatchEndpointMusicConfig;
|
||||
}
|
||||
|
||||
40
src/types/queue.ts
Normal file
40
src/types/queue.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import type { YoutubePlayer } from '@/types/youtube-player';
|
||||
import type { GetState, QueueItem } from '@/types/datahost-get-state';
|
||||
|
||||
type StoreState = GetState;
|
||||
type Store = {
|
||||
dispatch: (obj: {
|
||||
type: string;
|
||||
payload?: {
|
||||
items?: QueueItem[];
|
||||
};
|
||||
}) => void;
|
||||
|
||||
getState: () => StoreState;
|
||||
replaceReducer: (param1: unknown) => unknown;
|
||||
subscribe: (callback: () => void) => unknown;
|
||||
}
|
||||
|
||||
export type QueueElement = HTMLElement & {
|
||||
dispatch(obj: {
|
||||
type: string;
|
||||
payload?: unknown;
|
||||
}): void;
|
||||
queue: QueueAPI;
|
||||
};
|
||||
export type QueueAPI = {
|
||||
getItems(): QueueItem[];
|
||||
store: {
|
||||
store: Store,
|
||||
};
|
||||
continuation?: string;
|
||||
autoPlaying?: boolean;
|
||||
};
|
||||
export type AppElement = HTMLElement & AppAPI;
|
||||
export type AppAPI = {
|
||||
queue_: QueueAPI;
|
||||
playerApi_: YoutubePlayer;
|
||||
openToast: (message: string) => void;
|
||||
|
||||
// TODO: Add more
|
||||
};
|
||||
7
src/types/youtube-music-desktop-internal.ts
Normal file
7
src/types/youtube-music-desktop-internal.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { QueueItem } from '@/types/datahost-get-state';
|
||||
|
||||
export interface QueueResponse {
|
||||
items?: QueueItem[];
|
||||
autoPlaying?: boolean;
|
||||
continuation?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user