mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat: Allow scrobbling using alternative song titles (#3093)
This commit is contained in:
@ -127,8 +127,13 @@ export class LastFmScrobbler extends ScrobblerBase {
|
||||
await this.createSession(config, setConfig);
|
||||
}
|
||||
|
||||
const title =
|
||||
config.alternativeTitles && songInfo.alternativeTitle !== undefined
|
||||
? songInfo.alternativeTitle
|
||||
: songInfo.title;
|
||||
|
||||
const postData: LastFmSongData = {
|
||||
track: songInfo.title,
|
||||
track: title,
|
||||
duration: songInfo.songDuration,
|
||||
artist: songInfo.artist,
|
||||
...(songInfo.album ? { album: songInfo.album } : undefined), // Will be undefined if current song is a video
|
||||
|
||||
@ -48,7 +48,7 @@ export class ListenbrainzScrobbler extends ScrobblerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
const body = createRequestBody('playing_now', songInfo);
|
||||
const body = createRequestBody('playing_now', songInfo, config);
|
||||
submitListen(body, config);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ export class ListenbrainzScrobbler extends ScrobblerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
const body = createRequestBody('single', songInfo);
|
||||
const body = createRequestBody('single', songInfo, config);
|
||||
body.payload[0].listened_at = Math.trunc(Date.now() / 1000);
|
||||
|
||||
submitListen(body, config);
|
||||
@ -74,10 +74,16 @@ export class ListenbrainzScrobbler extends ScrobblerBase {
|
||||
function createRequestBody(
|
||||
listenType: string,
|
||||
songInfo: SongInfo,
|
||||
config: ScrobblerPluginConfig,
|
||||
): ListenbrainzRequestBody {
|
||||
const title =
|
||||
config.alternativeTitles && songInfo.alternativeTitle !== undefined
|
||||
? songInfo.alternativeTitle
|
||||
: songInfo.title;
|
||||
|
||||
const trackMetadata = {
|
||||
artist_name: songInfo.artist,
|
||||
track_name: songInfo.title,
|
||||
track_name: title,
|
||||
release_name: songInfo.album ?? undefined,
|
||||
additional_info: {
|
||||
media_player: 'YouTube Music Desktop App',
|
||||
|
||||
Reference in New Issue
Block a user