fix(sync): do not update series status if already available and no new seasons

fixes #777
pull/783/head
sct 4 years ago
parent f1dd5e7e12
commit 136d874cba

@ -626,7 +626,21 @@ class JobPlexSync {
media.mediaAddedAt = new Date(plexitem.addedAt * 1000); media.mediaAddedAt = new Date(plexitem.addedAt * 1000);
} }
media.status = isAllStandardSeasons // If the show is already available, and there are no new seasons, dont adjust
// the status
const shouldStayAvailable =
media.status === MediaStatus.AVAILABLE &&
newSeasons.filter(
(season) => season.status !== MediaStatus.UNKNOWN
).length === 0;
const shouldStayAvailable4k =
media.status4k === MediaStatus.AVAILABLE &&
newSeasons.filter(
(season) => season.status4k !== MediaStatus.UNKNOWN
).length === 0;
media.status =
isAllStandardSeasons || shouldStayAvailable
? MediaStatus.AVAILABLE ? MediaStatus.AVAILABLE
: media.seasons.some( : media.seasons.some(
(season) => season.status !== MediaStatus.UNKNOWN (season) => season.status !== MediaStatus.UNKNOWN
@ -634,7 +648,7 @@ class JobPlexSync {
? MediaStatus.PARTIALLY_AVAILABLE ? MediaStatus.PARTIALLY_AVAILABLE
: MediaStatus.UNKNOWN; : MediaStatus.UNKNOWN;
media.status4k = media.status4k =
isAll4kSeasons && this.enable4kShow (isAll4kSeasons || shouldStayAvailable4k) && this.enable4kShow
? MediaStatus.AVAILABLE ? MediaStatus.AVAILABLE
: this.enable4kShow && : this.enable4kShow &&
media.seasons.some( media.seasons.some(

@ -229,9 +229,21 @@ class JobSonarrSync {
); );
} }
media[server4k ? 'status4k' : 'status'] = isAllSeasons // If the show is already available, and there are no new seasons, dont adjust
// the status
const shouldStayAvailable =
media.status === MediaStatus.AVAILABLE &&
newSeasons.filter(
(season) =>
season[server4k ? 'status4k' : 'status'] !== MediaStatus.UNKNOWN
).length === 0;
media[server4k ? 'status4k' : 'status'] =
isAllSeasons || shouldStayAvailable
? MediaStatus.AVAILABLE ? MediaStatus.AVAILABLE
: media.seasons.some((season) => season.status !== MediaStatus.UNKNOWN) : media.seasons.some(
(season) => season.status !== MediaStatus.UNKNOWN
)
? MediaStatus.PARTIALLY_AVAILABLE ? MediaStatus.PARTIALLY_AVAILABLE
: MediaStatus.UNKNOWN; : MediaStatus.UNKNOWN;

Loading…
Cancel
Save