Skip to content

Commit

Permalink
Fix the getRecentlyPlayed to semi-working state.
Browse files Browse the repository at this point in the history
  • Loading branch information
samip5 committed Jan 4, 2024
1 parent f7538f9 commit 3845cf8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/backend/sources/AppleSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export class AppleSource extends MemorySource {
data: {
artists: [artist],
album,
duration: duration / 1000
track: tittle,
duration: duration / 1000 // It's actually milliseconds.
},
meta: {
source: 'Apple',
Expand All @@ -110,18 +111,12 @@ export class AppleSource extends MemorySource {
}
}

// @ts-ignore
getRecentlyPlayed = async(options: RecentlyPlayedOptions = {})=> {
const {formatted = false} = options;
const resp = await this.apiClient.getRecentlyPlayed(20, 0, "songs");
const {
body: {
data = []
} = {}
} = resp;
const currentData = data.map(AppleSource.formatPlayObj);
const currentData = resp.body.data.map(AppleSource.formatPlayObj);
this.logger.debug(`RecentlyPlayedData: ${currentData}`);
return this.processRecentPlays(data);
return this.processRecentPlays(currentData);
}

doAuthentication = async () => {
Expand Down

0 comments on commit 3845cf8

Please sign in to comment.