mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
fix: apply fix from eslint
This commit is contained in:
@ -2,7 +2,11 @@ import { singleton } from './decorators';
|
||||
|
||||
import type { YoutubePlayer } from '@/types/youtube-player';
|
||||
import type { GetState } from '@/types/datahost-get-state';
|
||||
import type { AlbumDetails, PlayerOverlays, VideoDataChangeValue } from '@/types/player-api-events';
|
||||
import type {
|
||||
AlbumDetails,
|
||||
PlayerOverlays,
|
||||
VideoDataChangeValue,
|
||||
} from '@/types/player-api-events';
|
||||
|
||||
import type { SongInfo } from './song-info';
|
||||
import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||
@ -10,9 +14,12 @@ import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||
let songInfo: SongInfo = {} as SongInfo;
|
||||
export const getSongInfo = () => songInfo;
|
||||
|
||||
window.ipcRenderer.on('ytmd:update-song-info', (_, extractedSongInfo: SongInfo) => {
|
||||
songInfo = extractedSongInfo;
|
||||
});
|
||||
window.ipcRenderer.on(
|
||||
'ytmd:update-song-info',
|
||||
(_, extractedSongInfo: SongInfo) => {
|
||||
songInfo = extractedSongInfo;
|
||||
},
|
||||
);
|
||||
|
||||
// Used because 'loadeddata' or 'loadedmetadata' weren't firing on song start for some users (https://github.com/th-ch/youtube-music/issues/473)
|
||||
const srcChangedEvent = new CustomEvent('ytmd:src-changed');
|
||||
@ -91,9 +98,8 @@ export const setupFullScreenChangedListener = singleton(() => {
|
||||
const observer = new MutationObserver(() => {
|
||||
window.ipcRenderer.send(
|
||||
'ytmd:fullscreen-changed',
|
||||
(
|
||||
playerBar?.attributes.getNamedItem('player-fullscreened') ?? null
|
||||
) !== null,
|
||||
(playerBar?.attributes.getNamedItem('player-fullscreened') ?? null) !==
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
@ -203,15 +209,19 @@ export default (api: YoutubePlayer) => {
|
||||
|
||||
if (!isNaN(video.duration)) {
|
||||
const {
|
||||
title, author,
|
||||
title,
|
||||
author,
|
||||
video_id: videoId,
|
||||
list: playlistId
|
||||
list: playlistId,
|
||||
} = api.getVideoData();
|
||||
|
||||
const watchNextResponse = api.getWatchNextResponse();
|
||||
|
||||
sendSongInfo({
|
||||
title, author, videoId, playlistId,
|
||||
title,
|
||||
author,
|
||||
videoId,
|
||||
playlistId,
|
||||
|
||||
isUpcoming: false,
|
||||
lengthSeconds: video.duration,
|
||||
@ -236,9 +246,10 @@ export default (api: YoutubePlayer) => {
|
||||
} else {
|
||||
playerOverlay = videoData.ytmdWatchNextResponse?.playerOverlays;
|
||||
}
|
||||
data.videoDetails.album = playerOverlay?.playerOverlayRenderer?.browserMediaSession?.browserMediaSessionRenderer?.album?.runs?.at(
|
||||
0,
|
||||
)?.text;
|
||||
data.videoDetails.album =
|
||||
playerOverlay?.playerOverlayRenderer?.browserMediaSession?.browserMediaSessionRenderer?.album?.runs?.at(
|
||||
0,
|
||||
)?.text;
|
||||
data.videoDetails.elapsedSeconds = 0;
|
||||
data.videoDetails.isPaused = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user