### Quick Start: Auto-Parsing Lyrics Source: https://github.com/6xingyv/accompanist-lyrics-core/blob/main/README.md Use AutoParser to automatically detect and parse lyrics content. This is the recommended approach for most use cases. ```kotlin // 1. Get your lyrics content from a file or network val lyricsContent: String = fetchLyrics() // 2. Create a default AutoParser instance val autoParser = AutoParser() // 3. Parse the content val lyrics = autoParser.parse(lyricsContent) // Now you have a unified SyncedLyrics object! println(lyrics.metadata.title) println(lyrics.lines.first().text) ``` -------------------------------- ### Add lyrics-core Dependency Source: https://github.com/6xingyv/accompanist-lyrics-core/blob/main/README.md Add the lyrics-core dependency to your build.gradle.kts file. Replace VERSION with the latest version from Maven Central. ```kotlin dependencies { implementation("com.mocharealm.accompanist:lyrics-core:VERSION") } ``` -------------------------------- ### Register Custom Parser with AutoParser Source: https://github.com/6xingyv/accompanist-lyrics-core/blob/main/README.md Register your custom parser by passing it in a list to the AutoParser constructor. Custom parsers are checked in the order provided. ```kotlin // Build an AutoParser instance with your custom parser alongside built-in ones val autoParser = AutoParser( listOf( MyCustomParser(), // Checked first KugouKrcParser, TTMLParser, LyricifySyllableParser, EnhancedLrcParser, LrcParser ) ) // This parser now understands both built-in and your custom format! val lyrics = autoParser.parse(myCustomLyricsContent) ``` -------------------------------- ### Implement Custom Lyrics Parser Source: https://github.com/6xingyv/accompanist-lyrics-core/blob/main/README.md Create a class implementing ILyricsParser to add support for custom lyrics formats. The canParse method should check for unique format identifiers. ```kotlin class MyCustomParser : ILyricsParser { override fun canParse(content: String): Boolean { // Check if your parser can parse or not // Example: check for a unique tag return content.startsWith("##MY_COOL_LYRICS##") } override fun parse(lines: List): SyncedLyrics { // Your parsing logic here... } override fun parse(content: String): SyncedLyrics { // Your parsing logic here... } } ``` -------------------------------- ### Parsing a Specific Format (LRC) Source: https://github.com/6xingyv/accompanist-lyrics-core/blob/main/README.md If the lyrics format is known, use a specific parser like LrcParser directly. You can also use EnhancedLrcParser, TTMLParser, or LyricifySyllableParser. ```kotlin val lrcLines = listOf( "[00:39.96]I lean in and you move away", "[00:39.96]我靠在里面,你就离开" ) val lyrics = LrcParser.parse(lrcLines) println(lyrics.lines) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.