Skip to content

Commit 41d3a63

Browse files
authored
Merge pull request #615 from FoxxMD/artistCreditCleanup
fix: Add missing artist credit transforms
2 parents 44424f2 + f0e798c commit 41d3a63

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/backend/sources/MusikcubeSource.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { RecentlyPlayedOptions } from "./AbstractSource.js";
2525
import { MemoryPositionalSource } from "./MemoryPositionalSource.js";
2626
import { normalizeWSAddress } from "../utils/NetworkUtils.js";
2727
import { baseFormatPlayObj } from "../utils/PlayTransformUtils.js";
28+
import { artistNamesToCredits } from "../../core/StringUtils.js";
2829

2930
const CLIENT_STATE = {
3031
0: 'connecting',
@@ -181,8 +182,8 @@ export class MusikcubeSource extends MemoryPositionalSource {
181182
}
182183
},
183184
} = obj;
184-
const artists = [];
185-
const albumArtists = [];
185+
const artists: string[] = [];
186+
const albumArtists: string[] = [];
186187
if(artist !== undefined) {
187188
artists.push(artist);
188189
}
@@ -191,8 +192,8 @@ export class MusikcubeSource extends MemoryPositionalSource {
191192
}
192193
const play: PlayObjectLifecycleless = {
193194
data: {
194-
artists: artists,
195-
albumArtists,
195+
artists: artistNamesToCredits(artists),
196+
albumArtists: artistNamesToCredits(albumArtists),
196197
album: album === '' ? undefined : album,
197198
track: title === '' ? undefined: title,
198199
duration: playing_duration

src/backend/sources/SubsonicSource.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { UpstreamError } from "../common/errors/UpstreamError.js";
99
import { DEFAULT_RETRY_MULTIPLIER, FormatPlayObjectOptions, InternalConfig, PlayPlatformId } from "../common/infrastructure/Atomic.js";
1010
import { SubSonicSourceConfig } from "../common/infrastructure/config/source/subsonic.js";
1111
import { getSubsonicResponse, SubsonicResponse, SubsonicResponseCommon } from "../common/vendor/subsonic/interfaces.js";
12-
import { parseRetryAfterSecsFromObj, removeDuplicates, sleep } from "../utils.js";
12+
import { removeDuplicates } from "../utils.js";
1313
import { findCauseByFunc } from "../utils/ErrorUtils.js";
1414
import { RecentlyPlayedOptions } from "./AbstractSource.js";
1515
import MemorySource from "./MemorySource.js";
@@ -18,6 +18,7 @@ import { PlayerStateOptions } from './PlayerState/AbstractPlayerState.js';
1818
import { Logger } from '@foxxmd/logging';
1919
import { baseFormatPlayObj } from '../utils/PlayTransformUtils.js';
2020
import { noRetryOnUpstreamError, tryApiCall } from '../utils/RequestUtils.js';
21+
import { artistNameToCredit } from '../../core/StringUtils.js';
2122

2223
dayjs.extend(isSameOrAfter);
2324

@@ -78,7 +79,7 @@ export class SubsonicSource extends MemorySource {
7879

7980
const play: PlayObjectLifecycleless = {
8081
data: {
81-
artists: [artist],
82+
artists: [artistNameToCredit(artist)],
8283
album,
8384
track: title,
8485
duration,

src/backend/sources/VLCSource.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { RecentlyPlayedOptions } from "./AbstractSource.js";
1818
import { MemoryPositionalSource } from "./MemoryPositionalSource.js";
1919
import { isDebugMode } from "../utils.js";
2020
import { baseFormatPlayObj } from "../utils/PlayTransformUtils.js";
21+
import { artistNamesToCredits } from "../../core/StringUtils.js";
2122

2223
const CLIENT_PLAYER_STATE: Record<PlayerState, ReportedPlayerStatus> = {
2324
'playing': REPORTED_PLAYER_STATUSES.playing,
@@ -142,8 +143,8 @@ export class VLCSource extends MemoryPositionalSource {
142143
artist
143144
} = obj;
144145

145-
let artists = [];
146-
let albumArtists = [];
146+
let artists: string[] = [];
147+
let albumArtists: string[] = [];
147148
const validArtist = firstNonEmptyStr([artist, StreamArtist, ALBUMARTIST, Writer]);
148149
if(artist !== undefined) {
149150
artists.push(validArtist);
@@ -217,8 +218,8 @@ export class VLCSource extends MemoryPositionalSource {
217218

218219
const play: PlayObjectLifecycleless = {
219220
data: {
220-
artists: artists,
221-
albumArtists,
221+
artists: artistNamesToCredits(artists),
222+
albumArtists: artistNamesToCredits(albumArtists),
222223
album,
223224
track: trackName,
224225
duration: length

0 commit comments

Comments
 (0)