Skip to content

Commit 0900a95

Browse files
authored
fix: nullable type for jellyfinMediaId(4k) (seerr-team#702)
The jellyfinMediaId(4k) properties were inferred as string | undefined, causing them to be set to undefined when assigning null. This prevented the media from being saved correctly to the SQLite database, as it doesn't accept undefined values. This resolves the availabilitySync job issue where the "play on" button wasn't being removed for all media server types. fix seerr-team#668
1 parent 0c86684 commit 0900a95

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

server/entity/Media.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ class Media {
151151
@Column({ nullable: true, type: 'varchar' })
152152
public ratingKey4k?: string | null;
153153

154-
@Column({ nullable: true })
155-
public jellyfinMediaId?: string;
154+
@Column({ nullable: true, type: 'varchar' })
155+
public jellyfinMediaId?: string | null;
156156

157-
@Column({ nullable: true })
158-
public jellyfinMediaId4k?: string;
157+
@Column({ nullable: true, type: 'varchar' })
158+
public jellyfinMediaId4k?: string | null;
159159

160160
public serviceUrl?: string;
161161
public serviceUrl4k?: string;

server/lib/availabilitySync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,15 +548,15 @@ class AvailabilitySync {
548548
media[is4k ? 'ratingKey4k' : 'ratingKey'] =
549549
mediaStatus === MediaStatus.PROCESSING
550550
? media[is4k ? 'ratingKey4k' : 'ratingKey']
551-
: undefined;
551+
: null;
552552
} else if (
553553
mediaServerType === MediaServerType.JELLYFIN ||
554554
mediaServerType === MediaServerType.EMBY
555555
) {
556556
media[is4k ? 'jellyfinMediaId4k' : 'jellyfinMediaId'] =
557557
mediaStatus === MediaStatus.PROCESSING
558558
? media[is4k ? 'jellyfinMediaId4k' : 'jellyfinMediaId']
559-
: undefined;
559+
: null;
560560
}
561561
logger.info(
562562
`The ${is4k ? '4K' : 'non-4K'} ${

server/lib/scanners/jellyfin/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ class JellyfinScanner {
168168
newMedia.jellyfinMediaId =
169169
hasOtherResolution || (!this.enable4kMovie && has4k)
170170
? metadata.Id
171-
: undefined;
171+
: null;
172172
newMedia.jellyfinMediaId4k =
173-
has4k && this.enable4kMovie ? metadata.Id : undefined;
173+
has4k && this.enable4kMovie ? metadata.Id : null;
174174
await mediaRepository.save(newMedia);
175175
this.log(`Saved ${metadata.Name}`);
176176
}
@@ -461,9 +461,9 @@ class JellyfinScanner {
461461
tmdbId: tvShow.id,
462462
tvdbId: tvShow.external_ids.tvdb_id,
463463
mediaAddedAt: new Date(metadata.DateCreated ?? ''),
464-
jellyfinMediaId: isAllStandardSeasons ? Id : undefined,
464+
jellyfinMediaId: isAllStandardSeasons ? Id : null,
465465
jellyfinMediaId4k:
466-
isAll4kSeasons && this.enable4kShow ? Id : undefined,
466+
isAll4kSeasons && this.enable4kShow ? Id : null,
467467
status: isAllStandardSeasons
468468
? MediaStatus.AVAILABLE
469469
: newSeasons.some(

0 commit comments

Comments
 (0)