fix: pass in library type when scanning recently added items (#3287)

pull/3294/head
Brandon Cohen 1 year ago committed by GitHub
parent 51b05cd8fb
commit 8942eb8b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -226,12 +226,13 @@ class PlexAPI {
id: string, id: string,
options: { addedAt: number } = { options: { addedAt: number } = {
addedAt: Date.now() - 1000 * 60 * 60, addedAt: Date.now() - 1000 * 60 * 60,
} },
mediaType: 'movie' | 'show'
): Promise<PlexLibraryItem[]> { ): Promise<PlexLibraryItem[]> {
const response = await this.plexClient.query<PlexLibraryResponse>({ const response = await this.plexClient.query<PlexLibraryResponse>({
uri: `/library/sections/${id}/all?sort=addedAt%3Adesc&addedAt>>=${Math.floor( uri: `/library/sections/${id}/all?type=${
options.addedAt / 1000 mediaType === 'show' ? '4' : '1'
)}`, }&sort=addedAt%3Adesc&addedAt>>=${Math.floor(options.addedAt / 1000)}`,
extraHeaders: { extraHeaders: {
'X-Plex-Container-Start': `0`, 'X-Plex-Container-Start': `0`,
'X-Plex-Container-Size': `500`, 'X-Plex-Container-Size': `500`,

@ -96,7 +96,8 @@ class PlexScanner
// We remove 10 minutes from the last scan as a buffer // We remove 10 minutes from the last scan as a buffer
addedAt: library.lastScan - 1000 * 60 * 10, addedAt: library.lastScan - 1000 * 60 * 10,
} }
: undefined : undefined,
library.type
); );
// Bundle items up by rating keys // Bundle items up by rating keys

Loading…
Cancel
Save