Merge pull request #263 from darmiel/fix/combined-episodes

fix: count combined episodes
This commit is contained in:
Fallenbagel
2022-12-06 17:35:02 +05:00
committed by GitHub
2 changed files with 15 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ export interface JellyfinLibraryItem {
SeasonId?: string; SeasonId?: string;
SeasonName?: string; SeasonName?: string;
IndexNumber?: number; IndexNumber?: number;
IndexNumberEnd?: number;
ParentIndexNumber?: number; ParentIndexNumber?: number;
MediaType: string; MediaType: string;
} }

View File

@@ -257,8 +257,19 @@ class JobJellyfinSync {
//use for loop to make sure this loop _completes_ in full //use for loop to make sure this loop _completes_ in full
//before the next section //before the next section
for (const episode of episodes) { for (const episode of episodes) {
let episodeCount = 1;
// count number of combined episodes
if (
episode.IndexNumber !== undefined &&
episode.IndexNumberEnd !== undefined
) {
episodeCount =
episode.IndexNumberEnd - episode.IndexNumber + 1;
}
if (!this.enable4kShow) { if (!this.enable4kShow) {
totalStandard++; totalStandard += episodeCount;
} else { } else {
const ExtendedEpisodeData = await this.jfClient.getItemData( const ExtendedEpisodeData = await this.jfClient.getItemData(
episode.Id episode.Id
@@ -268,10 +279,10 @@ class JobJellyfinSync {
return MediaSource.MediaStreams.some((MediaStream) => { return MediaSource.MediaStreams.some((MediaStream) => {
if (MediaStream.Type === 'Video') { if (MediaStream.Type === 'Video') {
if (MediaStream.Width ?? 0 < 2000) { if (MediaStream.Width ?? 0 < 2000) {
totalStandard++; totalStandard += episodeCount;
} }
} else { } else {
total4k++; total4k += episodeCount;
} }
}); });
}); });