50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.Jellypod.Models;
|
|
|
|
namespace Jellyfin.Plugin.Jellypod.Services;
|
|
|
|
/// <summary>
|
|
/// Service for downloading podcast episodes.
|
|
/// </summary>
|
|
public interface IPodcastDownloadService
|
|
{
|
|
/// <summary>
|
|
/// Queues an episode for download.
|
|
/// </summary>
|
|
/// <param name="podcast">The podcast.</param>
|
|
/// <param name="episode">The episode to download.</param>
|
|
/// <returns>Task representing the queue operation.</returns>
|
|
Task QueueDownloadAsync(Podcast podcast, Episode episode);
|
|
|
|
/// <summary>
|
|
/// Downloads an episode immediately.
|
|
/// </summary>
|
|
/// <param name="podcast">The podcast.</param>
|
|
/// <param name="episode">The episode to download.</param>
|
|
/// <param name="progress">Optional progress reporter.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>The local file path of the downloaded episode.</returns>
|
|
Task<string> DownloadEpisodeAsync(
|
|
Podcast podcast,
|
|
Episode episode,
|
|
IProgress<double>? progress = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Deletes a downloaded episode file.
|
|
/// </summary>
|
|
/// <param name="episode">The episode whose file to delete.</param>
|
|
/// <returns>Task representing the delete operation.</returns>
|
|
Task DeleteEpisodeFileAsync(Episode episode);
|
|
|
|
/// <summary>
|
|
/// Downloads podcast artwork.
|
|
/// </summary>
|
|
/// <param name="podcast">The podcast.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>Task representing the download operation.</returns>
|
|
Task DownloadPodcastArtworkAsync(Podcast podcast, CancellationToken cancellationToken = default);
|
|
}
|