ignore emby and jellyfin path infos with unset network path (#775)

This commit is contained in:
Jason Dove
2022-04-30 21:48:37 -05:00
committed by GitHub
parent 1ebc4b62e3
commit 2a8bf57930
2 changed files with 24 additions and 24 deletions
+12 -12
View File
@@ -250,12 +250,7 @@ public class EmbyApiClient : IEmbyApiClient
MediaKind = LibraryMediaKind.Shows,
ShouldSyncItems = false,
Paths = new List<LibraryPath> { 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<LibraryPath> { 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<EmbyPathInfo> 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<EmbyLibrary> CacheCollectionLibraryId(string itemId)
{
_memoryCache.Set("emby_collections_library_item_id", itemId);
@@ -303,12 +303,7 @@ public class JellyfinApiClient : IJellyfinApiClient
MediaKind = LibraryMediaKind.Shows,
ShouldSyncItems = false,
Paths = new List<LibraryPath> { 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<LibraryPath> { 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<JellyfinPathInfo> 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<JellyfinLibrary> CacheCollectionLibraryId(string itemId)
{
_memoryCache.Set("jellyfin_collections_library_item_id", itemId);