Remove use of AddParts. Cleanup use of Lyric vs Lyrics.

This commit is contained in:
1hitsong
2022-09-16 20:52:40 -04:00
parent f4fd908f8d
commit f740d1b9f0
11 changed files with 53 additions and 70 deletions

View File

@@ -1,37 +1,23 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Lyrics
{
public interface ILyricManager
{
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="lyricProviders">The lyric providers.</param>
void AddParts(IEnumerable<ILyricProvider> lyricProviders);
/// <summary>
/// Gets the lyrics.
/// </summary>
/// <param name="item">The media item.</param>
/// <returns>Lyrics for passed item.</returns>
LyricResponse GetLyric(BaseItem item);
LyricResponse GetLyrics(BaseItem item);
/// <summary>
/// Checks if requested item has a matching local lyric file.
/// </summary>
/// <param name="item">The media item.</param>
/// <returns>True if item has a matching lyrics file; otherwise false.</returns>
/// <returns>True if item has a matching lyric file; otherwise false.</returns>
bool HasLyricFile(BaseItem item);
}
}

View File

@@ -22,8 +22,8 @@ namespace MediaBrowser.Controller.Lyrics
/// <summary>
/// Gets the lyrics.
/// </summary>
/// <param name="item">The item to to process.</param>
/// <returns>Task{LyricResponse}.</returns>
/// <param name="item">The media item.</param>
/// <returns>If found, returns lyrics for passed item; otherwise, null.</returns>
LyricResponse? GetLyrics(BaseItem item);
}
}

View File

@@ -1,12 +1,12 @@
namespace MediaBrowser.Controller.Lyrics
{
/// <summary>
/// Lyric dto.
/// Lyric model.
/// </summary>
public class Lyric
{
/// <summary>
/// Gets or sets the start time (ticks).
/// Gets or sets the start time in ticks.
/// </summary>
public double? Start { get; set; }

View File

@@ -11,16 +11,16 @@ using Microsoft.AspNetCore.Mvc;
namespace MediaBrowser.Controller.Lyrics
{
/// <summary>
/// Item helper.
/// Lyric helper methods.
/// </summary>
public static class LyricInfo
{
/// <summary>
/// Checks if requested item has a matching lyric file.
/// Gets matching lyric file for a requested item.
/// </summary>
/// <param name="lyricProvider">The current lyricProvider interface.</param>
/// <param name="lyricProvider">The lyricProvider interface to use.</param>
/// <param name="itemPath">Path of requested item.</param>
/// <returns>True if item has a matching lyrics file.</returns>
/// <returns>Lyric file path if passed lyric provider's supported media type is found; otherwise, null.</returns>
public static string? GetLyricFilePath(ILyricProvider lyricProvider, string itemPath)
{
if (lyricProvider.SupportedMediaTypes.Any())

View File

@@ -6,10 +6,19 @@ using System.Collections.Generic;
namespace MediaBrowser.Controller.Lyrics
{
/// <summary>
/// LyricResponse model.
/// </summary>
public class LyricResponse
{
/// <summary>
/// Gets or sets MetaData.
/// </summary>
public IDictionary<string, object> MetaData { get; set; }
/// <summary>
/// Gets or sets Lyrics.
/// </summary>
public IEnumerable<Lyric> Lyrics { get; set; }
}
}