expose more mpris metadata

This commit is contained in:
Kendall Garner 2024-01-28 14:26:02 -08:00
parent 5cc2276781
commit 8287347f91
No known key found for this signature in database
GPG Key ID: 18D2767419676C87

View File

@ -154,12 +154,19 @@ ipcMain.on('update-song', (_event, args: SongUpdate) => {
? song.albumArtists.map((artist) => artist.name) ? song.albumArtists.map((artist) => artist.name)
: null, : null,
'xesam:artist': song.artists?.length ? song.artists.map((artist) => artist.name) : null, 'xesam:artist': song.artists?.length ? song.artists.map((artist) => artist.name) : null,
'xesam:audioBpm': song.bpm,
// Comment is a `list of strings` type
'xesam:comment': song.comment ? [song.comment] : null,
'xesam:contentCreated': song.releaseDate,
'xesam:discNumber': song.discNumber ? song.discNumber : null, 'xesam:discNumber': song.discNumber ? song.discNumber : null,
'xesam:genre': song.genres?.length ? song.genres.map((genre: any) => genre.name) : null, 'xesam:genre': song.genres?.length ? song.genres.map((genre: any) => genre.name) : null,
'xesam:lastUsed': song.lastPlayedAt,
'xesam:title': song.name || null, 'xesam:title': song.name || null,
'xesam:trackNumber': song.trackNumber ? song.trackNumber : null, 'xesam:trackNumber': song.trackNumber ? song.trackNumber : null,
'xesam:useCount': 'xesam:useCount':
song.playCount !== null && song.playCount !== undefined ? song.playCount : null, song.playCount !== null && song.playCount !== undefined ? song.playCount : null,
// User ratings are only on Navidrome/Subsonic and are on a scale of 1-5
'xesam:userRating': song.userRating ? song.userRating / 5 : null,
}; };
} catch (err) { } catch (err) {
console.log(err); console.log(err);