mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-03 08:51:56 +01:00
Add callback for segment data pruning to IMediaSegmentProvider
This commit is contained in:
@@ -187,6 +187,18 @@ public class MediaSegmentManager : IMediaSegmentManager
|
||||
{
|
||||
await db.MediaSegments.Where(e => e.ItemId.Equals(itemId)).ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
foreach (var provider in _segmentProviders)
|
||||
{
|
||||
try
|
||||
{
|
||||
await provider.CleanupExtractedData(itemId, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Provider {ProviderName} failed to clean up extracted data for item {ItemId}", provider.Name, itemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -31,4 +32,16 @@ public interface IMediaSegmentProvider
|
||||
/// <param name="item">The base item to extract segments from.</param>
|
||||
/// <returns>True if item is supported, otherwise false.</returns>
|
||||
ValueTask<bool> Supports(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Called when extracted segment data for an item is being pruned.
|
||||
/// Providers should delete any cached analysis data they hold for the given item.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item whose data is being pruned.</param>
|
||||
/// <param name="cancellationToken">Abort token.</param>
|
||||
/// <returns>A task representing the asynchronous cleanup operation.</returns>
|
||||
Task CleanupExtractedData(Guid itemId, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user