|
|
|
@ -137,7 +137,9 @@ class JobPlexSync {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const metadata = await this.plexClient.getMetadata(
|
|
|
|
|
plexitem.parentRatingKey ?? plexitem.ratingKey,
|
|
|
|
|
plexitem.grandparentRatingKey ??
|
|
|
|
|
plexitem.parentRatingKey ??
|
|
|
|
|
plexitem.ratingKey,
|
|
|
|
|
{ includeChildren: true }
|
|
|
|
|
);
|
|
|
|
|
if (metadata.guid.match(tvdbRegex)) {
|
|
|
|
@ -240,7 +242,9 @@ class JobPlexSync {
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.log(
|
|
|
|
|
`Failed to process plex item. ratingKey: ${
|
|
|
|
|
plexitem.parentRatingKey ?? plexitem.ratingKey
|
|
|
|
|
plexitem.grandparentRatingKey ??
|
|
|
|
|
plexitem.parentRatingKey ??
|
|
|
|
|
plexitem.ratingKey
|
|
|
|
|
}`,
|
|
|
|
|
'error'
|
|
|
|
|
);
|
|
|
|
@ -252,7 +256,11 @@ class JobPlexSync {
|
|
|
|
|
slicedItems.map(async (plexitem) => {
|
|
|
|
|
if (plexitem.type === 'movie') {
|
|
|
|
|
await this.processMovie(plexitem);
|
|
|
|
|
} else if (plexitem.type === 'show') {
|
|
|
|
|
} else if (
|
|
|
|
|
plexitem.type === 'show' ||
|
|
|
|
|
plexitem.type === 'episode' ||
|
|
|
|
|
plexitem.type === 'season'
|
|
|
|
|
) {
|
|
|
|
|
await this.processShow(plexitem);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -301,20 +309,22 @@ class JobPlexSync {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.plexClient = new PlexAPI({ plexToken: admin.plexToken });
|
|
|
|
|
|
|
|
|
|
this.libraries = settings.plex.libraries.filter(
|
|
|
|
|
(library) => library.enabled
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (this.isRecentOnly) {
|
|
|
|
|
this.currentLibrary = {
|
|
|
|
|
id: '0',
|
|
|
|
|
name: 'Recently Added',
|
|
|
|
|
enabled: true,
|
|
|
|
|
};
|
|
|
|
|
this.log(`Beginning to process recently added`, 'info');
|
|
|
|
|
this.items = await this.plexClient.getRecentlyAdded();
|
|
|
|
|
await this.loop();
|
|
|
|
|
for (const library of this.libraries) {
|
|
|
|
|
this.currentLibrary = library;
|
|
|
|
|
this.log(
|
|
|
|
|
`Beginning to process recently added for library: ${library.name}`,
|
|
|
|
|
'info'
|
|
|
|
|
);
|
|
|
|
|
this.items = await this.plexClient.getRecentlyAdded(library.id);
|
|
|
|
|
await this.loop();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.libraries = settings.plex.libraries.filter(
|
|
|
|
|
(library) => library.enabled
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (const library of this.libraries) {
|
|
|
|
|
this.currentLibrary = library;
|
|
|
|
|
this.log(`Beginning to process library: ${library.name}`, 'info');
|
|
|
|
|