aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Chapters/IChapterManager.cs
blob: edc20205aab1fb40155a14ca944fcf4d015b2a6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;

namespace MediaBrowser.Controller.Chapters;

/// <summary>
/// Interface IChapterManager.
/// </summary>
public interface IChapterManager
{
    /// <summary>
    /// Gets a value indicating whether the specified item type is supported for chapter operations.
    /// </summary>
    /// <param name="item">The item to check.</param>
    /// <returns><c>true</c> if the item type supports chapters; otherwise, <c>false</c>.</returns>
    bool Supports(BaseItem item);

    /// <summary>
    /// Saves the chapters.
    /// </summary>
    /// <param name="item">The item.</param>
    /// <param name="chapters">The set of chapters.</param>
    void SaveChapters(BaseItem item, IReadOnlyList<ChapterInfo> chapters);

    /// <summary>
    /// Gets a single chapter of a BaseItem on a specific index.
    /// </summary>
    /// <param name="baseItemId">The BaseItems id.</param>
    /// <param name="index">The index of that chapter.</param>
    /// <returns>A chapter instance.</returns>
    ChapterInfo? GetChapter(Guid baseItemId, int index);

    /// <summary>
    /// Gets all chapters associated with the baseItem.
    /// </summary>
    /// <param name="baseItemId">The BaseItems id.</param>
    /// <returns>A readonly list of chapter instances.</returns>
    IReadOnlyList<ChapterInfo> GetChapters(Guid baseItemId);

    /// <summary>
    /// Refreshes the chapter images.
    /// </summary>
    /// <param name="video">Video to use.</param>
    /// <param name="directoryService">Directory service to use.</param>
    /// <param name="chapters">Set of chapters to refresh.</param>
    /// <param name="extractImages">Option to extract images.</param>
    /// <param name="saveChapters">Option to save chapters.</param>
    /// <param name="cancellationToken">CancellationToken to use for operation.</param>
    /// <returns><c>true</c> if successful, <c>false</c> if not.</returns>
    Task<bool> RefreshChapterImages(Video video, IDirectoryService directoryService, IReadOnlyList<ChapterInfo> chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken);

    /// <summary>
    /// Deletes the chapter data.
    /// </summary>
    /// <param name="itemId">The item id.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns>Task.</returns>
    Task DeleteChapterDataAsync(Guid itemId, CancellationToken cancellationToken);
}