Add live progress reporting during library scans: - Pre-walk count: fast WalkDir to count audio files upfront for percentage calculation (~1-2s overhead) - Progress ticker: emits ScanProgress events every 300ms with phase, file counts (added/skipped/updated), and total - Phase labels: counting → scanning → thumbnails → orphans - Frontend: progress bar with percentage, file counts breakdown, and phase indicator in both config-page and library-manager Replaces the static 'Scanning...' text with a live progress bar showing e.g. '62% — Scanning... 1,247 / 2,013 files (891 new, 356 skipped)'
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
// Package events contains centralized event name constants for
|
|
// Wails frontend/backend communication. These names must match
|
|
// the corresponding event names in the TypeScript frontend.
|
|
package events
|
|
|
|
//go:generate go run ./cmd/genevents -source events.go -output ../../frontend/src/events.ts
|
|
|
|
// Playback events (backend → frontend push).
|
|
const (
|
|
PlaybackStateChanged = "PlaybackStateChanged"
|
|
PlaybackFinished = "PlaybackFinished"
|
|
TrackChanged = "TrackChanged"
|
|
SeekFailed = "SeekFailed"
|
|
VolumeChanged = "VolumeChanged"
|
|
)
|
|
|
|
// Queue events (backend → frontend push).
|
|
const (
|
|
QueueChanged = "QueueChanged"
|
|
QueueIndexChanged = "QueueIndexChanged"
|
|
QueueModeChanged = "QueueModeChanged"
|
|
QueueTracksModified = "QueueTracksModified"
|
|
)
|
|
|
|
// Config events.
|
|
const (
|
|
LibraryConfigChanged = "LibraryConfigChanged"
|
|
ThemeConfigChanged = "ThemeConfigChanged"
|
|
TrackListConfigChanged = "TrackListConfigChanged"
|
|
FavoritesConfigChanged = "FavoritesConfigChanged"
|
|
)
|
|
|
|
// Playlist events.
|
|
const (
|
|
PlaylistCreated = "PlaylistCreated"
|
|
PlaylistDeleted = "PlaylistDeleted"
|
|
PlaylistRenamed = "PlaylistRenamed"
|
|
PlaylistTracksChanged = "PlaylistTracksChanged"
|
|
PlaylistsRestored = "PlaylistsRestored"
|
|
DefaultPlaylistChanged = "DefaultPlaylistChanged"
|
|
)
|
|
|
|
// Library events.
|
|
const (
|
|
LibraryScanStarted = "LibraryScanStarted"
|
|
LibraryScanProgress = "LibraryScanProgress"
|
|
LibraryScanComplete = "LibraryScanComplete"
|
|
)
|