diff --git a/libs/portal/shared/util/src/lib/downloads/episode-download-identity.spec.ts b/libs/portal/shared/util/src/lib/downloads/episode-download-identity.spec.ts index 000785bc3..ad2aadc7e 100644 --- a/libs/portal/shared/util/src/lib/downloads/episode-download-identity.spec.ts +++ b/libs/portal/shared/util/src/lib/downloads/episode-download-identity.spec.ts @@ -19,6 +19,7 @@ function row( overrides: Partial = {} ): EpisodeDownloadRecord { return { + id: 1, playlistId: identity.playlistId, contentType: identity.contentType, xtreamId: identity.xtreamId, @@ -26,6 +27,7 @@ function row( seasonNumber: identity.seasonNumber, episodeNumber: identity.episodeNumber, status: 'queued', + filePath: '/downloads/episode-3.mp4', ...overrides, }; } @@ -40,14 +42,14 @@ describe('episode download identity', () => { }); expect( - findEpisodeDownload([coordinateFallback, canonical], identity) + findEpisodeDownload(identity, [coordinateFallback, canonical]) ).toBe(canonical); }); it('falls back to complete matching episode coordinates', () => { const coordinateFallback = row({ xtreamId: 999 }); - expect(findEpisodeDownload([coordinateFallback], identity)).toBe( + expect(findEpisodeDownload(identity, [coordinateFallback])).toBe( coordinateFallback ); }); @@ -61,7 +63,7 @@ describe('episode download identity', () => { row({ contentType: 'vod', xtreamId: 995 }), ]; - expect(findEpisodeDownload(candidates, identity)).toBeUndefined(); + expect(findEpisodeDownload(identity, candidates)).toBeUndefined(); }); it('allows an episode with no existing download', () => { diff --git a/libs/portal/shared/util/src/lib/downloads/episode-download-identity.ts b/libs/portal/shared/util/src/lib/downloads/episode-download-identity.ts index ebd8074d4..c5559cff9 100644 --- a/libs/portal/shared/util/src/lib/downloads/episode-download-identity.ts +++ b/libs/portal/shared/util/src/lib/downloads/episode-download-identity.ts @@ -14,6 +14,7 @@ export interface EpisodeDownloadIdentity { } export interface EpisodeDownloadRecord { + readonly id: number; readonly playlistId: string; readonly contentType: ElectronBridgePlaybackContentType; readonly xtreamId: number; @@ -22,11 +23,12 @@ export interface EpisodeDownloadRecord { readonly episodeNumber?: number; readonly status: ElectronBridgeDownloadStatus; readonly fileAvailability?: ElectronDownloadFileAvailability; + readonly filePath?: string; } export function findEpisodeDownload( - downloads: readonly T[], - identity: EpisodeDownloadIdentity + identity: EpisodeDownloadIdentity, + downloads: readonly T[] ): T | undefined { const canonicalMatch = downloads.find( (download) =>