Skip to content

Commit

Permalink
refactor(rules): Added season & episode code to the 'labels' rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenn92 committed Jan 7, 2024
1 parent 1c5a89a commit a017ce4
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 a017ce4

Please sign in to comment.