Browse Source

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

pull/778/head
Jason Dove 4 years ago committed by GitHub
parent
commit
2a8bf57930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs
  2. 24
      ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

24
ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs

@ -250,12 +250,7 @@ public class EmbyApiClient : IEmbyApiClient @@ -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 @@ -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);

24
ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

@ -303,12 +303,7 @@ public class JellyfinApiClient : IJellyfinApiClient @@ -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 @@ -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);

Loading…
Cancel
Save