Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
1.0 KiB

using ErsatzTV.Core.Interfaces.Metadata;
using ErsatzTV.Core.Interfaces.Repositories.Caching;
using ErsatzTV.Core.Interfaces.Search;
namespace ErsatzTV.Application.Search;
public class ReindexMediaItemsHandler : IRequestHandler<ReindexMediaItems>
{
private readonly ICachingSearchRepository _cachingSearchRepository;
private readonly IFallbackMetadataProvider _fallbackMetadataProvider;
private readonly ISearchIndex _searchIndex;
public ReindexMediaItemsHandler(
ICachingSearchRepository cachingSearchRepository,
IFallbackMetadataProvider fallbackMetadataProvider,
ISearchIndex searchIndex)
{
_cachingSearchRepository = cachingSearchRepository;
_fallbackMetadataProvider = fallbackMetadataProvider;
_searchIndex = searchIndex;
}
public async Task Handle(ReindexMediaItems request, CancellationToken cancellationToken)
{
await _searchIndex.RebuildItems(_cachingSearchRepository, _fallbackMetadataProvider, request.MediaItemIds);
_searchIndex.Commit();
}
}