2024-02-26 12:09:40 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2024-02-29 00:29:44 +00:00
|
|
|
using System.IO;
|
2024-02-26 12:09:40 +00:00
|
|
|
using System.Threading;
|
2022-09-22 12:13:53 +00:00
|
|
|
using System.Threading.Tasks;
|
2022-09-16 00:49:25 +00:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2024-02-26 12:09:40 +00:00
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
|
using MediaBrowser.Model.Configuration;
|
|
|
|
using MediaBrowser.Model.Lyrics;
|
|
|
|
using MediaBrowser.Model.Providers;
|
2022-09-16 00:49:25 +00:00
|
|
|
|
2022-09-17 21:37:38 +00:00
|
|
|
namespace MediaBrowser.Controller.Lyrics;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Interface ILyricManager.
|
|
|
|
/// </summary>
|
|
|
|
public interface ILyricManager
|
2022-09-16 00:49:25 +00:00
|
|
|
{
|
2022-09-17 21:37:38 +00:00
|
|
|
/// <summary>
|
2024-02-26 12:09:40 +00:00
|
|
|
/// Occurs when a lyric download fails.
|
2022-09-17 21:37:38 +00:00
|
|
|
/// </summary>
|
2024-02-26 12:09:40 +00:00
|
|
|
event EventHandler<LyricDownloadFailureEventArgs> LyricDownloadFailure;
|
2022-09-16 00:49:25 +00:00
|
|
|
|
2022-09-17 21:37:38 +00:00
|
|
|
/// <summary>
|
2024-02-26 12:09:40 +00:00
|
|
|
/// Search for lyrics for the specified song.
|
2022-09-17 21:37:38 +00:00
|
|
|
/// </summary>
|
2024-02-26 12:09:40 +00:00
|
|
|
/// <param name="audio">The song.</param>
|
|
|
|
/// <param name="isAutomated">Whether the request is automated.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>The list of lyrics.</returns>
|
|
|
|
Task<IReadOnlyList<RemoteLyricInfoDto>> SearchLyricsAsync(
|
|
|
|
Audio audio,
|
|
|
|
bool isAutomated,
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Search for lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The search request.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>The list of lyrics.</returns>
|
|
|
|
Task<IReadOnlyList<RemoteLyricInfoDto>> SearchLyricsAsync(
|
|
|
|
LyricSearchRequest request,
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Download the lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio.</param>
|
|
|
|
/// <param name="lyricId">The remote lyric id.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>The downloaded lyrics.</returns>
|
|
|
|
Task<LyricDto?> DownloadLyricsAsync(
|
|
|
|
Audio audio,
|
|
|
|
string lyricId,
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Download the lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio.</param>
|
|
|
|
/// <param name="libraryOptions">The library options to use.</param>
|
|
|
|
/// <param name="lyricId">The remote lyric id.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>The downloaded lyrics.</returns>
|
|
|
|
Task<LyricDto?> DownloadLyricsAsync(
|
|
|
|
Audio audio,
|
|
|
|
LibraryOptions libraryOptions,
|
|
|
|
string lyricId,
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
2024-02-29 00:29:44 +00:00
|
|
|
/// Saves new lyrics.
|
2024-02-26 12:09:40 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio file the lyrics belong to.</param>
|
2024-02-29 00:29:44 +00:00
|
|
|
/// <param name="format">The lyrics format.</param>
|
|
|
|
/// <param name="lyrics">The lyrics.</param>
|
2024-02-26 12:09:40 +00:00
|
|
|
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
2024-02-29 00:29:44 +00:00
|
|
|
Task<LyricDto?> SaveLyricAsync(Audio audio, string format, string lyrics);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Saves new lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio file the lyrics belong to.</param>
|
|
|
|
/// <param name="format">The lyrics format.</param>
|
|
|
|
/// <param name="lyrics">The lyrics.</param>
|
|
|
|
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|
|
|
Task<LyricDto?> SaveLyricAsync(Audio audio, string format, Stream lyrics);
|
2024-02-26 12:09:40 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the remote lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The remote lyrics id.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>The lyric response.</returns>
|
|
|
|
Task<LyricDto?> GetRemoteLyricsAsync(string id, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes the lyrics.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio file to remove lyrics from.</param>
|
|
|
|
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|
|
|
Task DeleteLyricsAsync(Audio audio);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the list of lyric providers.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
/// <returns>Lyric providers.</returns>
|
|
|
|
IReadOnlyList<LyricProviderInfo> GetSupportedProviders(BaseItem item);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the existing lyric for the audio.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="audio">The audio item.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
/// <returns>The parsed lyric model.</returns>
|
|
|
|
Task<LyricDto?> GetLyricsAsync(Audio audio, CancellationToken cancellationToken);
|
2022-09-16 00:49:25 +00:00
|
|
|
}
|