diff --git a/CHANGELOG.md b/CHANGELOG.md index 581e4fb3a..fcc3299a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed +- Remove some unnecessary API calls related to media server scanning and paging ## [0.8.7-beta] - 2024-06-26 ### Added diff --git a/ErsatzTV.Core/Emby/EmbyItemType.cs b/ErsatzTV.Core/Emby/EmbyItemType.cs deleted file mode 100644 index a1ea5d56d..000000000 --- a/ErsatzTV.Core/Emby/EmbyItemType.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ErsatzTV.Core.Emby; - -public static class EmbyItemType -{ - public static readonly string Movie = "Movie"; - public static readonly string Show = "Series"; - public static readonly string Season = "Season"; - public static readonly string Episode = "Episode"; - public static readonly string Collection = "BoxSet"; - public static readonly string CollectionItems = "Movie,Series,Season,Episode"; -} diff --git a/ErsatzTV.Core/Interfaces/Emby/IEmbyApiClient.cs b/ErsatzTV.Core/Interfaces/Emby/IEmbyApiClient.cs index f6a9574c9..cfbf2378c 100644 --- a/ErsatzTV.Core/Interfaces/Emby/IEmbyApiClient.cs +++ b/ErsatzTV.Core/Interfaces/Emby/IEmbyApiClient.cs @@ -8,32 +8,26 @@ public interface IEmbyApiClient Task> GetServerInformation(string address, string apiKey); Task>> GetLibraries(string address, string apiKey); - IAsyncEnumerable GetMovieLibraryItems(string address, string apiKey, EmbyLibrary library); + IAsyncEnumerable> GetMovieLibraryItems(string address, string apiKey, EmbyLibrary library); - IAsyncEnumerable GetShowLibraryItems(string address, string apiKey, EmbyLibrary library); + IAsyncEnumerable> GetShowLibraryItems(string address, string apiKey, EmbyLibrary library); - IAsyncEnumerable GetSeasonLibraryItems( + IAsyncEnumerable> GetSeasonLibraryItems( string address, string apiKey, EmbyLibrary library, string showId); - IAsyncEnumerable GetEpisodeLibraryItems( + IAsyncEnumerable> GetEpisodeLibraryItems( string address, string apiKey, EmbyLibrary library, string showId, string seasonId); - IAsyncEnumerable GetCollectionLibraryItems(string address, string apiKey); + IAsyncEnumerable> GetCollectionLibraryItems(string address, string apiKey); - IAsyncEnumerable GetCollectionItems(string address, string apiKey, string collectionId); - - Task> GetLibraryItemCount( - string address, - string apiKey, - string parentId, - string includeItemTypes); + IAsyncEnumerable> GetCollectionItems(string address, string apiKey, string collectionId); Task> GetPlaybackInfo( string address, diff --git a/ErsatzTV.Core/Interfaces/Jellyfin/IJellyfinApiClient.cs b/ErsatzTV.Core/Interfaces/Jellyfin/IJellyfinApiClient.cs index 7bc15a1f8..5a7c19876 100644 --- a/ErsatzTV.Core/Interfaces/Jellyfin/IJellyfinApiClient.cs +++ b/ErsatzTV.Core/Interfaces/Jellyfin/IJellyfinApiClient.cs @@ -9,38 +9,30 @@ public interface IJellyfinApiClient Task>> GetLibraries(string address, string apiKey); Task> GetAdminUserId(string address, string apiKey); - IAsyncEnumerable GetMovieLibraryItems(string address, string apiKey, JellyfinLibrary library); + IAsyncEnumerable> GetMovieLibraryItems(string address, string apiKey, JellyfinLibrary library); - IAsyncEnumerable GetShowLibraryItems(string address, string apiKey, JellyfinLibrary library); + IAsyncEnumerable> GetShowLibraryItems(string address, string apiKey, JellyfinLibrary library); - IAsyncEnumerable GetSeasonLibraryItems( + IAsyncEnumerable> GetSeasonLibraryItems( string address, string apiKey, JellyfinLibrary library, string showId); - IAsyncEnumerable GetEpisodeLibraryItems( + IAsyncEnumerable> GetEpisodeLibraryItems( string address, string apiKey, JellyfinLibrary library, string seasonId); - IAsyncEnumerable GetCollectionLibraryItems(string address, string apiKey, int mediaSourceId); + IAsyncEnumerable> GetCollectionLibraryItems(string address, string apiKey, int mediaSourceId); - IAsyncEnumerable GetCollectionItems( + IAsyncEnumerable> GetCollectionItems( string address, string apiKey, int mediaSourceId, string collectionId); - Task> GetLibraryItemCount( - string address, - string apiKey, - JellyfinLibrary library, - string parentId, - string includeItemTypes, - bool excludeFolders); - Task> GetPlaybackInfo( string address, string apiKey, diff --git a/ErsatzTV.Core/Interfaces/Plex/IPlexServerApiClient.cs b/ErsatzTV.Core/Interfaces/Plex/IPlexServerApiClient.cs index 91434425e..fa371a198 100644 --- a/ErsatzTV.Core/Interfaces/Plex/IPlexServerApiClient.cs +++ b/ErsatzTV.Core/Interfaces/Plex/IPlexServerApiClient.cs @@ -13,33 +13,23 @@ public interface IPlexServerApiClient PlexConnection connection, PlexServerAuthToken token); - IAsyncEnumerable GetMovieLibraryContents( + IAsyncEnumerable> GetMovieLibraryContents( PlexLibrary library, PlexConnection connection, PlexServerAuthToken token); - IAsyncEnumerable GetShowLibraryContents( + IAsyncEnumerable> GetShowLibraryContents( PlexLibrary library, PlexConnection connection, PlexServerAuthToken token); - Task> CountShowSeasons( - PlexShow show, - PlexConnection connection, - PlexServerAuthToken token); - - IAsyncEnumerable GetShowSeasons( + IAsyncEnumerable> GetShowSeasons( PlexLibrary library, PlexShow show, PlexConnection connection, PlexServerAuthToken token); - Task> CountSeasonEpisodes( - PlexSeason season, - PlexConnection connection, - PlexServerAuthToken token); - - IAsyncEnumerable GetSeasonEpisodes( + IAsyncEnumerable> GetSeasonEpisodes( PlexLibrary library, PlexSeason season, PlexConnection connection, @@ -63,17 +53,12 @@ public interface IPlexServerApiClient PlexConnection connection, PlexServerAuthToken token); - Task> GetLibraryItemCount( - PlexLibrary library, - PlexConnection connection, - PlexServerAuthToken token); - - IAsyncEnumerable GetAllCollections( + IAsyncEnumerable> GetAllCollections( PlexConnection connection, PlexServerAuthToken token, CancellationToken cancellationToken); - IAsyncEnumerable GetCollectionItems( + IAsyncEnumerable> GetCollectionItems( PlexConnection connection, PlexServerAuthToken token, string key, diff --git a/ErsatzTV.Core/Jellyfin/JellyfinItemType.cs b/ErsatzTV.Core/Jellyfin/JellyfinItemType.cs deleted file mode 100644 index fb197f8b7..000000000 --- a/ErsatzTV.Core/Jellyfin/JellyfinItemType.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ErsatzTV.Core.Jellyfin; - -public static class JellyfinItemType -{ - public static readonly string Movie = "Movie"; - public static readonly string Show = "Series"; - public static readonly string Season = "Season"; - public static readonly string Episode = "Episode"; - public static readonly string Collection = "BoxSet"; - public static readonly string CollectionItems = "Movie,Series,Season,Episode"; -} diff --git a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs index eac0058df..9d1d3fbef 100644 --- a/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs +++ b/ErsatzTV.Infrastructure/Emby/EmbyApiClient.cs @@ -69,13 +69,11 @@ public class EmbyApiClient : IEmbyApiClient } } - public IAsyncEnumerable GetMovieLibraryItems(string address, string apiKey, EmbyLibrary library) + public IAsyncEnumerable> GetMovieLibraryItems(string address, string apiKey, EmbyLibrary library) => GetPagedLibraryContents( address, - apiKey, library, library.ItemId, - EmbyItemType.Movie, (service, itemId, skip, pageSize) => service.GetMovieLibraryItems( apiKey, itemId, @@ -83,13 +81,11 @@ public class EmbyApiClient : IEmbyApiClient limit: pageSize), (maybeLibrary, item) => maybeLibrary.Map(lib => ProjectToMovie(lib, item)).Flatten()); - public IAsyncEnumerable GetShowLibraryItems(string address, string apiKey, EmbyLibrary library) + public IAsyncEnumerable> GetShowLibraryItems(string address, string apiKey, EmbyLibrary library) => GetPagedLibraryContents( address, - apiKey, library, library.ItemId, - EmbyItemType.Show, (service, itemId, skip, pageSize) => service.GetShowLibraryItems( apiKey, itemId, @@ -97,16 +93,14 @@ public class EmbyApiClient : IEmbyApiClient limit: pageSize), (_, item) => ProjectToShow(item)); - public IAsyncEnumerable GetSeasonLibraryItems( + public IAsyncEnumerable> GetSeasonLibraryItems( string address, string apiKey, EmbyLibrary library, string showId) => GetPagedLibraryContents( address, - apiKey, library, showId, - EmbyItemType.Season, (service, itemId, skip, pageSize) => service.GetSeasonLibraryItems( apiKey, itemId, @@ -114,17 +108,15 @@ public class EmbyApiClient : IEmbyApiClient limit: pageSize), (_, item) => ProjectToSeason(item)); - public IAsyncEnumerable GetEpisodeLibraryItems( + public IAsyncEnumerable> GetEpisodeLibraryItems( string address, string apiKey, EmbyLibrary library, string showId, string seasonId) => GetPagedLibraryContents( address, - apiKey, library, seasonId, - EmbyItemType.Episode, (service, _, skip, pageSize) => service.GetEpisodeLibraryItems( apiKey, showId, @@ -133,7 +125,7 @@ public class EmbyApiClient : IEmbyApiClient limit: pageSize), (maybeLibrary, item) => maybeLibrary.Map(lib => ProjectToEpisode(lib, item)).Flatten()); - public IAsyncEnumerable GetCollectionLibraryItems(string address, string apiKey) + public IAsyncEnumerable> GetCollectionLibraryItems(string address, string apiKey) { // TODO: should we enumerate collection libraries here? @@ -141,10 +133,8 @@ public class EmbyApiClient : IEmbyApiClient { return GetPagedLibraryContents( address, - apiKey, None, itemId, - EmbyItemType.Collection, (service, _, skip, pageSize) => service.GetCollectionLibraryItems( apiKey, itemId, @@ -153,19 +143,17 @@ public class EmbyApiClient : IEmbyApiClient (_, item) => ProjectToCollection(item)); } - return AsyncEnumerable.Empty(); + return AsyncEnumerable.Empty>(); } - public IAsyncEnumerable GetCollectionItems( + public IAsyncEnumerable> GetCollectionItems( string address, string apiKey, string collectionId) => GetPagedLibraryContents( address, - apiKey, None, collectionId, - EmbyItemType.CollectionItems, (service, _, skip, pageSize) => service.GetCollectionItems( apiKey, collectionId, @@ -173,25 +161,6 @@ public class EmbyApiClient : IEmbyApiClient limit: pageSize), (_, item) => ProjectToCollectionMediaItem(item)); - public async Task> GetLibraryItemCount( - string address, - string apiKey, - string parentId, - string includeItemTypes) - { - try - { - IEmbyApi service = RestService.For(address); - EmbyLibraryItemsResponse items = await service.GetLibraryStats(apiKey, parentId, includeItemTypes); - return items.TotalRecordCount; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting Emby library item count"); - return BaseError.New(ex.Message); - } - } - public async Task> GetPlaybackInfo( string address, string apiKey, @@ -212,36 +181,31 @@ public class EmbyApiClient : IEmbyApiClient } } - private static async IAsyncEnumerable GetPagedLibraryContents( + private static async IAsyncEnumerable> GetPagedLibraryContents( string address, - string apiKey, Option maybeLibrary, string parentId, - string itemType, Func> getItems, Func, EmbyLibraryItemResponse, Option> mapper) { IEmbyApi service = RestService.For(address); - int size = await service - .GetLibraryStats(apiKey, parentId, itemType) - .Map(r => r.TotalRecordCount); - const int PAGE_SIZE = 10; - int pages = (size - 1) / PAGE_SIZE + 1; - + int pages = int.MaxValue; for (var i = 0; i < pages; i++) { int skip = i * PAGE_SIZE; - Task> result = getItems(service, parentId, skip, PAGE_SIZE) - .Map(items => items.Items.Map(item => mapper(maybeLibrary, item)).Somes()); + EmbyLibraryItemsResponse result = await getItems(service, parentId, skip, PAGE_SIZE); + + // update page count + pages = Math.Min(pages, (result.TotalRecordCount - 1) / PAGE_SIZE + 1); #pragma warning disable VSTHRD003 - foreach (TItem item in await result) + foreach (TItem item in result.Items.Map(item => mapper(maybeLibrary, item)).Somes()) #pragma warning restore VSTHRD003 { - yield return item; + yield return new Tuple(item, result.TotalRecordCount); } } } diff --git a/ErsatzTV.Infrastructure/Emby/IEmbyApi.cs b/ErsatzTV.Infrastructure/Emby/IEmbyApi.cs index 5f03855f3..f82b3f3ba 100644 --- a/ErsatzTV.Infrastructure/Emby/IEmbyApi.cs +++ b/ErsatzTV.Infrastructure/Emby/IEmbyApi.cs @@ -17,21 +17,6 @@ public interface IEmbyApi [Header("X-Emby-Token")] string apiKey); - [Get("/Items")] - public Task GetLibraryStats( - [Header("X-Emby-Token")] - string apiKey, - [Query] - string parentId, - [Query] - string includeItemTypes, - [Query] - bool recursive = true, - [Query] - int startIndex = 0, - [Query] - int limit = 0); - [Get("/Items?sortOrder=Ascending&sortBy=SortName")] public Task GetMovieLibraryItems( [Header("X-Emby-Token")] diff --git a/ErsatzTV.Infrastructure/Emby/Models/EmbyItemsCountsResponse.cs b/ErsatzTV.Infrastructure/Emby/Models/EmbyItemsCountsResponse.cs new file mode 100644 index 000000000..581bef1b4 --- /dev/null +++ b/ErsatzTV.Infrastructure/Emby/Models/EmbyItemsCountsResponse.cs @@ -0,0 +1,8 @@ +namespace ErsatzTV.Infrastructure.Emby.Models; + +public class EmbyItemsCountsResponse +{ + public int MovieCount { get; set; } + public int SeriesCount { get; set; } + public int EpisodeCount { get; set; } +} diff --git a/ErsatzTV.Infrastructure/Jellyfin/IJellyfinApi.cs b/ErsatzTV.Infrastructure/Jellyfin/IJellyfinApi.cs index 2233e3807..c8acb4cc2 100644 --- a/ErsatzTV.Infrastructure/Jellyfin/IJellyfinApi.cs +++ b/ErsatzTV.Infrastructure/Jellyfin/IJellyfinApi.cs @@ -22,25 +22,6 @@ public interface IJellyfinApi [Header("X-Emby-Token")] string apiKey); - [Get("/Items")] - public Task GetLibraryStats( - [Header("X-Emby-Token")] - string apiKey, - [Query] - string userId, - [Query] - string parentId, - [Query] - string includeItemTypes, - [Query] - bool recursive = true, - [Query] - string filters = "IsNotFolder", - [Query] - int startIndex = 0, - [Query] - int limit = 0); - [Get("/Items?sortOrder=Ascending&sortBy=SortName")] public Task GetMovieLibraryItems( [Header("X-Emby-Token")] diff --git a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs index 4c1ec89e1..6c4fe6a04 100644 --- a/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs +++ b/ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs @@ -93,17 +93,15 @@ public class JellyfinApiClient : IJellyfinApiClient } } - public IAsyncEnumerable GetMovieLibraryItems( + public IAsyncEnumerable> GetMovieLibraryItems( string address, string apiKey, JellyfinLibrary library) => GetPagedLibraryItems( address, - apiKey, library, library.MediaSourceId, library.ItemId, - JellyfinItemType.Movie, (service, userId, itemId, skip, pageSize) => service.GetMovieLibraryItems( apiKey, userId, @@ -112,17 +110,15 @@ public class JellyfinApiClient : IJellyfinApiClient limit: pageSize), (maybeLibrary, item) => maybeLibrary.Map(lib => ProjectToMovie(lib, item)).Flatten()); - public IAsyncEnumerable GetShowLibraryItems( + public IAsyncEnumerable> GetShowLibraryItems( string address, string apiKey, JellyfinLibrary library) => GetPagedLibraryItems( address, - apiKey, library, library.MediaSourceId, library.ItemId, - JellyfinItemType.Show, (service, userId, itemId, skip, pageSize) => service.GetShowLibraryItems( apiKey, userId, @@ -131,18 +127,16 @@ public class JellyfinApiClient : IJellyfinApiClient limit: pageSize), (_, item) => ProjectToShow(item)); - public IAsyncEnumerable GetSeasonLibraryItems( + public IAsyncEnumerable> GetSeasonLibraryItems( string address, string apiKey, JellyfinLibrary library, string showId) => GetPagedLibraryItems( address, - apiKey, library, library.MediaSourceId, showId, - JellyfinItemType.Season, (service, userId, _, skip, pageSize) => service.GetSeasonLibraryItems( apiKey, userId, @@ -151,18 +145,16 @@ public class JellyfinApiClient : IJellyfinApiClient limit: pageSize), (_, item) => ProjectToSeason(item)); - public IAsyncEnumerable GetEpisodeLibraryItems( + public IAsyncEnumerable> GetEpisodeLibraryItems( string address, string apiKey, JellyfinLibrary library, string seasonId) => GetPagedLibraryItems( address, - apiKey, library, library.MediaSourceId, seasonId, - JellyfinItemType.Episode, (service, userId, _, skip, pageSize) => service.GetEpisodeLibraryItems( apiKey, userId, @@ -171,7 +163,7 @@ public class JellyfinApiClient : IJellyfinApiClient limit: pageSize), (maybeLibrary, item) => maybeLibrary.Map(lib => ProjectToEpisode(lib, item)).Flatten()); - public IAsyncEnumerable GetCollectionLibraryItems( + public IAsyncEnumerable> GetCollectionLibraryItems( string address, string apiKey, int mediaSourceId) @@ -182,11 +174,9 @@ public class JellyfinApiClient : IJellyfinApiClient { return GetPagedLibraryItems( address, - apiKey, None, mediaSourceId, itemId, - JellyfinItemType.Collection, (service, userId, _, skip, pageSize) => service.GetCollectionLibraryItems( apiKey, userId, @@ -196,21 +186,19 @@ public class JellyfinApiClient : IJellyfinApiClient (_, item) => ProjectToCollection(item)); } - return AsyncEnumerable.Empty(); + return AsyncEnumerable.Empty>(); } - public IAsyncEnumerable GetCollectionItems( + public IAsyncEnumerable> GetCollectionItems( string address, string apiKey, int mediaSourceId, string collectionId) => GetPagedLibraryItems( address, - apiKey, None, mediaSourceId, collectionId, - JellyfinItemType.CollectionItems, (service, userId, _, skip, pageSize) => service.GetCollectionItems( apiKey, userId, @@ -219,37 +207,6 @@ public class JellyfinApiClient : IJellyfinApiClient limit: pageSize), (_, item) => ProjectToCollectionMediaItem(item)); - public async Task> GetLibraryItemCount( - string address, - string apiKey, - JellyfinLibrary library, - string parentId, - string includeItemTypes, - bool excludeFolders) - { - try - { - if (_memoryCache.TryGetValue($"jellyfin_admin_user_id.{library.MediaSourceId}", out string userId)) - { - IJellyfinApi service = RestService.For(address); - JellyfinLibraryItemsResponse items = await service.GetLibraryStats( - apiKey, - userId, - parentId, - includeItemTypes, - filters: excludeFolders ? "IsNotFolder" : null); - return items.TotalRecordCount; - } - - return BaseError.New("Jellyfin admin user id is not available"); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting jellyfin library item count"); - return BaseError.New(ex.Message); - } - } - public async Task> GetPlaybackInfo( string address, string apiKey, @@ -275,40 +232,33 @@ public class JellyfinApiClient : IJellyfinApiClient } } - private async IAsyncEnumerable GetPagedLibraryItems( + private async IAsyncEnumerable> GetPagedLibraryItems( string address, - string apiKey, Option maybeLibrary, int mediaSourceId, string parentId, - string itemType, Func> getItems, Func, JellyfinLibraryItemResponse, Option> mapper) { if (_memoryCache.TryGetValue($"jellyfin_admin_user_id.{mediaSourceId}", out string userId)) { IJellyfinApi service = RestService.For(address); - string filters = itemType == JellyfinItemType.Movie || itemType == JellyfinItemType.Episode - ? "IsNotFolder" - : null; - int size = await service - .GetLibraryStats(apiKey, userId, parentId, itemType, filters: filters) - .Map(r => r.TotalRecordCount); const int PAGE_SIZE = 10; - int pages = (size - 1) / PAGE_SIZE + 1; - + int pages = int.MaxValue; for (var i = 0; i < pages; i++) { int skip = i * PAGE_SIZE; - Task> result = getItems(service, userId, parentId, skip, PAGE_SIZE) - .Map(items => items.Items.Map(item => mapper(maybeLibrary, item)).Somes()); + JellyfinLibraryItemsResponse result = await getItems(service, userId, parentId, skip, PAGE_SIZE); - foreach (TItem item in await result) + // update page count + pages = Math.Min(pages, (result.TotalRecordCount - 1) / PAGE_SIZE + 1); + + foreach (TItem item in result.Items.Map(item => mapper(maybeLibrary, item)).Somes()) { - yield return item; + yield return new Tuple(item, result.TotalRecordCount); } } } diff --git a/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs b/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs index 2fda980c3..d69dcaee6 100644 --- a/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs +++ b/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs @@ -66,7 +66,7 @@ public class PlexServerApiClient : IPlexServerApiClient } } - public IAsyncEnumerable GetMovieLibraryContents( + public IAsyncEnumerable> GetMovieLibraryContents( PlexLibrary library, PlexConnection connection, PlexServerAuthToken token) @@ -89,7 +89,7 @@ public class PlexServerApiClient : IPlexServerApiClient return GetPagedLibraryContents(connection, CountItems, GetItems); } - public IAsyncEnumerable GetShowLibraryContents( + public IAsyncEnumerable> GetShowLibraryContents( PlexLibrary library, PlexConnection connection, PlexServerAuthToken token) @@ -110,24 +110,7 @@ public class PlexServerApiClient : IPlexServerApiClient return GetPagedLibraryContents(connection, CountItems, GetItems); } - public async Task> CountShowSeasons( - PlexShow show, - PlexConnection connection, - PlexServerAuthToken token) - { - try - { - string showMetadataKey = show.Key.Split("/").Reverse().Skip(1).Head(); - IPlexServerApi service = XmlServiceFor(connection.Uri); - return await service.CountShowChildren(showMetadataKey, token.AuthToken).Map(r => r.TotalSize); - } - catch (Exception ex) - { - return BaseError.New(ex.ToString()); - } - } - - public IAsyncEnumerable GetShowSeasons( + public IAsyncEnumerable> GetShowSeasons( PlexLibrary library, PlexShow show, PlexConnection connection, @@ -150,24 +133,7 @@ public class PlexServerApiClient : IPlexServerApiClient return GetPagedLibraryContents(connection, CountItems, GetItems); } - public async Task> CountSeasonEpisodes( - PlexSeason season, - PlexConnection connection, - PlexServerAuthToken token) - { - try - { - string seasonMetadataKey = season.Key.Split("/").Reverse().Skip(1).Head(); - IPlexServerApi service = XmlServiceFor(connection.Uri); - return await service.CountSeasonChildren(seasonMetadataKey, token.AuthToken).Map(r => r.TotalSize); - } - catch (Exception ex) - { - return BaseError.New(ex.ToString()); - } - } - - public IAsyncEnumerable GetSeasonEpisodes( + public IAsyncEnumerable> GetSeasonEpisodes( PlexLibrary library, PlexSeason season, PlexConnection connection, @@ -276,23 +242,7 @@ public class PlexServerApiClient : IPlexServerApiClient } } - public async Task> GetLibraryItemCount( - PlexLibrary library, - PlexConnection connection, - PlexServerAuthToken token) - { - try - { - IPlexServerApi service = XmlServiceFor(connection.Uri); - return await service.GetLibrarySection(library.Key, token.AuthToken).Map(r => r.TotalSize); - } - catch (Exception ex) - { - return BaseError.New(ex.ToString()); - } - } - - public IAsyncEnumerable GetAllCollections( + public IAsyncEnumerable> GetAllCollections( PlexConnection connection, PlexServerAuthToken token, CancellationToken cancellationToken) @@ -313,7 +263,7 @@ public class PlexServerApiClient : IPlexServerApiClient } } - public IAsyncEnumerable GetCollectionItems( + public IAsyncEnumerable> GetCollectionItems( PlexConnection connection, PlexServerAuthToken token, string key, @@ -335,7 +285,7 @@ public class PlexServerApiClient : IPlexServerApiClient } } - private static async IAsyncEnumerable GetPagedLibraryContents( + private static async IAsyncEnumerable> GetPagedLibraryContents( PlexConnection connection, Func> countItems, Func>> getItems) @@ -357,7 +307,7 @@ public class PlexServerApiClient : IPlexServerApiClient foreach (TItem item in await result) { - yield return item; + yield return new Tuple(item, size); } } } diff --git a/ErsatzTV.Scanner/Core/Emby/EmbyCollectionScanner.cs b/ErsatzTV.Scanner/Core/Emby/EmbyCollectionScanner.cs index c3917216d..af4ac3267 100644 --- a/ErsatzTV.Scanner/Core/Emby/EmbyCollectionScanner.cs +++ b/ErsatzTV.Scanner/Core/Emby/EmbyCollectionScanner.cs @@ -30,7 +30,7 @@ public class EmbyCollectionScanner : IEmbyCollectionScanner { try { - // need to call get libraries to find library that contains collections (box sets) + // need to call get libraries to find library that contains collections (box sets) await _embyApiClient.GetLibraries(address, apiKey); var incomingItemIds = new List(); @@ -38,7 +38,7 @@ public class EmbyCollectionScanner : IEmbyCollectionScanner // get all collections from db (item id, etag) List existingCollections = await _embyCollectionRepository.GetCollections(); - await foreach (EmbyCollection collection in _embyApiClient.GetCollectionLibraryItems(address, apiKey)) + await foreach ((EmbyCollection collection, int _) in _embyApiClient.GetCollectionLibraryItems(address, apiKey)) { incomingItemIds.Add(collection.ItemId); @@ -88,13 +88,13 @@ public class EmbyCollectionScanner : IEmbyCollectionScanner try { // get collection items from Emby - IAsyncEnumerable items = _embyApiClient.GetCollectionItems(address, apiKey, collection.ItemId); + IAsyncEnumerable> items = _embyApiClient.GetCollectionItems(address, apiKey, collection.ItemId); List removedIds = await _embyCollectionRepository.RemoveAllTags(collection); // sync tags on items var addedIds = new List(); - await foreach (MediaItem item in items) + await foreach ((MediaItem item, int _) in items) { addedIds.Add(await _embyCollectionRepository.AddTag(item, collection)); } diff --git a/ErsatzTV.Scanner/Core/Emby/EmbyMovieLibraryScanner.cs b/ErsatzTV.Scanner/Core/Emby/EmbyMovieLibraryScanner.cs index 5d070d754..d71003b6e 100644 --- a/ErsatzTV.Scanner/Core/Emby/EmbyMovieLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Emby/EmbyMovieLibraryScanner.cs @@ -75,16 +75,7 @@ public class EmbyMovieLibraryScanner : protected override string MediaServerItemId(EmbyMovie movie) => movie.ItemId; protected override string MediaServerEtag(EmbyMovie movie) => movie.Etag; - protected override Task> CountMovieLibraryItems( - EmbyConnectionParameters connectionParameters, - EmbyLibrary library) => - _embyApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library.ItemId, - EmbyItemType.Movie); - - protected override IAsyncEnumerable GetMovieLibraryItems( + protected override IAsyncEnumerable> GetMovieLibraryItems( EmbyConnectionParameters connectionParameters, EmbyLibrary library) => _embyApiClient.GetMovieLibraryItems( diff --git a/ErsatzTV.Scanner/Core/Emby/EmbyTelevisionLibraryScanner.cs b/ErsatzTV.Scanner/Core/Emby/EmbyTelevisionLibraryScanner.cs index 993fec157..423155740 100644 --- a/ErsatzTV.Scanner/Core/Emby/EmbyTelevisionLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Emby/EmbyTelevisionLibraryScanner.cs @@ -72,16 +72,7 @@ public class EmbyTelevisionLibraryScanner : MediaServerTelevisionLibraryScanner< cancellationToken); } - protected override Task> CountShowLibraryItems( - EmbyConnectionParameters connectionParameters, - EmbyLibrary library) - => _embyApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library.ItemId, - EmbyItemType.Show); - - protected override IAsyncEnumerable GetShowLibraryItems( + protected override IAsyncEnumerable> GetShowLibraryItems( EmbyConnectionParameters connectionParameters, EmbyLibrary library) => _embyApiClient.GetShowLibraryItems(connectionParameters.Address, connectionParameters.ApiKey, library); @@ -94,17 +85,7 @@ public class EmbyTelevisionLibraryScanner : MediaServerTelevisionLibraryScanner< protected override string MediaServerEtag(EmbySeason season) => season.Etag; protected override string MediaServerEtag(EmbyEpisode episode) => episode.Etag; - protected override Task> CountSeasonLibraryItems( - EmbyConnectionParameters connectionParameters, - EmbyLibrary library, - EmbyShow show) => - _embyApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - show.ItemId, - EmbyItemType.Season); - - protected override IAsyncEnumerable GetSeasonLibraryItems( + protected override IAsyncEnumerable> GetSeasonLibraryItems( EmbyLibrary library, EmbyConnectionParameters connectionParameters, EmbyShow show) => @@ -114,17 +95,7 @@ public class EmbyTelevisionLibraryScanner : MediaServerTelevisionLibraryScanner< library, show.ItemId); - protected override Task> CountEpisodeLibraryItems( - EmbyConnectionParameters connectionParameters, - EmbyLibrary library, - EmbySeason season) => - _embyApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - season.ItemId, - EmbyItemType.Episode); - - protected override IAsyncEnumerable GetEpisodeLibraryItems( + protected override IAsyncEnumerable> GetEpisodeLibraryItems( EmbyLibrary library, EmbyConnectionParameters connectionParameters, EmbyShow show, diff --git a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinCollectionScanner.cs b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinCollectionScanner.cs index 6b4b988bd..5a157bca5 100644 --- a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinCollectionScanner.cs +++ b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinCollectionScanner.cs @@ -42,7 +42,7 @@ public class JellyfinCollectionScanner : IJellyfinCollectionScanner return error; } - // need to call get libraries to find library that contains collections (box sets) + // need to call get libraries to find library that contains collections (box sets) await _jellyfinApiClient.GetLibraries(address, apiKey); var incomingItemIds = new List(); @@ -51,7 +51,7 @@ public class JellyfinCollectionScanner : IJellyfinCollectionScanner List existingCollections = await _jellyfinCollectionRepository.GetCollections(); // loop over collections - await foreach (JellyfinCollection collection in _jellyfinApiClient.GetCollectionLibraryItems( + await foreach ((JellyfinCollection collection, int _) in _jellyfinApiClient.GetCollectionLibraryItems( address, apiKey, mediaSourceId)) @@ -105,7 +105,7 @@ public class JellyfinCollectionScanner : IJellyfinCollectionScanner try { // get collection items from JF - IAsyncEnumerable items = _jellyfinApiClient.GetCollectionItems( + IAsyncEnumerable> items = _jellyfinApiClient.GetCollectionItems( address, apiKey, mediaSourceId, @@ -115,7 +115,7 @@ public class JellyfinCollectionScanner : IJellyfinCollectionScanner // sync tags on items var addedIds = new List(); - await foreach (MediaItem item in items) + await foreach ((MediaItem item, int _) in items) { addedIds.Add(await _jellyfinCollectionRepository.AddTag(item, collection)); } diff --git a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinMovieLibraryScanner.cs b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinMovieLibraryScanner.cs index 9f935561e..ceb679bd1 100644 --- a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinMovieLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinMovieLibraryScanner.cs @@ -76,18 +76,7 @@ public class JellyfinMovieLibraryScanner : protected override string MediaServerEtag(JellyfinMovie movie) => movie.Etag; - protected override Task> CountMovieLibraryItems( - JellyfinConnectionParameters connectionParameters, - JellyfinLibrary library) => - _jellyfinApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library, - library.ItemId, - JellyfinItemType.Movie, - true); - - protected override IAsyncEnumerable GetMovieLibraryItems( + protected override IAsyncEnumerable> GetMovieLibraryItems( JellyfinConnectionParameters connectionParameters, JellyfinLibrary library) => _jellyfinApiClient.GetMovieLibraryItems( diff --git a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs index 2028e7cb8..ff212a5ad 100644 --- a/ErsatzTV.Scanner/Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs @@ -73,18 +73,7 @@ public class JellyfinTelevisionLibraryScanner : MediaServerTelevisionLibraryScan cancellationToken); } - protected override Task> CountShowLibraryItems( - JellyfinConnectionParameters connectionParameters, - JellyfinLibrary library) - => _jellyfinApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library, - library.ItemId, - JellyfinItemType.Show, - false); - - protected override IAsyncEnumerable GetShowLibraryItems( + protected override IAsyncEnumerable> GetShowLibraryItems( JellyfinConnectionParameters connectionParameters, JellyfinLibrary library) => _jellyfinApiClient.GetShowLibraryItems(connectionParameters.Address, connectionParameters.ApiKey, library); @@ -97,19 +86,7 @@ public class JellyfinTelevisionLibraryScanner : MediaServerTelevisionLibraryScan protected override string MediaServerEtag(JellyfinSeason season) => season.Etag; protected override string MediaServerEtag(JellyfinEpisode episode) => episode.Etag; - protected override Task> CountSeasonLibraryItems( - JellyfinConnectionParameters connectionParameters, - JellyfinLibrary library, - JellyfinShow show) => - _jellyfinApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library, - show.ItemId, - JellyfinItemType.Season, - false); - - protected override IAsyncEnumerable GetSeasonLibraryItems( + protected override IAsyncEnumerable> GetSeasonLibraryItems( JellyfinLibrary library, JellyfinConnectionParameters connectionParameters, JellyfinShow show) => @@ -119,19 +96,7 @@ public class JellyfinTelevisionLibraryScanner : MediaServerTelevisionLibraryScan library, show.ItemId); - protected override Task> CountEpisodeLibraryItems( - JellyfinConnectionParameters connectionParameters, - JellyfinLibrary library, - JellyfinSeason season) => - _jellyfinApiClient.GetLibraryItemCount( - connectionParameters.Address, - connectionParameters.ApiKey, - library, - season.ItemId, - JellyfinItemType.Episode, - true); - - protected override IAsyncEnumerable GetEpisodeLibraryItems( + protected override IAsyncEnumerable> GetEpisodeLibraryItems( JellyfinLibrary library, JellyfinConnectionParameters connectionParameters, JellyfinShow show, diff --git a/ErsatzTV.Scanner/Core/Metadata/MediaServerMovieLibraryScanner.cs b/ErsatzTV.Scanner/Core/Metadata/MediaServerMovieLibraryScanner.cs index 82225681e..d6650efe2 100644 --- a/ErsatzTV.Scanner/Core/Metadata/MediaServerMovieLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Metadata/MediaServerMovieLibraryScanner.cs @@ -48,27 +48,14 @@ public abstract class MediaServerMovieLibraryScanner maybeCount = await CountMovieLibraryItems(connectionParameters, library); - foreach (BaseError error in maybeCount.LeftToSeq()) - { - return error; - } - - foreach (int count in maybeCount.RightToSeq()) - { - return await ScanLibrary( - movieRepository, - connectionParameters, - library, - getLocalPath, - GetMovieLibraryItems(connectionParameters, library), - count, - deepScan, - cancellationToken); - } - - // this won't happen - return Unit.Default; + return await ScanLibrary( + movieRepository, + connectionParameters, + library, + getLocalPath, + GetMovieLibraryItems(connectionParameters, library), + deepScan, + cancellationToken); } catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException) { @@ -81,8 +68,7 @@ public abstract class MediaServerMovieLibraryScanner getLocalPath, - IAsyncEnumerable movieEntries, - int totalMovieCount, + IAsyncEnumerable> movieEntries, bool deepScan, CancellationToken cancellationToken) { @@ -90,7 +76,7 @@ public abstract class MediaServerMovieLibraryScanner existingMovies = (await movieRepository.GetExistingMovies(library)) .ToImmutableDictionary(e => e.MediaServerItemId, e => e); - await foreach (TMovie incoming in movieEntries.WithCancellation(cancellationToken)) + await foreach ((TMovie incoming, int totalMovieCount) in movieEntries.WithCancellation(cancellationToken)) { if (cancellationToken.IsCancellationRequested) { @@ -237,11 +223,7 @@ public abstract class MediaServerMovieLibraryScanner> CountMovieLibraryItems( - TConnectionParameters connectionParameters, - TLibrary library); - - protected abstract IAsyncEnumerable GetMovieLibraryItems( + protected abstract IAsyncEnumerable> GetMovieLibraryItems( TConnectionParameters connectionParameters, TLibrary library); diff --git a/ErsatzTV.Scanner/Core/Metadata/MediaServerTelevisionLibraryScanner.cs b/ErsatzTV.Scanner/Core/Metadata/MediaServerTelevisionLibraryScanner.cs index 94713484d..1615fdefe 100644 --- a/ErsatzTV.Scanner/Core/Metadata/MediaServerTelevisionLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Metadata/MediaServerTelevisionLibraryScanner.cs @@ -50,29 +50,14 @@ public abstract class MediaServerTelevisionLibraryScanner maybeCount = await CountShowLibraryItems(connectionParameters, library); - foreach (BaseError error in maybeCount.LeftToSeq()) - { - return error; - } - - foreach (int count in maybeCount.RightToSeq()) - { - _logger.LogDebug("Library {Library} contains {Count} shows", library.Name, count); - - return await ScanLibrary( - televisionRepository, - connectionParameters, - library, - getLocalPath, - GetShowLibraryItems(connectionParameters, library), - count, - deepScan, - cancellationToken); - } - - // this won't happen - return Unit.Default; + return await ScanLibrary( + televisionRepository, + connectionParameters, + library, + getLocalPath, + GetShowLibraryItems(connectionParameters, library), + deepScan, + cancellationToken); } catch (Exception ex) when (ex is TaskCanceledException or OperationCanceledException) { @@ -80,11 +65,7 @@ public abstract class MediaServerTelevisionLibraryScanner> CountShowLibraryItems( - TConnectionParameters connectionParameters, - TLibrary library); - - protected abstract IAsyncEnumerable GetShowLibraryItems( + protected abstract IAsyncEnumerable> GetShowLibraryItems( TConnectionParameters connectionParameters, TLibrary library); @@ -100,15 +81,14 @@ public abstract class MediaServerTelevisionLibraryScanner getLocalPath, - IAsyncEnumerable showEntries, - int totalShowCount, + IAsyncEnumerable> showEntries, bool deepScan, CancellationToken cancellationToken) { var incomingItemIds = new List(); List existingShows = await televisionRepository.GetExistingShows(library); - await foreach (TShow incoming in showEntries.WithCancellation(cancellationToken)) + await foreach ((TShow incoming, int totalShowCount) in showEntries.WithCancellation(cancellationToken)) { if (cancellationToken.IsCancellationRequested) { @@ -146,23 +126,6 @@ public abstract class MediaServerTelevisionLibraryScanner result in maybeShow.RightToSeq()) { - Either maybeCount = await CountSeasonLibraryItems( - connectionParameters, - library, - result.Item); - foreach (BaseError error in maybeCount.LeftToSeq()) - { - return error; - } - - foreach (int count in maybeCount.RightToSeq()) - { - _logger.LogDebug( - "Show {Title} contains {Count} seasons", - result.Item.ShowMetadata.Head().Title, - count); - } - Either scanResult = await ScanSeasons( televisionRepository, library, @@ -220,22 +183,12 @@ public abstract class MediaServerTelevisionLibraryScanner> CountSeasonLibraryItems( - TConnectionParameters connectionParameters, - TLibrary library, - TShow show); - - protected abstract IAsyncEnumerable GetSeasonLibraryItems( + protected abstract IAsyncEnumerable> GetSeasonLibraryItems( TLibrary library, TConnectionParameters connectionParameters, TShow show); - protected abstract Task> CountEpisodeLibraryItems( - TConnectionParameters connectionParameters, - TLibrary library, - TSeason season); - - protected abstract IAsyncEnumerable GetEpisodeLibraryItems( + protected abstract IAsyncEnumerable> GetEpisodeLibraryItems( TLibrary library, TConnectionParameters connectionParameters, TShow show, @@ -293,14 +246,14 @@ public abstract class MediaServerTelevisionLibraryScanner seasonEntries, + IAsyncEnumerable> seasonEntries, bool deepScan, CancellationToken cancellationToken) { var incomingItemIds = new List(); List existingSeasons = await televisionRepository.GetExistingSeasons(library, show); - await foreach (TSeason incoming in seasonEntries.WithCancellation(cancellationToken)) + await foreach ((TSeason incoming, int _) in seasonEntries.WithCancellation(cancellationToken)) { incoming.ShowId = show.Id; @@ -331,24 +284,6 @@ public abstract class MediaServerTelevisionLibraryScanner result in maybeSeason.RightToSeq()) { - Either maybeCount = await CountEpisodeLibraryItems( - connectionParameters, - library, - result.Item); - foreach (BaseError error in maybeCount.LeftToSeq()) - { - return error; - } - - foreach (int count in maybeCount.RightToSeq()) - { - _logger.LogDebug( - "Show {Title} season {Season} contains {Count} episodes", - show.ShowMetadata.Head().Title, - result.Item.SeasonNumber, - count); - } - Either scanResult = await ScanEpisodes( televisionRepository, library, @@ -408,14 +343,14 @@ public abstract class MediaServerTelevisionLibraryScanner episodeEntries, + IAsyncEnumerable> episodeEntries, bool deepScan, CancellationToken cancellationToken) { var incomingItemIds = new List(); List existingEpisodes = await televisionRepository.GetExistingEpisodes(library, season); - await foreach (TEpisode incoming in episodeEntries.WithCancellation(cancellationToken)) + await foreach ((TEpisode incoming, int _) in episodeEntries.WithCancellation(cancellationToken)) { if (cancellationToken.IsCancellationRequested) { diff --git a/ErsatzTV.Scanner/Core/Plex/PlexCollectionScanner.cs b/ErsatzTV.Scanner/Core/Plex/PlexCollectionScanner.cs index 98a617b84..720dbeaa8 100644 --- a/ErsatzTV.Scanner/Core/Plex/PlexCollectionScanner.cs +++ b/ErsatzTV.Scanner/Core/Plex/PlexCollectionScanner.cs @@ -39,7 +39,7 @@ public class PlexCollectionScanner : IPlexCollectionScanner // get all collections from db (key, etag) List existingCollections = await _plexCollectionRepository.GetCollections(); - await foreach (PlexCollection collection in _plexServerApiClient.GetAllCollections( + await foreach ((PlexCollection collection, int _) in _plexServerApiClient.GetAllCollections( connection, token, cancellationToken)) @@ -93,7 +93,7 @@ public class PlexCollectionScanner : IPlexCollectionScanner try { // get collection items from Plex - IAsyncEnumerable items = _plexServerApiClient.GetCollectionItems( + IAsyncEnumerable> items = _plexServerApiClient.GetCollectionItems( connection, token, collection.Key, @@ -103,7 +103,7 @@ public class PlexCollectionScanner : IPlexCollectionScanner // sync tags on items var addedIds = new List(); - await foreach (MediaItem item in items) + await foreach ((MediaItem item, int _) in items) { addedIds.Add(await _plexCollectionRepository.AddTag(item, collection)); cancellationToken.ThrowIfCancellationRequested(); diff --git a/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs b/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs index 5af65afae..a9dcc0499 100644 --- a/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Plex/PlexMovieLibraryScanner.cs @@ -82,15 +82,7 @@ public class PlexMovieLibraryScanner : protected override string MediaServerEtag(PlexMovie movie) => movie.Etag; - protected override Task> CountMovieLibraryItems( - PlexConnectionParameters connectionParameters, - PlexLibrary library) - => _plexServerApiClient.GetLibraryItemCount( - library, - connectionParameters.Connection, - connectionParameters.Token); - - protected override IAsyncEnumerable GetMovieLibraryItems( + protected override IAsyncEnumerable> GetMovieLibraryItems( PlexConnectionParameters connectionParameters, PlexLibrary library) => _plexServerApiClient.GetMovieLibraryContents( diff --git a/ErsatzTV.Scanner/Core/Plex/PlexTelevisionLibraryScanner.cs b/ErsatzTV.Scanner/Core/Plex/PlexTelevisionLibraryScanner.cs index e23933e8b..9025a4ac3 100644 --- a/ErsatzTV.Scanner/Core/Plex/PlexTelevisionLibraryScanner.cs +++ b/ErsatzTV.Scanner/Core/Plex/PlexTelevisionLibraryScanner.cs @@ -130,15 +130,7 @@ public class PlexTelevisionLibraryScanner : // } // } - protected override Task> CountShowLibraryItems( - PlexConnectionParameters connectionParameters, - PlexLibrary library) => - _plexServerApiClient.GetLibraryItemCount( - library, - connectionParameters.Connection, - connectionParameters.Token); - - protected override IAsyncEnumerable GetShowLibraryItems( + protected override IAsyncEnumerable> GetShowLibraryItems( PlexConnectionParameters connectionParameters, PlexLibrary library) => _plexServerApiClient.GetShowLibraryContents( @@ -146,16 +138,7 @@ public class PlexTelevisionLibraryScanner : connectionParameters.Connection, connectionParameters.Token); - protected override Task> CountSeasonLibraryItems( - PlexConnectionParameters connectionParameters, - PlexLibrary library, - PlexShow show) => - _plexServerApiClient.CountShowSeasons( - show, - connectionParameters.Connection, - connectionParameters.Token); - - protected override IAsyncEnumerable GetSeasonLibraryItems( + protected override IAsyncEnumerable> GetSeasonLibraryItems( PlexLibrary library, PlexConnectionParameters connectionParameters, PlexShow show) => @@ -165,16 +148,7 @@ public class PlexTelevisionLibraryScanner : connectionParameters.Connection, connectionParameters.Token); - protected override Task> CountEpisodeLibraryItems( - PlexConnectionParameters connectionParameters, - PlexLibrary library, - PlexSeason season) => - _plexServerApiClient.CountSeasonEpisodes( - season, - connectionParameters.Connection, - connectionParameters.Token); - - protected override IAsyncEnumerable GetEpisodeLibraryItems( + protected override IAsyncEnumerable> GetEpisodeLibraryItems( PlexLibrary library, PlexConnectionParameters connectionParameters, PlexShow show,