Skip to content

Commit

Permalink
Merge pull request #720 from jorenn92/fix/#701-season-episodes
Browse files Browse the repository at this point in the history
refactor(rules): Added season & episode code to the 'labels' rule
  • Loading branch information
jorenn92 authored Jan 7, 2024
2 parents 308aafe + a017ce4 commit 93549b9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/src/modules/rules/getter/plex-getter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,18 @@ export class PlexGetterService {
return count ? count.length : 0;
}
case 'labels': {
return metadata.Label ? metadata.Label.map(l => l.tag) : []
const item =
libItem.type === 'episode'
? ((await this.plexApi.getMetadata(
libItem.grandparentRatingKey,
)) as unknown as PlexLibraryItem)
: libItem.type === 'season'
? ((await this.plexApi.getMetadata(
libItem.parentRatingKey,
)) as unknown as PlexLibraryItem)
: metadata;

return item.Label ? item.Label.map(l => l.tag) : []
}
case 'collections': {
// fetch metadata because collections in plexLibrary object are wrong
Expand Down

0 comments on commit 93549b9

Please sign in to comment.