jellyfin/MediaBrowser.Model/Lyrics/LyricLine.cs
Alex 82a561b87d
Add API support for ELRC word-based lyrics (#12941)
* Add API support for ELRC word-based lyrics

Adds support for word-based timestamps from within ELRC files.

* Create TimeTags object

* redo TimeTag implementation

Change TimeTag to long, redo TimeTag implementation
Make timestamp not nullable
Update MediaBrowser.Model/Lyrics/LyricLine.cs
Make TimeTag list IReadOnlyList
Remove nullable Timestamp
Update TimeTag description

Co-Authored-By: Cody Robibero <cody@robibe.ro>

* Changes to LyricLineTimeTag

Moved TimeTag to LyricLineTimeTag
Change "timestamp" to "start" for consistency
Change plural "TimeTags" to "Cues"
Change comments

* Change LyricLineTimeTag to LyricLineCue, include info about end times

* Remove width

* Remove width tag

* Rewrite cue parser and add tests

---------

Co-authored-by: Cody Robibero <cody@robibe.ro>
2025-04-07 08:59:18 -06:00

37 lines
997 B
C#

using System.Collections.Generic;
namespace MediaBrowser.Model.Lyrics;
/// <summary>
/// Lyric model.
/// </summary>
public class LyricLine
{
/// <summary>
/// Initializes a new instance of the <see cref="LyricLine"/> class.
/// </summary>
/// <param name="text">The lyric text.</param>
/// <param name="start">The lyric start time in ticks.</param>
/// <param name="cues">The time-aligned cues for the song's lyrics.</param>
public LyricLine(string text, long? start = null, IReadOnlyList<LyricLineCue>? cues = null)
{
Text = text;
Start = start;
Cues = cues;
}
/// <summary>
/// Gets the text of this lyric line.
/// </summary>
public string Text { get; }
/// <summary>
/// Gets the start time in ticks.
/// </summary>
public long? Start { get; }
/// <summary>
/// Gets the time-aligned cues for the song's lyrics.
/// </summary>
public IReadOnlyList<LyricLineCue>? Cues { get; }
}