Browse Source

fix some collection related bugs with images (#1874)

pull/1876/head
Jason Dove 12 months ago committed by GitHub
parent
commit
3f6eb5a121
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 6
      ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs
  3. 21
      ErsatzTV/Pages/Search.razor

2
CHANGELOG.md

@ -63,6 +63,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix synchronizing trakt lists from users with special characters in their username - Fix synchronizing trakt lists from users with special characters in their username
- Note that these lists MUST be added as URLs; the short-form `user/list` will NOT work with special characters - Note that these lists MUST be added as URLs; the short-form `user/list` will NOT work with special characters
- Fix local subtitle scanner to detect non-lowercase extensions (e.g. `Movie (2000).EN.SRT`) - Fix local subtitle scanner to detect non-lowercase extensions (e.g. `Movie (2000).EN.SRT`)
- Fix adding a single image to a manual collection from search results
- Fix loading manual collection view when collection contains images
### Changed ### Changed
- Remove some unnecessary API calls related to media server scanning and paging - Remove some unnecessary API calls related to media server scanning and paging

6
ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs

@ -97,6 +97,12 @@ public class GetCollectionCardsHandler :
.Include(c => c.MediaItems) .Include(c => c.MediaItems)
.ThenInclude(i => (i as Song).MediaVersions) .ThenInclude(i => (i as Song).MediaVersions)
.ThenInclude(mv => mv.MediaFiles) .ThenInclude(mv => mv.MediaFiles)
.Include(c => c.MediaItems)
.ThenInclude(i => (i as Image).ImageMetadata)
.ThenInclude(ovm => ovm.Artwork)
.Include(c => c.MediaItems)
.ThenInclude(i => (i as Image).MediaVersions)
.ThenInclude(mv => mv.MediaFiles)
.SelectOneAsync(c => c.Id, c => c.Id == request.Id) .SelectOneAsync(c => c.Id, c => c.Id == request.Id)
.Map(c => c.ToEither(BaseError.New("Unable to load collection"))) .Map(c => c.ToEither(BaseError.New("Unable to load collection")))
.MapT(c => ProjectToViewModel(c, maybeJellyfin, maybeEmby)); .MapT(c => ProjectToViewModel(c, maybeJellyfin, maybeEmby));

21
ErsatzTV/Pages/Search.razor

@ -654,6 +654,27 @@
Right: _ => Snackbar.Add($"Added {song.Title} to collection {collection.Name}", Severity.Success)); Right: _ => Snackbar.Add($"Added {song.Title} to collection {collection.Name}", Severity.Success));
} }
} }
if (card is ImageCardViewModel image)
{
var parameters = new DialogParameters { { "EntityType", "image" }, { "EntityName", image.Title } };
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
IDialogReference dialog = await Dialog.ShowAsync<AddToCollectionDialog>("Add To Collection", parameters, options);
DialogResult result = await dialog.Result;
if (result is { Canceled: false, Data: MediaCollectionViewModel collection })
{
var request = new AddImageToCollection(collection.Id, image.ImageId);
Either<BaseError, Unit> addResult = await Mediator.Send(request, CancellationToken);
addResult.Match(
Left: error =>
{
Snackbar.Add($"Unexpected error adding image to collection: {error.Value}");
Logger.LogError("Unexpected error adding image to collection: {Error}", error.Value);
},
Right: _ => Snackbar.Add($"Added {image.Title} to collection {collection.Name}", Severity.Success));
}
}
} }
private string GetMoviesLink() private string GetMoviesLink()

Loading…
Cancel
Save