Files
yellowjacket/frontend/src/events.ts
T
yonluandClaude Opus 5 dc890d1fcc feat(library): remove a track from the library without deleting the file
RemoveFromLibrary deletes the audio_files rows the way the scan's own
orphan cleanup does and records each path in excluded_paths. The
exclusion is not an enhancement: without it the next scan finds the
file, sees no row and imports it again, so the button undoes itself.

The soft scan compares files on disk against rows in the database, so
surveyAudioFiles and countAudioFiles both take the exclusion set —
otherwise an excluded path makes the two disagree forever and queues a
full scan on every launch. Deleting a row cascades to queue_tracks, so
the removal calls the same CompactQueue hook RemoveLibrary does.

Also lands the requested badge: library-status-indicator is a button
again where it can act, utils/library-status.ts states once what owning
and wanting mean, and the long-declared queued state finally has a
producer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDCbcCZQepnpSQYJ6SxxZm
2026-08-14 13:12:01 -04:00

112 lines
4.6 KiB
TypeScript

// Code generated by genevents from backend/events/events.go. DO NOT EDIT.
export const Events = {
// Playback events (backend → frontend push)
PlaybackStateChanged: "PlaybackStateChanged",
PlaybackFinished: "PlaybackFinished",
TrackChanged: "TrackChanged",
SeekFailed: "SeekFailed",
VolumeChanged: "VolumeChanged",
MuteChanged: "MuteChanged",
PlaybackPositionChanged: "PlaybackPositionChanged",
PlaybackFailed: "PlaybackFailed",
// Queue events (backend → frontend push)
QueueChanged: "QueueChanged",
QueueIndexChanged: "QueueIndexChanged",
QueueModeChanged: "QueueModeChanged",
QueueTracksModified: "QueueTracksModified",
// Config events
LibraryConfigChanged: "LibraryConfigChanged",
ThemeConfigChanged: "ThemeConfigChanged",
GeneralConfigChanged: "GeneralConfigChanged",
TrackListConfigChanged: "TrackListConfigChanged",
FavoritesConfigChanged: "FavoritesConfigChanged",
ShortcutsConfigChanged: "ShortcutsConfigChanged",
// Playlist events
PlaylistCreated: "PlaylistCreated",
PlaylistDeleted: "PlaylistDeleted",
PlaylistRenamed: "PlaylistRenamed",
PlaylistTracksChanged: "PlaylistTracksChanged",
PlaylistsRestored: "PlaylistsRestored",
DefaultPlaylistChanged: "DefaultPlaylistChanged",
// Library events
LibraryScanStarted: "LibraryScanStarted",
LibraryScanProgress: "LibraryScanProgress",
LibraryScanComplete: "LibraryScanComplete",
// Scan control events
LibraryScanCancelled: "LibraryScanCancelled",
LibraryScanPaused: "LibraryScanPaused",
LibraryScanResumed: "LibraryScanResumed",
// Scan queue events
LibraryScanQueued: "LibraryScanQueued",
LibraryScanQueueDrained: "LibraryScanQueueDrained",
// Library CRUD events
LibraryAdded: "LibraryAdded",
LibraryRenamed: "LibraryRenamed",
LibraryRemoved: "LibraryRemoved",
// Tag writing events.
//
// TrackMetadataChanged means "tags on disk were rewritten", and the
// frontend answers it by throwing the whole library cache away and
// refetching — which is correct, because a retag can change an album
// name, an artist, a genre, and therefore every derived collection.
//
// It must therefore not be reused for anything cheaper. Finishing a
// track used to emit it, so every song cost a full refetch: ~37 MB
// across the IPC per track at 50 000 tracks, and the user's track
// selection cleared while music played (audit perf.C1/C2). That is
// what TrackPlayCountChanged below exists to separate
TrackMetadataChanged: "TrackMetadataChanged",
BatchWriteProgress: "BatchWriteProgress",
// Track removal events.
//
// TracksRemovedFromLibrary means "these rows are gone and these paths
// will not be imported again", and like TrackPlayCountChanged it
// carries everything a consumer needs to patch rather than invalidate:
// {filePaths: []string, count: int}. The library store splices those
// paths out of its tracks array — which is the expensive collection —
// and refetches only the album/artist/genre summaries, whose counts
// really did change
TracksRemovedFromLibrary: "TracksRemovedFromLibrary",
// Play statistics events.
//
// TrackPlayCountChanged carries everything needed to patch the one
// track in place, precisely so no consumer has any reason to invalidate
// a collection: {audioFileId, filePath, playCount, lastPlayed}
TrackPlayCountChanged: "TrackPlayCountChanged",
// Autotag apply events — emitted while an async ApplyAsync job is in flight so the review UI can render per-folder progress
AutotagApplyStarted: "AutotagApplyStarted",
AutotagApplyProgress: "AutotagApplyProgress",
AutotagApplyFinished: "AutotagApplyFinished",
// Autotag prefetch events — emitted by the background worker that scores pending tagging items so sidebar pills populate without the user having to open each folder
AutotagPrefetchProgress: "AutotagPrefetchProgress",
AutotagPrefetchFinished: "AutotagPrefetchFinished",
// Background job events
JobsChanged: "JobsChanged",
// Explore / search index events
IndexStatusChanged: "IndexStatusChanged",
ArtistDiscographyReady: "ArtistDiscographyReady",
ArtistSimilarReady: "ArtistSimilarReady",
AlbumReleasesReady: "AlbumReleasesReady",
AlbumReleasesFailed: "AlbumReleasesFailed",
DownloadProvidersChanged: "DownloadProvidersChanged",
DownloadsChanged: "DownloadsChanged",
RequestsChanged: "RequestsChanged",
} as const;
export type EventName = (typeof Events)[keyof typeof Events];