Skip to content

Allow yt-dlp supported platforms to use auto-synced lyrics(timestamped) - #289

Closed
Ivyson wants to merge 5 commits into
bjarneo:mainfrom
Ivyson:main
Closed

Allow yt-dlp supported platforms to use auto-synced lyrics(timestamped)#289
Ivyson wants to merge 5 commits into
bjarneo:mainfrom
Ivyson:main

Conversation

@Ivyson

@Ivyson Ivyson commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Support for synced lyrics on YouTube Music and other yt-dlp tracks.
Until now, synced (auto-scrolling, timestamped) lyrics only worked for local files and Navidrome. YouTube/yt-dlp tracks were always forced into manual scroll mode ; even though timestamped LRC was already being fetched from LRCLIB/NetEase. The exclusion relied on a stale comment claiming yt-dlp streams report position 0; in reality, position has been tracked from decoded PCM frames since from March.
This PR lets yt-dlp tracks with a known duration use synced lyrics: the active line auto-scrolls and highlights in time with playback, including after seeking. Streams without a finite duration (e.xx. YouTube Live) stay in scroll mode, since their position isn't song-relative.

This was confirmed to be working using yt-dlp version: 2026.07.04
ffmpeg: "8.1.2 "

Screenshots / video

Before change

image

After Changes

image

How to test

  1. make build && ./cliamp "https://soundcloud.com/j-cole/power-trip-feat-miguel-1?utm_source=clipboard&utm_medium=text&utm_campaign=social_sharing"
  2. Press y to open lyrics and confirm the active line auto-scrolls and highlights in time with the song.
  3. Seek forward mid-track and confirm the highlighted line follows the new position.

Checklist

  • make check passes
  • docs/ and site/index.html updated for user-facing changes

Summary by CodeRabbit

  • New Features
    • Synchronized lyrics now work for YouTube and yt-dlp tracks with known, finite durations.
  • Bug Fixes
    • Improved gapless playback transitions to prevent race conditions when switching to preloaded tracks.
    • Retired audio pipelines are closed safely without interrupting playback.
    • Live streams and tracks without a known duration continue using manual lyric scrolling.
  • Documentation
    • Clarified lyric synchronization and manual-scrolling behavior for YouTube, live radio, and plain lyrics.

Ivyson and others added 5 commits July 27, 2026 00:04
Fetches first 20 tracks from YT music when list=URL is parsed and
plays,remaining tracks are fetched in the background and added in
batches of 20.
Added the --expand-playlist/--no-expand-playlist CLI flags and the
expand_playlist key in the configs. This is switched on by default
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR serializes gapless pipeline swaps, adds regression coverage for track selection races, enables lyric synchronization for finite-duration yt-dlp tracks, updates lyric documentation, and reformats the root CLI command declaration.

Changes

Playback and lyric behavior

Layer / File(s) Summary
Synchronous gapless pipeline promotion
player/gapless.go, player/player.go, player/gapless_test.go
Gapless swaps now run synchronously under the speaker lock. Player.gaplessSwap promotes the next pipeline under p.mu and closes the retired pipeline asynchronously. The regression test covers repeated track-selection races.
Duration-aware lyric synchronization
ui/model/lyrics.go, ui/model/lyrics_test.go, docs/lyrics.md
Finite-duration yt-dlp tracks can use synchronized lyrics. Durationless live streams remain unsyncable. Tests and documentation cover synchronized and manually scrolled lyric modes.
Root command declaration formatting
commands.go
The root CLI command fields use aligned formatting without value changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • bjarneo/cliamp#274: Related embedded-lyrics support and synced-versus-manual scrolling behavior.

Suggested reviewers: bjarneo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: enabling auto-synced lyrics for yt-dlp-supported platforms.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/lyrics.md`:
- Line 7: Update the “Synced lyrics” documentation text to hyphenate “auto
scroll” as “auto-scroll,” preserving the surrounding wording and behavior
description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5d392513-4113-4efc-b753-03a74fc02a01

📥 Commits

Reviewing files that changed from the base of the PR and between 164f5f8 and 33b25af.

📒 Files selected for processing (7)
  • commands.go
  • docs/lyrics.md
  • player/gapless.go
  • player/gapless_test.go
  • player/player.go
  • ui/model/lyrics.go
  • ui/model/lyrics_test.go

Comment thread docs/lyrics.md

- **Synced lyrics**: for local files and Navidrome tracks, lyrics auto scroll and highlight the active line in time with playback.
- **Scroll mode**: for streams and plain lyrics without timestamps, use `j`/`k` or arrow keys to scroll manually.
- **Synced lyrics**: for local files, Navidrome tracks, and YouTube/yt-dlp tracks with a known duration, lyrics auto scroll and highlight the active line in time with playback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Hyphenate "auto scroll".

Use "auto-scroll" as a compound adjective/verb before "and highlight."

✏️ Proposed fix
-- **Synced lyrics**: for local files, Navidrome tracks, and YouTube/yt-dlp tracks with a known duration, lyrics auto scroll and highlight the active line in time with playback.
+- **Synced lyrics**: for local files, Navidrome tracks, and YouTube/yt-dlp tracks with a known duration, lyrics auto-scroll and highlight the active line in time with playback.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Synced lyrics**: for local files, Navidrome tracks, and YouTube/yt-dlp tracks with a known duration, lyrics auto scroll and highlight the active line in time with playback.
- **Synced lyrics**: for local files, Navidrome tracks, and YouTube/yt-dlp tracks with a known duration, lyrics auto-scroll and highlight the active line in time with playback.
🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Use a hyphen to join words.
Context: ...racks with a known duration, lyrics auto scroll and highlight the active line in ...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/lyrics.md` at line 7, Update the “Synced lyrics” documentation text to
hyphenate “auto scroll” as “auto-scroll,” preserving the surrounding wording and
behavior description.

Source: Linters/SAST tools

@Ivyson
Ivyson marked this pull request as draft August 8, 2026 08:38
@Ivyson Ivyson closed this Aug 8, 2026
@bjarneo

bjarneo commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Didn't it work as expected?

@Ivyson

Ivyson commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

The update works ( at least on my machine), I closed the pr because I figured it has two changes in it, the Lyrics update + The race condition for track handing over. I wanted to make two separate PRs so that they can be reviewed properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants