Browse Source

fix incorrect search items count (#224)

pull/225/head
Jason Dove 4 years ago committed by GitHub
parent
commit
4c78f41c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs
  2. 1
      ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs
  3. 1
      ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs
  4. 1
      ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs
  5. 1
      ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryPathHandler.cs
  6. 1
      ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs
  7. 1
      ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs
  8. 4
      ErsatzTV.Infrastructure/Search/SearchIndex.cs

1
ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs

@ -36,6 +36,7 @@ namespace ErsatzTV.Application.Emby.Commands @@ -36,6 +36,7 @@ namespace ErsatzTV.Application.Emby.Commands
{
List<int> ids = await _mediaSourceRepository.DeleteAllEmby();
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
await _embySecretStore.DeleteAll();
_entityLocker.UnlockRemoteMediaSource<EmbyMediaSource>();

1
ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs

@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Emby.Commands @@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Emby.Commands
var toDisable = request.Preferences.Filter(p => p.ShouldSyncItems == false).Map(p => p.Id).ToList();
List<int> ids = await _mediaSourceRepository.DisableEmbyLibrarySync(toDisable);
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
IEnumerable<int> toEnable = request.Preferences.Filter(p => p.ShouldSyncItems).Map(p => p.Id);
await _mediaSourceRepository.EnableEmbyLibrarySync(toEnable);

1
ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs

@ -36,6 +36,7 @@ namespace ErsatzTV.Application.Jellyfin.Commands @@ -36,6 +36,7 @@ namespace ErsatzTV.Application.Jellyfin.Commands
{
List<int> ids = await _mediaSourceRepository.DeleteAllJellyfin();
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
await _jellyfinSecretStore.DeleteAll();
_entityLocker.UnlockRemoteMediaSource<JellyfinMediaSource>();

1
ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs

@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Jellyfin.Commands @@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Jellyfin.Commands
var toDisable = request.Preferences.Filter(p => p.ShouldSyncItems == false).Map(p => p.Id).ToList();
List<int> ids = await _mediaSourceRepository.DisableJellyfinLibrarySync(toDisable);
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
IEnumerable<int> toEnable = request.Preferences.Filter(p => p.ShouldSyncItems).Map(p => p.Id);
await _mediaSourceRepository.EnableJellyfinLibrarySync(toEnable);

1
ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryPathHandler.cs

@ -32,6 +32,7 @@ namespace ErsatzTV.Application.Libraries.Commands @@ -32,6 +32,7 @@ namespace ErsatzTV.Application.Libraries.Commands
{
List<int> ids = await _libraryRepository.GetMediaIdsByLocalPath(libraryPath.Id);
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
await _libraryRepository.DeleteLocalPath(libraryPath.Id);
return Unit.Default;
}

1
ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs

@ -33,6 +33,7 @@ namespace ErsatzTV.Application.Plex.Commands @@ -33,6 +33,7 @@ namespace ErsatzTV.Application.Plex.Commands
{
List<int> ids = await _mediaSourceRepository.DeleteAllPlex();
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
await _plexSecretStore.DeleteAll();
_entityLocker.UnlockPlex();

1
ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs

@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Plex.Commands @@ -31,6 +31,7 @@ namespace ErsatzTV.Application.Plex.Commands
var toDisable = request.Preferences.Filter(p => p.ShouldSyncItems == false).Map(p => p.Id).ToList();
List<int> ids = await _mediaSourceRepository.DisablePlexLibrarySync(toDisable);
await _searchIndex.RemoveItems(ids);
_searchIndex.Commit();
IEnumerable<int> toEnable = request.Preferences.Filter(p => p.ShouldSyncItems).Map(p => p.Id);
await _mediaSourceRepository.EnablePlexLibrarySync(toEnable);

4
ErsatzTV.Infrastructure/Search/SearchIndex.cs

@ -71,7 +71,7 @@ namespace ErsatzTV.Infrastructure.Search @@ -71,7 +71,7 @@ namespace ErsatzTV.Infrastructure.Search
_initialized = false;
}
public int Version => 11;
public int Version => 12;
public Task<bool> Initialize(ILocalFileSystem localFileSystem)
{
@ -92,6 +92,8 @@ namespace ErsatzTV.Infrastructure.Search @@ -92,6 +92,8 @@ namespace ErsatzTV.Infrastructure.Search
public async Task<Unit> Rebuild(ISearchRepository searchRepository, List<int> itemIds)
{
_writer.DeleteAll();
foreach (int id in itemIds)
{
Option<MediaItem> maybeMediaItem = await searchRepository.GetItemToIndex(id);

Loading…
Cancel
Save