mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31: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:
@ -120,7 +120,9 @@ const handleData = async (
|
||||
songInfo.mediaType = MediaType.PodcastEpisode;
|
||||
// HACK: Podcast's participant is not the artist
|
||||
if (!config.get('options.usePodcastParticipantAsArtist')) {
|
||||
songInfo.artist = cleanupName(data.microformat.microformatDataRenderer.pageOwnerDetails.name);
|
||||
songInfo.artist = cleanupName(
|
||||
data.microformat.microformatDataRenderer.pageOwnerDetails.name,
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -128,14 +130,13 @@ const handleData = async (
|
||||
// HACK: This is a workaround for "podcast" types where "musicVideoType" doesn't exist. Google :facepalm:
|
||||
if (
|
||||
!config.get('options.usePodcastParticipantAsArtist') &&
|
||||
(
|
||||
data.responseContext.serviceTrackingParams
|
||||
?.at(0)
|
||||
?.params
|
||||
?.find((it) => it.key === 'ipcc')?.value ?? '1'
|
||||
) != '0'
|
||||
(data.responseContext.serviceTrackingParams
|
||||
?.at(0)
|
||||
?.params?.find((it) => it.key === 'ipcc')?.value ?? '1') != '0'
|
||||
) {
|
||||
songInfo.artist = cleanupName(data.microformat.microformatDataRenderer.pageOwnerDetails.name);
|
||||
songInfo.artist = cleanupName(
|
||||
data.microformat.microformatDataRenderer.pageOwnerDetails.name,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -165,10 +166,12 @@ const registerProvider = (win: BrowserWindow) => {
|
||||
|
||||
// This will be called when the song-info-front finds a new request with song data
|
||||
ipcMain.on('ytmd:video-src-changed', async (_, data: GetPlayerResponse) => {
|
||||
const tempSongInfo = await dataMutex.runExclusive<SongInfo | null>(async () => {
|
||||
songInfo = await handleData(data, win);
|
||||
return songInfo;
|
||||
});
|
||||
const tempSongInfo = await dataMutex.runExclusive<SongInfo | null>(
|
||||
async () => {
|
||||
songInfo = await handleData(data, win);
|
||||
return songInfo;
|
||||
},
|
||||
);
|
||||
|
||||
if (tempSongInfo) {
|
||||
for (const c of callbacks) {
|
||||
|
||||
Reference in New Issue
Block a user