Browse Source

fix removing tags from local libraries (#2616)

pull/2617/head
Jason Dove 2 months ago committed by GitHub
parent
commit
9d2cff53c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 2
      ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs
  3. 3
      ErsatzTV/Pages/Schedules.razor
  4. 2
      ErsatzTV/Shared/ScheduleItemsDialog.razor

2
CHANGELOG.md

@ -52,6 +52,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -52,6 +52,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix saving subtitle title changes to the database
- This fixes e.g. where stream selection would continue to use the original title
- This fix applies to all libraries (local and media server)
- Fix (3 year old) bug removing tags from local libraries when they are removed from NFO files (all content types)
- New scans will properly remove old tags; NFO files may need to be touched to force updating during a scan
### Changed
- Use smaller batch size for search index updates (100, down from 1000)

2
ErsatzTV.Infrastructure/Data/Repositories/MetadataRepository.cs

@ -587,7 +587,7 @@ public class MetadataRepository(IDbContextFactory<TvContext> dbContextFactory) : @@ -587,7 +587,7 @@ public class MetadataRepository(IDbContextFactory<TvContext> dbContextFactory) :
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync();
return await dbContext.Connection.ExecuteAsync(
"DELETE FROM Tag WHERE Id = @TagId AND ExternalCollectionId = @ExternalCollectionId",
"DELETE FROM Tag WHERE Id = @TagId AND ((ExternalCollectionId = @ExternalCollectionId) OR (ExternalCollectionId IS NULL AND @ExternalCollectionId IS NULL))",
new { TagId = tag.Id, tag.ExternalCollectionId })
.Map(result => result > 0);
}

3
ErsatzTV/Pages/Schedules.razor

@ -223,7 +223,8 @@ @@ -223,7 +223,8 @@
Option<IEnumerable<ProgramScheduleItemViewModel>> maybeResults = await Mediator.Send(new GetProgramScheduleItems(schedule.Id), _cts.Token);
foreach (IEnumerable<ProgramScheduleItemViewModel> results in maybeResults)
{
var parameters = new DialogParameters { { "Schedule", schedule }, { "Items", results } };
var sorted = results.OrderBy(i => i.Index).ToList();
var parameters = new DialogParameters { { "Schedule", schedule }, { "Items", sorted } };
var options = new DialogOptions { CloseButton = true, CloseOnEscapeKey = true, MaxWidth = MaxWidth.Medium, FullWidth = true };
IDialogReference dialog = await Dialog.ShowAsync<ScheduleItemsDialog>(schedule.Name, parameters, options);
DialogResult _ = await dialog.Result;

2
ErsatzTV/Shared/ScheduleItemsDialog.razor

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
public ProgramScheduleViewModel Schedule { get; set; }
[Parameter]
public IEnumerable<ProgramScheduleItemViewModel> Items { get; set; }
public List<ProgramScheduleItemViewModel> Items { get; set; }
private string _info;
private ElementReference _infoView;

Loading…
Cancel
Save