|
|
|
@ -106,7 +106,7 @@ class BaseScanner<T> {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await requestRepository.update(
|
|
|
|
|
{ media: { id: request?.id } },
|
|
|
|
|
{ id: request?.id },
|
|
|
|
|
{ status: MediaRequestStatus.COMPLETED }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -215,11 +215,11 @@ class BaseScanner<T> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (changedExisting) {
|
|
|
|
|
if (existing['status'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (existing.status === MediaStatus.AVAILABLE) {
|
|
|
|
|
this.requestUpdater(existing.id, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (existing['status4k'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (existing.status4k === MediaStatus.AVAILABLE) {
|
|
|
|
|
this.requestUpdater(existing.id, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -352,7 +352,9 @@ class BaseScanner<T> {
|
|
|
|
|
? MediaStatus.AVAILABLE
|
|
|
|
|
: season.episodes > 0
|
|
|
|
|
? MediaStatus.PARTIALLY_AVAILABLE
|
|
|
|
|
: !season.is4kOverride && season.processing
|
|
|
|
|
: !season.is4kOverride &&
|
|
|
|
|
season.processing &&
|
|
|
|
|
existingSeason.status !== MediaStatus.DELETED
|
|
|
|
|
? MediaStatus.PROCESSING
|
|
|
|
|
: existingSeason.status;
|
|
|
|
|
|
|
|
|
@ -365,15 +367,25 @@ class BaseScanner<T> {
|
|
|
|
|
? MediaStatus.AVAILABLE
|
|
|
|
|
: this.enable4kShow && season.episodes4k > 0
|
|
|
|
|
? MediaStatus.PARTIALLY_AVAILABLE
|
|
|
|
|
: season.is4kOverride && season.processing
|
|
|
|
|
: season.is4kOverride &&
|
|
|
|
|
season.processing &&
|
|
|
|
|
existingSeason.status !== MediaStatus.DELETED
|
|
|
|
|
? MediaStatus.PROCESSING
|
|
|
|
|
: existingSeason.status4k;
|
|
|
|
|
|
|
|
|
|
if (existingSeason['status'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (
|
|
|
|
|
(season.totalEpisodes === season.episodes && season.episodes > 0) ||
|
|
|
|
|
existingSeason.status === MediaStatus.AVAILABLE
|
|
|
|
|
) {
|
|
|
|
|
this.seasonRequestUpdater(media?.id, season.seasonNumber, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (existingSeason['status4k'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (
|
|
|
|
|
(this.enable4kShow &&
|
|
|
|
|
season.episodes4k === season.totalEpisodes &&
|
|
|
|
|
season.episodes4k > 0) ||
|
|
|
|
|
existingSeason.status4k === MediaStatus.AVAILABLE
|
|
|
|
|
) {
|
|
|
|
|
this.seasonRequestUpdater(media?.id, season.seasonNumber, true);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -492,12 +504,18 @@ class BaseScanner<T> {
|
|
|
|
|
// the status
|
|
|
|
|
const shouldStayAvailable =
|
|
|
|
|
media.status === MediaStatus.AVAILABLE &&
|
|
|
|
|
newSeasons.filter((season) => season.status !== MediaStatus.UNKNOWN)
|
|
|
|
|
.length === 0;
|
|
|
|
|
newSeasons.filter(
|
|
|
|
|
(season) =>
|
|
|
|
|
season.status !== MediaStatus.UNKNOWN &&
|
|
|
|
|
season.status !== MediaStatus.DELETED
|
|
|
|
|
).length === 0;
|
|
|
|
|
const shouldStayAvailable4k =
|
|
|
|
|
media.status4k === MediaStatus.AVAILABLE &&
|
|
|
|
|
newSeasons.filter((season) => season.status4k !== MediaStatus.UNKNOWN)
|
|
|
|
|
.length === 0;
|
|
|
|
|
newSeasons.filter(
|
|
|
|
|
(season) =>
|
|
|
|
|
season.status4k !== MediaStatus.UNKNOWN &&
|
|
|
|
|
season.status4k !== MediaStatus.DELETED
|
|
|
|
|
).length === 0;
|
|
|
|
|
|
|
|
|
|
media.status =
|
|
|
|
|
isAllStandardSeasons || shouldStayAvailable
|
|
|
|
@ -508,11 +526,13 @@ class BaseScanner<T> {
|
|
|
|
|
season.status === MediaStatus.AVAILABLE
|
|
|
|
|
)
|
|
|
|
|
? MediaStatus.PARTIALLY_AVAILABLE
|
|
|
|
|
: !seasons.length ||
|
|
|
|
|
: (!seasons.length && media.status !== MediaStatus.DELETED) ||
|
|
|
|
|
media.seasons.some(
|
|
|
|
|
(season) => season.status === MediaStatus.PROCESSING
|
|
|
|
|
)
|
|
|
|
|
? MediaStatus.PROCESSING
|
|
|
|
|
: media.status === MediaStatus.DELETED
|
|
|
|
|
? MediaStatus.DELETED
|
|
|
|
|
: MediaStatus.UNKNOWN;
|
|
|
|
|
media.status4k =
|
|
|
|
|
(isAll4kSeasons || shouldStayAvailable4k) && this.enable4kShow
|
|
|
|
@ -524,11 +544,13 @@ class BaseScanner<T> {
|
|
|
|
|
season.status4k === MediaStatus.AVAILABLE
|
|
|
|
|
)
|
|
|
|
|
? MediaStatus.PARTIALLY_AVAILABLE
|
|
|
|
|
: !seasons.length ||
|
|
|
|
|
: (!seasons.length && media.status4k !== MediaStatus.DELETED) ||
|
|
|
|
|
media.seasons.some(
|
|
|
|
|
(season) => season.status4k === MediaStatus.PROCESSING
|
|
|
|
|
)
|
|
|
|
|
? MediaStatus.PROCESSING
|
|
|
|
|
: media.status4k === MediaStatus.DELETED
|
|
|
|
|
? MediaStatus.DELETED
|
|
|
|
|
: MediaStatus.UNKNOWN;
|
|
|
|
|
|
|
|
|
|
if (isAllStandardSeasons) {
|
|
|
|
@ -600,11 +622,11 @@ class BaseScanner<T> {
|
|
|
|
|
: MediaStatus.UNKNOWN,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (newMedia['status'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (isAllStandardSeasons) {
|
|
|
|
|
this.requestUpdater(newMedia.id, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newMedia['status4k'] === MediaStatus.AVAILABLE) {
|
|
|
|
|
if (isAll4kSeasons && this.enable4kShow) {
|
|
|
|
|
this.requestUpdater(newMedia.id, true);
|
|
|
|
|
}
|
|
|
|
|
await mediaRepository.save(newMedia);
|
|
|
|
|