45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.Jellypod.Api.Models;
|
|
using Jellyfin.Plugin.Jellypod.Models;
|
|
|
|
namespace Jellyfin.Plugin.Jellypod.Services;
|
|
|
|
/// <summary>
|
|
/// Service for handling OPML import and export.
|
|
/// </summary>
|
|
public interface IOpmlService
|
|
{
|
|
/// <summary>
|
|
/// Parses OPML content and extracts podcast outlines.
|
|
/// </summary>
|
|
/// <param name="opmlContent">The OPML XML content.</param>
|
|
/// <returns>List of parsed outlines.</returns>
|
|
IReadOnlyList<OpmlOutline> ParseOpml(string opmlContent);
|
|
|
|
/// <summary>
|
|
/// Parses OPML from a stream.
|
|
/// </summary>
|
|
/// <param name="stream">The input stream containing OPML XML.</param>
|
|
/// <returns>List of parsed outlines.</returns>
|
|
IReadOnlyList<OpmlOutline> ParseOpml(Stream stream);
|
|
|
|
/// <summary>
|
|
/// Imports podcasts from parsed OPML outlines.
|
|
/// </summary>
|
|
/// <param name="outlines">The parsed OPML outlines.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>Import result with statistics.</returns>
|
|
Task<OpmlImportResult> ImportPodcastsAsync(
|
|
IReadOnlyList<OpmlOutline> outlines,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Exports all subscribed podcasts to OPML format.
|
|
/// </summary>
|
|
/// <returns>OPML XML string.</returns>
|
|
Task<string> ExportToOpmlAsync();
|
|
}
|