IMediaSegmentManager.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. using Jellyfin.Data.Entities;
  5. using Jellyfin.Data.Enums;
  6. using MediaBrowser.Controller.Entities;
  7. using MediaBrowser.Model.MediaSegments;
  8. namespace MediaBrowser.Controller;
  9. /// <summary>
  10. /// Defines methods for interacting with media segments.
  11. /// </summary>
  12. public interface IMediaSegmentManager
  13. {
  14. /// <summary>
  15. /// Returns if this item supports media segments.
  16. /// </summary>
  17. /// <param name="baseItem">The base Item to check.</param>
  18. /// <returns>True if supported otherwise false.</returns>
  19. bool IsTypeSupported(BaseItem baseItem);
  20. /// <summary>
  21. /// Creates a new Media Segment associated with an Item.
  22. /// </summary>
  23. /// <param name="mediaSegment">The segment to create.</param>
  24. /// <param name="segmentProviderId">The id of the Provider who created this segment.</param>
  25. /// <returns>The created Segment entity.</returns>
  26. Task<MediaSegmentDto> CreateSegmentAsync(MediaSegmentDto mediaSegment, string segmentProviderId);
  27. /// <summary>
  28. /// Deletes a single media segment.
  29. /// </summary>
  30. /// <param name="segmentId">The <see cref="MediaSegment.Id"/> to delete.</param>
  31. /// <returns>a task.</returns>
  32. Task DeleteSegmentAsync(Guid segmentId);
  33. /// <summary>
  34. /// Obtains all segments accociated with the itemId.
  35. /// </summary>
  36. /// <param name="itemId">The id of the <see cref="BaseItem"/>.</param>
  37. /// <param name="typeFilter">filteres all media segments of the given type to be included. If null all types are included.</param>
  38. /// <returns>An enumerator of <see cref="MediaSegmentDto"/>'s.</returns>
  39. Task<IEnumerable<MediaSegmentDto>> GetSegmentsAsync(Guid itemId, IEnumerable<MediaSegmentType>? typeFilter);
  40. /// <summary>
  41. /// Gets information about any media segments stored for the given itemId.
  42. /// </summary>
  43. /// <param name="itemId">The id of the <see cref="BaseItem"/>.</param>
  44. /// <returns>True if there are any segments stored for the item, otherwise false.</returns>
  45. /// TODO: this should be async but as the only caller BaseItem.GetVersionInfo isn't async, this is also not. Venson.
  46. bool HasSegments(Guid itemId);
  47. }