diff --git a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs index 429fc6d32..78b0d9910 100644 --- a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs +++ b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs @@ -250,12 +250,7 @@ public class EmbyApiClient : IEmbyApiClient MediaKind = LibraryMediaKind.Shows, ShouldSyncItems = false, Paths = new List { new() { Path = $"emby://{response.ItemId}" } }, - PathInfos = response.LibraryOptions.PathInfos.Map( - pi => new EmbyPathInfo - { - Path = pi.Path, - NetworkPath = pi.NetworkPath - }).ToList() + PathInfos = GetPathInfos(response) }, "movies" => new EmbyLibrary { @@ -264,18 +259,23 @@ public class EmbyApiClient : IEmbyApiClient MediaKind = LibraryMediaKind.Movies, ShouldSyncItems = false, Paths = new List { new() { Path = $"emby://{response.ItemId}" } }, - PathInfos = response.LibraryOptions.PathInfos.Map( - pi => new EmbyPathInfo - { - Path = pi.Path, - NetworkPath = pi.NetworkPath - }).ToList() + PathInfos = GetPathInfos(response) }, // TODO: ??? for music libraries "boxsets" => CacheCollectionLibraryId(response.ItemId), _ => None }; + private List GetPathInfos(EmbyLibraryResponse response) => + response.LibraryOptions.PathInfos + .Filter(pi => !string.IsNullOrWhiteSpace(pi.NetworkPath)) + .Map( + pi => new EmbyPathInfo + { + Path = pi.Path, + NetworkPath = pi.NetworkPath + }).ToList(); + private Option CacheCollectionLibraryId(string itemId) { _memoryCache.Set("emby_collections_library_item_id", itemId); diff --git a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs index 83d566492..9f37a9a8c 100644 --- a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs +++ b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs @@ -303,12 +303,7 @@ public class JellyfinApiClient : IJellyfinApiClient MediaKind = LibraryMediaKind.Shows, ShouldSyncItems = false, Paths = new List { new() { Path = $"jellyfin://{response.ItemId}" } }, - PathInfos = response.LibraryOptions.PathInfos.Map( - pi => new JellyfinPathInfo - { - Path = pi.Path, - NetworkPath = pi.NetworkPath - }).ToList() + PathInfos = GetPathInfos(response) }, "movies" => new JellyfinLibrary { @@ -317,18 +312,23 @@ public class JellyfinApiClient : IJellyfinApiClient MediaKind = LibraryMediaKind.Movies, ShouldSyncItems = false, Paths = new List { new() { Path = $"jellyfin://{response.ItemId}" } }, - PathInfos = response.LibraryOptions.PathInfos.Map( - pi => new JellyfinPathInfo - { - Path = pi.Path, - NetworkPath = pi.NetworkPath - }).ToList() + PathInfos = GetPathInfos(response) }, // TODO: ??? for music libraries "boxsets" => CacheCollectionLibraryId(response.ItemId), _ => None }; + private List GetPathInfos(JellyfinLibraryResponse response) => + response.LibraryOptions.PathInfos + .Filter(pi => !string.IsNullOrWhiteSpace(pi.NetworkPath)) + .Map( + pi => new JellyfinPathInfo + { + Path = pi.Path, + NetworkPath = pi.NetworkPath + }).ToList(); + private Option CacheCollectionLibraryId(string itemId) { _memoryCache.Set("jellyfin_collections_library_item_id", itemId);