@@ -35,6 +35,8 @@ export function getCardImageUrl({
3535 let imgType : ImageType | undefined ;
3636 let itemId = null ;
3737
38+ const skipEpisodeParentPoster = item . Type === 'Episode' && uiAspect != null && uiAspect > 1 ;
39+
3840 /* eslint-disable sonarjs/no-duplicated-branches */
3941 if ( options . preferThumb && item . ImageTags ?. Thumb ) {
4042 imgType = ImageType . Thumb ;
@@ -68,6 +70,16 @@ export function getCardImageUrl({
6870 imgType = ImageType . Backdrop ;
6971 imgTag = item . ParentBackdropImageTags [ 0 ] ;
7072 itemId = item . ParentBackdropItemId ;
73+ } else if ( options . preferParentPoster && ! options . preferThumb && item . Type === 'Episode'
74+ && ( ( item . ParentPrimaryImageTag && item . ParentPrimaryImageItemId ) || ( item . SeriesPrimaryImageTag && item . SeriesId ) ) ) {
75+ imgType = ImageType . Primary ;
76+ if ( item . ParentPrimaryImageTag && item . ParentPrimaryImageItemId ) {
77+ imgTag = item . ParentPrimaryImageTag ;
78+ itemId = item . ParentPrimaryImageItemId ;
79+ } else {
80+ imgTag = item . SeriesPrimaryImageTag ;
81+ itemId = item . SeriesId ;
82+ }
7183 } else if ( item . ImageTags ?. Primary && ( item . Type !== 'Episode' || item . ChildCount !== 0 ) ) {
7284 imgType = ImageType . Primary ;
7385 imgTag = item . ImageTags . Primary ;
@@ -80,7 +92,7 @@ export function getCardImageUrl({
8092 if ( primaryImageAspectRatio && uiAspect ) {
8193 coverImage = ( Math . abs ( primaryImageAspectRatio - uiAspect ) / uiAspect ) <= 0.2 ;
8294 }
83- } else if ( item . SeriesPrimaryImageTag ) {
95+ } else if ( item . SeriesPrimaryImageTag && ! skipEpisodeParentPoster ) {
8496 imgType = ImageType . Primary ;
8597 imgTag = item . SeriesPrimaryImageTag ;
8698 itemId = item . SeriesId ;
@@ -97,7 +109,7 @@ export function getCardImageUrl({
97109 if ( primaryImageAspectRatio && uiAspect ) {
98110 coverImage = ( Math . abs ( primaryImageAspectRatio - uiAspect ) / uiAspect ) <= 0.2 ;
99111 }
100- } else if ( item . ParentPrimaryImageTag ) {
112+ } else if ( item . ParentPrimaryImageTag && ! skipEpisodeParentPoster ) {
101113 imgType = ImageType . Primary ;
102114 imgTag = item . ParentPrimaryImageTag ;
103115 itemId = item . ParentPrimaryImageItemId ;
0 commit comments