@@ -15,7 +15,7 @@ import { Integration } from "../base/integration";
1515import type { TestingResult } from "../base/test-connection/test-connection-service" ;
1616import type { IMediaServerIntegration } from "../interfaces/media-server/media-server-integration" ;
1717import type { CurrentSessionsInput , StreamSession } from "../interfaces/media-server/media-server-types" ;
18- import type { IMediaReleasesIntegration , MediaRelease } from "../types" ;
18+ import type { IMediaReleasesIntegration , MediaRelease , MediaType } from "../types" ;
1919
2020@HandleIntegrationErrors ( [ integrationAxiosHttpErrorHandler ] )
2121export class JellyfinIntegration extends Integration implements IMediaServerIntegration , IMediaReleasesIntegration {
@@ -122,7 +122,7 @@ export class JellyfinIntegration extends Integration implements IMediaServerInte
122122 return result . data . map ( ( item ) => ( {
123123 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
124124 id : item . Id ! ,
125- type : item . Type === "Movie" ? "movie" : item . Type === "Series" ? "tv" : "unknown" ,
125+ type : this . mapMediaReleaseType ( item . Type ) ,
126126 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
127127 title : item . Name ! ,
128128 subtitle : item . Taglines ?. at ( 0 ) ,
@@ -140,6 +140,27 @@ export class JellyfinIntegration extends Integration implements IMediaServerInte
140140 } ) ) ;
141141 }
142142
143+ private mapMediaReleaseType ( type : BaseItemKind | undefined ) : MediaType {
144+ switch ( type ) {
145+ case "Audio" :
146+ case "AudioBook" :
147+ case "MusicAlbum" :
148+ return "music" ;
149+ case "Book" :
150+ return "book" ;
151+ case "Episode" :
152+ case "Series" :
153+ case "Season" :
154+ return "tv" ;
155+ case "Movie" :
156+ return "movie" ;
157+ case "Video" :
158+ return "video" ;
159+ default :
160+ return "unknown" ;
161+ }
162+ }
163+
143164 /**
144165 * Constructs an ApiClient synchronously with an ApiKey or asynchronously
145166 * with a username and password.
0 commit comments