UNPKG

paroles

Version:

A library for parsing, making, modifying and playing LRC format lyrics

67 lines (66 loc) 2.35 kB
import type { EndOfLine } from './utils'; interface LyricsInfo { /** al, Album where the song is from */ album?: string; /** ar, Lyrics artist */ artist?: string; /** au, Creator of the Songtext */ author?: string; /** ti, Lyrics (song) title */ title?: string; /** by, Creator of the LRC file */ creator?: string; /** +/- Overall timestamp adjustment in seconds, + shifts time up, - shifts down i.e. A positive value let lyrics appear sooner, a negative value delays the lyrics */ offset?: number; /** How long the song is */ length?: string; /** re, The player or editor that created the LRC file */ editor?: string; /** ve, version of program */ version?: string; } export interface LyricsLine { time: number; text: string; } interface LyricsMergeOption { override?: boolean; resolveInfo?: (original: LyricsInfo, affiliate: LyricsInfo) => LyricsInfo; resolveConflict?: (original: string, affiliate: string) => string; } interface LyricsOption { resolveConflict?: 'merge' | 'preserve' | 'overwrite' | ((line1: string, line2: string) => string); } interface LyricsParseOption { eol: EndOfLine; resolveConflict?: LyricsOption['resolveConflict']; } export declare class Lyrics { private _offset; private _option; eol: EndOfLine; info: LyricsInfo; lines: LyricsLine[]; constructor(lyrics?: string | Lyrics); constructor(lyrics: string | Lyrics, option?: LyricsOption); clone(): Lyrics; toString(): string; at(index: number): LyricsLine | undefined; getIndexByTime(time: number): number; atTime(time: number): LyricsLine | undefined; setOffset(sec: number): void; merge(lyrics: string | Lyrics, options?: LyricsMergeOption): this; insert(lines: LyricsLine | LyricsLine[]): this; remove(line: LyricsLine | string | RegExp): this; replace(oldLine: LyricsLine, newLine: LyricsLine): Lyrics; replace(oldLine: string, newLine: string): Lyrics; replace(oldLine: RegExp, newLine: LyricsLine): Lyrics; replace(oldLine: RegExp, newLine: string): Lyrics; setInfo(info: LyricsInfo): this; static stringify(lyrics: Lyrics): string; static parse(text: string, option?: LyricsParseOption): { info: LyricsInfo; lines: LyricsLine[]; }; } export {};