Skip to content

Commit

Permalink
feat: add trackReleaseId, albumReleaseId and contextId to streams
Browse files Browse the repository at this point in the history
  • Loading branch information
netlob committed Mar 11, 2024
1 parent e6f6f01 commit 5012617
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/interfaces/statsfm/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export interface Stream {
albumId: number;
artistIds: number[];
importId?: number;
trackReleaseId?: number;
albumReleaseId?: number;
contextId?: string;
}

export interface StreamMinified {
Expand All @@ -20,6 +23,9 @@ export interface StreamMinified {
h: number;
i: number[];
j?: number;
k?: number;
l?: number;
m?: string;
}

export const streamToStreamMinified = (stream: Stream): Omit<StreamMinified, 'a'> => {
Expand All @@ -31,7 +37,10 @@ export const streamToStreamMinified = (stream: Stream): Omit<StreamMinified, 'a'
f: stream.trackId,
g: stream.trackName,
h: stream.albumId,
i: stream.artistIds
i: stream.artistIds,
k: stream.trackReleaseId ?? undefined,
l: stream.albumReleaseId ?? undefined,
m: stream.contextId ?? undefined
};
if ('importId' in stream) obj.j = stream.importId;
return obj;
Expand All @@ -46,7 +55,10 @@ export const streamMinifiedToStream = (stream: StreamMinified): Stream => {
trackId: stream.f,
trackName: stream.g,
albumId: stream.h,
artistIds: stream.i
artistIds: stream.i,
trackReleaseId: stream.k ?? undefined,
albumReleaseId: stream.l ?? undefined,
contextId: stream.m ?? undefined
};
if ('j' in stream) obj.importId = stream.j;
return obj;
Expand Down

0 comments on commit 5012617

Please sign in to comment.