Skip to content

refactor: split runtime out of main.rs and fix native playback metadata (#218)#237

Merged
LargeModGames merged 1 commit into
mainfrom
refactor-main-rs-fix-218
May 5, 2026
Merged

refactor: split runtime out of main.rs and fix native playback metadata (#218)#237
LargeModGames merged 1 commit into
mainfrom
refactor-main-rs-fix-218

Conversation

@LargeModGames
Copy link
Copy Markdown
Owner

This pull request refactors the codebase to modularize runtime and playback integration logic, improves the handling of native streaming metadata freshness, and updates module paths after the runtime split. It also centralizes playback metadata extraction for integrations and adds thorough tests for playback snapshotting and metadata authority. The most important changes are as follows:

Native streaming metadata freshness and playback integration

  • Ensured native player track metadata remains authoritative while Spotify's playback API is catching up, preventing stale API responses from overwriting the current native track and suppressing duplicate song-count, lyrics, and saved-track checks for stale items (src/infra/network/playback.rs, src/infra/media_metadata.rs). [1] [2] [3] [4] [5] [6]
  • Centralized playback snapshot construction for Discord RPC, MPRIS, and macOS media integrations, ensuring consistent metadata resolution between native streaming and the Spotify API (src/infra/media_metadata.rs). [1] [2]

Runtime and module refactoring

  • Split the monolithic main.rs into focused core, infra, and tui modules, moving authentication, runtime startup, TUI runner, native player event handling, and playback metadata extraction to their respective modules. Updated imports and module paths throughout the codebase to reflect this structure (src/core/mod.rs, src/infra/mod.rs, src/core/app.rs, src/core/user_config.rs, src/cli/util.rs, src/infra/player/mod.rs). [1] [2] [3] [4] [5] [6] [7] [8] [9]

Testing and internal improvements

  • Added comprehensive tests for playback snapshotting, native/Spotify metadata authority, and API/native synchronization logic (src/infra/media_metadata.rs, src/infra/network/playback.rs). [1] [2] [3]
  • Cleaned up module paths and updated usage to match the new structure after the runtime split (src/core/app.rs, src/core/user_config.rs, src/cli/util.rs). [1] [2] [3] [4] [5] [6]

Please let me know if you have questions about how the new playback metadata authority logic works or how to use the new module structure!

@LargeModGames LargeModGames merged commit b2e49fa into main May 5, 2026
9 checks passed
@LargeModGames LargeModGames deleted the refactor-main-rs-fix-218 branch May 5, 2026 21:15
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.

1 participant