From 605d8a98abcb8fc07bfddeeeb5085c997d2d1373 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:37:34 +0000 Subject: [PATCH] fix adding new items from jellyfin and emby (#2218) --- ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs | 38 ++++++++++--------- .../Jellyfin/JellyfinApiClient.cs | 38 ++++++++++--------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs index ab4e0ec1e..60170f799 100644 --- a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs +++ b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs @@ -324,14 +324,15 @@ public class EmbyApiClient : IEmbyApiClient Name = "Main", Duration = duration, DateAdded = item.DateCreated.UtcDateTime, - MediaFiles = new List - { - new() + MediaFiles = + [ + new MediaFile { - Path = path + Path = path, + PathHash = PathUtils.GetPathHash(path) } - }, - Streams = new List(), + ], + Streams = [], Chapters = ProjectToModel(Optional(item.Chapters).Flatten(), duration) }; @@ -341,9 +342,9 @@ public class EmbyApiClient : IEmbyApiClient { ItemId = item.Id, Etag = item.Etag, - MediaVersions = new List { version }, - MovieMetadata = new List { metadata }, - TraktListItems = new List() + MediaVersions = [version], + MovieMetadata = [metadata], + TraktListItems = [] }; return movie; @@ -666,14 +667,15 @@ public class EmbyApiClient : IEmbyApiClient Name = "Main", Duration = duration, DateAdded = item.DateCreated.UtcDateTime, - MediaFiles = new List - { - new() + MediaFiles = + [ + new MediaFile { - Path = path + Path = path, + PathHash = PathUtils.GetPathHash(path) } - }, - Streams = new List(), + ], + Streams = [], Chapters = ProjectToModel(Optional(item.Chapters).Flatten(), duration) }; @@ -683,9 +685,9 @@ public class EmbyApiClient : IEmbyApiClient { ItemId = item.Id, Etag = item.Etag, - MediaVersions = new List { version }, - EpisodeMetadata = new List { metadata }, - TraktListItems = new List() + MediaVersions = [version], + EpisodeMetadata = [metadata], + TraktListItems = [] }; return episode; diff --git a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs index d1e13a69a..591c174ad 100644 --- a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs +++ b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs @@ -347,14 +347,15 @@ public class JellyfinApiClient : IJellyfinApiClient Name = "Main", Duration = duration, DateAdded = item.DateCreated.UtcDateTime, - MediaFiles = new List - { - new() + MediaFiles = + [ + new MediaFile { - Path = path + Path = path, + PathHash = PathUtils.GetPathHash(path) } - }, - Streams = new List(), + ], + Streams = [], Chapters = ProjectToModel(Optional(item.Chapters).Flatten(), duration) }; @@ -364,9 +365,9 @@ public class JellyfinApiClient : IJellyfinApiClient { ItemId = item.Id, Etag = item.Etag, - MediaVersions = new List { version }, - MovieMetadata = new List { metadata }, - TraktListItems = new List() + MediaVersions = [version], + MovieMetadata = [metadata], + TraktListItems = [] }; return movie; @@ -723,14 +724,15 @@ public class JellyfinApiClient : IJellyfinApiClient Name = "Main", Duration = duration, DateAdded = item.DateCreated.UtcDateTime, - MediaFiles = new List - { - new() + MediaFiles = + [ + new MediaFile { - Path = path + Path = path, + PathHash = PathUtils.GetPathHash(path) } - }, - Streams = new List(), + ], + Streams = [], Chapters = ProjectToModel(Optional(item.Chapters).Flatten(), duration) }; @@ -740,9 +742,9 @@ public class JellyfinApiClient : IJellyfinApiClient { ItemId = item.Id, Etag = item.Etag, - MediaVersions = new List { version }, - EpisodeMetadata = new List { metadata }, - TraktListItems = new List() + MediaVersions = [version], + EpisodeMetadata = [metadata], + TraktListItems = [] }; return episode;