Music library
The music library turns audio files into a searchable set of songs, albums, artists, genres, roles, and related artwork. It stores this information in the music database so browsing and playback do not depend on reading every file again. Scans refresh the records from local sources and can add information from online providers. See Media libraries for the shared library model and Video library for the related video system.
Library model
Music entities
The library represents a recording at three main levels: a song belongs to an album, and songs and albums link to artists. A song keeps playback facts and tag data. An album groups tracks and adds release-level data. An artist provides identity and artist-level information. Artist credits preserve more than one artist and can also describe contributors such as composers or conductors. Song.h, Album.h, Artist.h
Music items use release types such as albums, singles, and audiobooks. This type helps the browser and database distinguish audio collections without changing the core song, album, and artist relationships. Audiobooks can also contain chapter ranges that become separate playable library items. AudioType.h, MusicDatabase.cpp
Tags can carry names, album and track data, genres, dates, ratings, play history, technical audio data, lyrics, cue data, MusicBrainz identifiers, and artwork facts. The music tag is the common in-memory form used when a file is read, when a database item is shown, and when data is passed to other services. MusicInfoTag.h
Artist credits keep the identity of each credited artist separate from the display text. This lets the library retain several artists and contributor roles without losing the text that users see. Album matching can use tagged MusicBrainz identities first and names when an identity is not available. Album.cpp, MusicInfoTag.cpp
Album and artist records can also receive information from an online source. Tag-derived MusicBrainz identities remain the trusted base for a match, while scraped details can fill missing identity data and add descriptions, artwork, and related links. Album.cpp, Artist.cpp
References: xbmc/…/Song.h• L51-214 xbmc/…/Album.h• L35-182 xbmc/…/Artist.h• L41-130 xbmc/…/AudioType.h• L15-50 xbmc/…/MusicInfoTag.h• L27-95 xbmc/…/MusicInfoTag.cpp• L796-911 xbmc/…/Album.cpp• L55-203 xbmc/…/Album.cpp• L205-333 xbmc/…/Artist.cpp• L21-68 xbmc/…/MusicDatabase.cpp• L804-884
Entity records
Album and artist details can be saved to and loaded from XML detail records. These records carry identity, release or biography data, artwork choices, discography entries, and music-video links so library details can move between scans, database views, and saved metadata. Older record forms remain readable while new top-level records use a version marker. Album.cpp, Artist.cpp
Focused music tests protect this record contract through save-load round trips. They also check that old artist and album forms keep their key details when they are read and written again. The tests protect the rule that saved top-level records carry version zero and that copied genre values can be trimmed without changing the caller's input. TestMusicInfoTag.cpp
References: xbmc/…/Album.cpp• L448-640 xbmc/…/Artist.cpp• L71-257 xbmc/…/TestMusicInfoTag.cpp• L20-94
Tags and identities
Tag loaders read audio metadata into a music tag. The loader factory selects a format-specific reader for the file, while the scanner uses the same contract for local library updates. MPEG-1 Layer II files with the .mp2 extension use the same MPEG reader as related MPEG audio files, so their ID3 metadata can enter the library. MusicBrainz IDs can strengthen entity matching when names are not enough. ImusicInfoTagLoader.h, MusicInfoTagLoaderFactory.h, MusicInfoTagLoaderFactory.cpp, TagLoaderTagLib.cpp, MusicInfoScanner.cpp
The scanner groups tagged files into albums. A tagged album ID takes priority. Without one, the grouping uses the album name and album artist, with the primary song artist as a fallback. It also recognizes compilation patterns and keeps artist credits for later database links. MusicInfoScanner.cpp
The same tag model serves file views, library views, and cached directory listings. Library items can load their song, album, and artist data from the database. File items can reuse cached tags or read the source file when no library record is available. Additional tag reads are limited when the database already supplies the needed item data. MusicInfoLoader.cpp, MusicInfoLoader.cpp
Music classification keeps audio, audiobooks, cue sheets, lyrics, and database items distinct from video, game, and picture items. It can use a file extension, a MIME type, or an existing music tag. An MKV is treated as an audiobook only when its item already has music metadata. TestMusicFileItemClassify.cpp, TestMusicFileItemClassify.cpp, TestMusicFileItemClassify.cpp
The database tracks the tag-processing version used to build its records. A forced tag scan can therefore re-read unchanged files when tag handling has gained fields or changed its rules. MusicDatabase.cpp, MusicInfoScanner.cpp
Matroska music files can provide album data, song data, and audiobook chapter ranges through either TagLib or FFmpeg. TagLib preserves the full chapter and edition structure when the supported version is available. FFmpeg remains a fallback that keeps the shared tag shape but can lose repeated values or some edition details, so builds with the fallback may expose less metadata. MatroskaTagReader.cpp, MatroskaTagReader.cpp, TagLibVersion.h
Remote Matroska reads use the virtual file system through a buffered, read-only stream. The buffering and delayed seek behavior reduce network round trips while the reader inspects small container headers. MatroskaTagLibStream.h, MatroskaTagLibStream.h
The reader keeps chapter order and time ranges stable between the two paths where possible. The shared caller decides whether a chapter is long enough to become a playable track, while tests pin known differences in fallback metadata and malformed chapter data. MatroskaTagReader.cpp, TestMatroskaTagReaderFFmpeg.cpp
References: xbmc/…/ImusicInfoTagLoader.h• L15-25 xbmc/…/MusicInfoTagLoaderFactory.h• L15-24 xbmc/…/MusicInfoTagLoaderFactory.cpp• L37-78 xbmc/…/TagLoaderTagLib.cpp• L1299-1326 xbmc/…/MusicInfoScanner.cpp• L587-643 xbmc/…/MusicInfoScanner.cpp• L650-918 xbmc/…/MusicInfoLoader.cpp• L94-167 xbmc/…/MusicInfoLoader.cpp• L169-282 xbmc/…/MusicDatabase.cpp• L9417-9484 xbmc/…/TestMusicFileItemClassify.cpp• L45-247 xbmc/…/MatroskaTagReader.cpp• L118-174 xbmc/…/MatroskaTagReader.cpp• L487-595 xbmc/…/MatroskaTagLibStream.h• L30-49 xbmc/…/MatroskaTagLibStream.h• L173-179 xbmc/…/TagLibVersion.h• L23-45 xbmc/…/TestMatroskaTagReaderFFmpeg.cpp• L24-31 xbmc/…/TestMatroskaTagReaderFFmpeg.cpp• L112-212 xbmc/…/TestMatroskaTagReaderFFmpeg.cpp• L214-237
Library update flow
Scan lifecycle
The music scan is the path from source files to browsable library records. It checks a directory and its children, uses a path hash to skip unchanged folders, reads tags for changed files, groups the results, and writes albums with their songs and artists to the database. An optional online stage then adds album and artist information. MusicInfoScanner.cpp, MusicInfoScanner.cpp
The scan keeps existing identity and user data when it can match a file to an earlier record. This protects database IDs, play counts, ratings, and other history when a file is scanned again. Cue sheets can expand one audio file into several tracks before the grouping step. A forced rescan reads file tags again even when the folder hash and cached tag state say that the content is unchanged. MusicInfoScanner.cpp, MusicInfoScanner.cpp
The main scan runs in this order:
- Check the source path and compare its current contents with the stored path hash.
- Read supported audio tags and cue data.
- Build song, album, and artist relationships.
- Assign local artwork and store the library records.
- Optionally fetch extra album and artist data online.
- Clean records that no longer have matching files and refresh active views.
This diagram shows how local file data becomes library content and then reaches the browser.
flowchart LR
A[Music source] --> B[Path change check]
B --> C[Read tags and cue data]
C --> D[Group songs into albums and artists]
D --> E[Store music database records]
E --> F[Load local artwork]
E --> G[Fetch optional online information]
F --> H[Music browser]
G --> H
References: xbmc/…/MusicInfoScanner.cpp• L116-203 xbmc/…/MusicInfoScanner.cpp• L485-585 xbmc/…/MusicInfoScanner.cpp• L587-643 xbmc/…/MusicInfoScanner.cpp• L666-695 xbmc/…/MusicInfoScanner.cpp• L920-939 xbmc/…/MusicInfoScanner.cpp• L1106-1202
Metadata enrichment
Metadata enrichment adds information that local tags do not provide. Album and artist scans can run for one item or a selected library view. A refresh clears the prior scraped time so the provider can be queried again. MusicInfoScanner.cpp, MusicInfoScanner.cpp
During a normal online scan, the system adds albums first and then uses the artist identities found in the database to improve artist matches. This order matters because one well-tagged file can supply an identity that helps match other albums by the same artist. MusicInfoScanner.cpp
Interactive information lookup uses the same provider model for album and artist items. It first returns possible matches for a name, then loads the selected album or artist details over HTTP. The lookup reports success and supports cancellation so the music window can use it without treating a partial request as finished metadata. MusicInfoScraper.h, MusicInfoScraper.cpp, MusicAlbumInfo.cpp, MusicArtistInfo.cpp
The music information dialog uses this flow for album and artist details. It loads the full database record before showing the dialog, includes the related songs or artist discography, and can refresh the provider data with a progress view. Changes to artwork and album user ratings are written back and sent to active music views. GUIDialogMusicInfo.cpp, GUIDialogMusicInfo.cpp, GUIDialogMusicInfo.cpp
Song information follows a separate path because songs are not scraped as entities. It loads the song tag, adds album and artist properties, loads related artwork, and lets the user update artwork or the user rating. GUIDialogSongInfo.cpp, GUIDialogSongInfo.cpp, GUIDialogSongInfo.cpp
References: xbmc/…/MusicInfoScanner.cpp• L920-939 xbmc/…/MusicInfoScanner.cpp• L1005-1104 xbmc/…/MusicInfoScraper.h• L24-80 xbmc/…/MusicInfoScraper.cpp• L54-138 xbmc/…/GUIDialogMusicInfo.cpp• L76-180 xbmc/…/GUIDialogMusicInfo.cpp• L210-328 xbmc/…/GUIDialogMusicInfo.cpp• L615-681 xbmc/…/GUIDialogSongInfo.cpp• L53-114 xbmc/…/GUIDialogSongInfo.cpp• L292-315
Library queues
The music library queue is the single entry point for long-running library work. It serializes scans, cleaning, imports, and exports at low priority. Callers can show progress, stop scans, cancel jobs, and refresh the browser after a successful job. MusicLibraryQueue.h, MusicLibraryQueue.cpp
The queue runs one job at a time and tracks queued work by job type. A normal scan can add online lookup and background flags from settings. Targeted album or artist work uses a separate scan mode, while the same queue also handles cleaning and library import or export. MusicLibraryQueue.h, MusicLibraryQueue.cpp, MusicLibraryQueue.cpp
When work ends, the queue clears the music directory cache and tells active windows to update. Successful work refreshes views when the queue becomes empty, so a user does not see an intermediate state while more library jobs remain queued. The scan control acts as a stop action when scanning or cleaning is active. MusicLibraryQueue.cpp, MusicLibraryQueue.cpp, GUIWindowMusicBase.cpp
References: xbmc/…/MusicLibraryQueue.h• L22-120 xbmc/…/MusicLibraryQueue.cpp• L31-157 xbmc/…/MusicLibraryQueue.cpp• L179-193 xbmc/…/MusicLibraryQueue.cpp• L219-315 xbmc/…/GUIWindowMusicBase.cpp• L427-439
Persistence and artwork
Music database
The music database is the durable store for songs, albums, artists, genres, roles, paths, sources, relationships, scraped information, and artwork links. It gives the browser stable IDs and queryable relationships instead of making each view re-read every audio file. MusicDatabase.h, MusicDatabase.cpp
The database keeps many-to-many links for album artists, song artists, song genres, album sources, and artist roles. It also stores a path hash for scan decisions and uses cleanup relationships so deleting an entity removes its dependent links and artwork records. MusicDatabase.cpp, MusicDatabase.cpp
Artist discography views reconcile provider-listed releases with albums already in the library. They match the strongest release-group identity first, then use the artist, title, and year before returning unmatched entries as well. The query removes temporary state on success, empty results, errors, and before a later query can reuse it. MusicDatabase.cpp, TestMusicDatabase.cpp
Database updates preserve the relationship between a song and its album while they update nested artist, genre, contributor, and artwork data. Album duration and disc information are derived from the songs that belong to the album. Audiobook records also keep a resume bookmark so playback can return to the relevant chapter. Database commits refresh the music-present state when a GUI exists. MusicDatabase.cpp, MusicDatabase.cpp, MusicDatabase.h, MusicDatabase.cpp, MusicDatabase.cpp
References: xbmc/…/MusicDatabase.h• L81-106 xbmc/…/MusicDatabase.h• L346-356 xbmc/…/MusicDatabase.cpp• L162-279 xbmc/…/MusicDatabase.cpp• L229-274 xbmc/…/MusicDatabase.cpp• L835-951 xbmc/…/MusicDatabase.cpp• L955-1049 xbmc/…/MusicDatabase.cpp• L2398-2525 xbmc/…/MusicDatabase.cpp• L11543-11555 xbmc/…/MusicDatabase.cpp• L13816-13844 xbmc/…/TestMusicDatabase.cpp• L37-90
Artwork loading
Artwork comes from local folder images, embedded file art, cached images, and optional remote provider results. The scanner first uses shared folder or embedded art where possible. Later artwork work fills missing album and artist art and stores the selected art in the database and image cache. MusicInfoScanner.h, MusicInfoScanner.cpp
Audio files can expose a cover through an attached picture stream. The FFmpeg cover reader records the cover type in the music tag and can pass the image to the artwork path without parsing the full audio stream. MusicEmbeddedCoverLoaderFFmpeg.cpp, MusicEmbeddedCoverLoaderFFmpeg.cpp
The artwork loader resolves art for library items by entity type. A song can inherit album and artist art, while an album can expose its artist art and an artist can expose its own art. User thumbs and cached images take part in the fallback path for file and folder views. MusicThumbLoader.h, MusicThumbLoader.cpp, MusicThumbLoader.cpp
The information dialog lets an allowed user choose a current image, remote image, local image, or no image for an album or artist. The song dialog supports current, local, or no song art. The change is saved in the database and related song art is cleared so the next load can use the new album or artist fallback. GUIDialogMusicInfo.cpp, GUIDialogSongInfo.cpp, MusicUtils.cpp
References: xbmc/…/MusicInfoScanner.h• L98-240 xbmc/…/MusicInfoScanner.cpp• L1117-1202 xbmc/…/MusicEmbeddedCoverLoaderFFmpeg.cpp• L23-53 xbmc/…/MusicEmbeddedCoverLoaderFFmpeg.cpp• L70-132 xbmc/…/MusicThumbLoader.h• L19-58 xbmc/…/MusicThumbLoader.cpp• L50-157 xbmc/…/MusicThumbLoader.cpp• L159-383 xbmc/…/GUIDialogMusicInfo.cpp• L763-965 xbmc/…/GUIDialogSongInfo.cpp• L341-490 xbmc/…/MusicUtils.cpp• L68-183
Browsing behavior
Music database navigation
The musicdb:// browser exposes database-backed views for artists, albums, songs, singles, genres, roles, years, sources, compilations, box sets, recently added or played albums, and top lists. Directory nodes translate a view path into a database query and return items with labels, content types, and library identity. MusicDatabaseDirectory.h, MusicDatabaseDirectory.cpp, GUIWindowMusicNav.cpp
The library uses named musicdb:// paths as the shared contract for these views. CMusicDbUrl checks that a path names a valid music node, maps its directory and child nodes to content types, and carries IDs and filters into database queries. The same path names are used when the database creates items, when the scanner requests album or artist views, when the loader creates song links, and when navigation maps start folders and context actions. MusicDbUrl.cpp, MusicDbPaths.h, MusicDatabase.cpp, MusicInfoLoader.cpp, MusicInfoScanner.cpp, GUIWindowMusicNav.cpp
Named music start folders resolve to these library nodes. The navigation tests protect that each supported name opens the expected musicdb:// location. GUIWindowMusicNav.cpp, TestGUIWindowMusicNav.cpp
The music view state assigns sort choices and display fields to each kind of library view. Users can keep different view and sort choices for artists, albums, songs, playlists, and searches. Album and song views can sort by track details, date, play history, rating, user rating, BPM, and other music fields. GUIViewStateMusic.cpp, GUIViewStateMusic.cpp, GUIViewStateMusic.cpp
The browser can show discs between albums and songs when the album has more than one meaningful disc. Otherwise it flattens that level so a user reaches the tracks directly. File browsing remains separate from library browsing: a file directory reads music tags from the source, while a database directory reads the persistent library view. MusicDatabaseDirectory.cpp, MusicFileDirectory.h, GUIWindowMusicNav.cpp
The common music window prepares file views before display. It loads tags when needed, expands cue documents into track items, fills thumbnails, and adds inherited album or artist artwork to directory items. Library views skip the file-tag pass because their items already come from the database. Audiobook selection can offer play or resume and starts at the chapter that contains the saved bookmark. GUIWindowMusicBase.cpp, GUIWindowMusicBase.cpp, GUIWindowMusicBase.cpp
References: xbmc/…/MusicDatabaseDirectory.h• L16-43 xbmc/…/MusicDatabaseDirectory.cpp• L36-100 xbmc/…/MusicDbUrl.cpp• L31-175 xbmc/…/MusicDbPaths.h• L11-34 xbmc/…/MusicDatabase.cpp• L3580-4280 xbmc/…/MusicInfoLoader.cpp• L247-263 xbmc/…/MusicInfoScanner.cpp• L333-415 xbmc/…/GUIViewStateMusic.cpp• L90-392 xbmc/…/GUIViewStateMusic.cpp• L420-585 xbmc/…/MusicFileDirectory.h• L14-32 xbmc/…/GUIWindowMusicNav.cpp• L388-480 xbmc/…/GUIWindowMusicBase.cpp• L347-391 xbmc/…/GUIWindowMusicBase.cpp• L742-850 xbmc/…/GUIWindowMusicBase.cpp• L930-966 xbmc/…/TestGUIWindowMusicNav.cpp• L25-40
Search and playlists
Music search uses a dedicated musicsearch:// view. The navigation window updates that view as the search text changes and keeps the search source available at the music root when the skin needs it. GUIWindowMusicNav.cpp
Playlists can act as song lists or as folders based on the playlist setting. When a playlist is opened as a list, its entries are loaded and treated as music items so the normal music playback and browsing rules still apply. The playlist editor can browse music files, library items, and music videos as sources. It can add items, remove or reorder them, and load or save playlist files. GUIWindowMusicNav.cpp, GUIWindowMusicNav.cpp, GUIWindowMusicPlaylistEditor.cpp, GUIWindowMusicPlaylistEditor.cpp
Music playback and queue actions expand a selected folder or playlist into music items. The resulting items keep the view's order when possible, avoid duplicate cue tracks, and can start playback or add to the current music playlist. Database folders are resolved through their musicdb:// path so a category can expand to its playable items rather than play the category itself. MusicUtils.cpp, MusicUtils.cpp
References: xbmc/…/GUIWindowMusicNav.cpp• L345-371 xbmc/…/GUIWindowMusicNav.cpp• L860-959 xbmc/…/GUIWindowMusicPlaylistEditor.cpp• L183-225 xbmc/…/GUIWindowMusicPlaylistEditor.cpp• L290-417 xbmc/…/MusicUtils.cpp• L518-627 xbmc/…/MusicUtils.cpp• L665-679
Context-menu actions
The music navigation context menu changes with the item and the current view. Source folders can start a library scan. Album and artist views can request information for one item or for the current set. Users can also set or clear the default music view and manage files or playlists when the profile permits it. GUIWindowMusicNav.cpp
Shared music actions expose information, browse, play, play using a selected player, play next, and queue item behavior. Visibility depends on the item's music type, whether it can be played or queued, the active window, and links from a video-library item to a music artist or album. Browse actions keep the current music window when possible and otherwise open the music navigation window. ContextMenus.h, ContextMenus.cpp, ContextMenus.cpp
Music items can connect to the video library. If a matching music video exists, the menu can open the related artist or play the matching video. Music-video artist and album paths can also map back to the corresponding music-library entity. GUIWindowMusicNav.cpp, GUIWindowMusicNav.cpp
The update-library action starts a full scan when no scan is active and stops the current scan otherwise. The common music window also exposes queue, information, playlist editing, CDDB lookup, CD ripping, source removal, and file actions. Permissions and the current view limit which actions appear, so a file view and a database view do not expose the same menu. GUIWindowMusicNav.cpp, GUIWindowMusicBase.cpp
Optical-disc actions depend on a current audio-disc state. The navigation and base windows offer track or full-disc ripping only for audio-capable discs, and CDDB lookup only when the user can write to the database. This keeps a changing drive state from becoming a menu action or playback failure. GUIWindowMusicNav.cpp, GUIWindowMusicBase.cpp
References: xbmc/…/ContextMenus.h• L21-87 xbmc/…/ContextMenus.cpp• L31-87 xbmc/…/ContextMenus.cpp• L89-204 xbmc/…/GUIWindowMusicNav.cpp• L180-191 xbmc/…/GUIWindowMusicNav.cpp• L591-730 xbmc/…/GUIWindowMusicNav.cpp• L751-787 xbmc/…/GUIWindowMusicBase.cpp• L442-581 xbmc/…/GUIWindowMusicBase.cpp• L475-493
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to tag fields or artist-credit rules must stay aligned between tag loading, album grouping, database links, and the music item shown in the browser.
- Changes to album or artist XML records must preserve version markers, legacy fields, artwork order, and save-load compatibility.
- Changes to supported audio extensions or audio type names must update classifier expectations, loader selection, database release types, and the format reader dispatch so a file can move from source scan to usable metadata.
- Changes to audiobook chapter or resume behavior must preserve the link between chapter offsets, stored bookmarks, selection behavior, and playback start positions.
- Changes to tag processing must update the tag-scan version contract so unchanged files can be forced through the new rules when needed.
- Changes to Matroska reader selection, tag-level mapping, chapter ranges, or edition handling must keep TagLib and FFmpeg outputs compatible with the scanner and audiobook track expansion. Changes to the TagLib version floor must also preserve the safe fallback path.
- Changes to path hashing or rescan rules must preserve the link between changed files, removed songs, cleanup, and retained play history.
- Changes to artwork names or fallback order must cover scanner assignment, database art records, embedded-cover detection, cache loading, and the inherited art names used by songs and albums.
- Changes to
musicdb://node types or canonical paths must update URL content mapping, filter validation, directory labels, flattening rules, view-state sorting, start-folder mappings, and context-menu conditions. - Changes to queue job types or completion behavior must preserve cancellation, progress reporting, cache invalidation, and browser refresh messages.
- Changes to album or artist provider lookup must keep search results, selected-item loading, HTTP cancellation, and success state consistent.
- Changes to shared music context actions must keep visibility and execution rules aligned for file items, library items, playlists, and video-library links.
- Changes to music-video linking must keep artist and album identity mapping consistent between
musicdb://andvideodb://paths. - Changes to playlist expansion or editor behavior must preserve cue-track expansion, item order, duplicate handling, and playlist-file load and save paths.
- Changes to artwork or user-rating updates must preserve refresh messages for the current view, queued songs, and the currently playing song.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A source path is offline during a clean scan | Existing songs under that path can be removed because the scan cannot distinguish an unavailable source from missing files | Keep source availability and clean mode as one contract. MusicInfoScanner.cpp |
| A changed file has no usable tag and no cue document | The file is not added to the library | Keep tag loading, forced rescan behavior, and cue handling aligned with scanner acceptance rules. MusicInfoScanner.cpp |
| Tag processing changes without a required tag rescan | Existing records keep old fields or relationships even though the current reader can supply new data | Update the stored tag-scan requirement and force unchanged files through tag loading when needed. MusicDatabase.cpp, MusicInfoScanner.cpp |
| A Matroska build uses the FFmpeg fallback for a file that needs repeated tags or exact edition data | The library can lose repeated values, miss chapters without usable UIDs, or expose a chapter from another edition | Keep the TagLib version floor and fallback expectations explicit. Treat the shared chapter shape as the contract and preserve the known fallback limits. TagLibVersion.h, TestMatroskaTagReaderFFmpeg.cpp |
| A Matroska chapter has no usable end time or is shorter than the track threshold | Audiobook expansion can omit the chapter or leave a file without playable chapter items | Keep end-time completion and the shared one-second track rule aligned between the reader and its caller. MatroskaTagReader.cpp, TestMatroskaTagReaderFFmpeg.cpp |
| Artist names and identity hints do not match the number of tagged artist IDs | Album artist credits can lose names or link the wrong display name to an identity | Keep the credit repair and fallback rules aligned with the tag fields used by the scanner. Album.cpp |
| A scan stops before its final commit and cleanup path | Removed records or browser state can remain out of date | Use the queue cancellation path and let the scanner finish its stop handling before treating the update as complete. MusicInfoScanner.cpp |
| A database item has no resolved art | The browser falls back to embedded, user, folder, or cached art. Artist items have no generic fallback in the music loader | Keep library art lookup and file-art fallback distinct. MusicThumbLoader.cpp |
| An attached picture stream uses an unsupported image type | Embedded cover art is not available through the music tag | Keep supported attached-picture formats aligned with the embedded-cover reader and its tag output. MusicEmbeddedCoverLoaderFFmpeg.cpp |
| An audio type or audiobook tag is lost during classification | A valid audio file can be treated as another media type, or an audiobook can lose chapter and resume behavior | Keep extension, MIME, tag, and release-type classification rules aligned. TestMusicFileItemClassify.cpp, AudioType.h |
| A database navigation path is not recognized or its filter type does not match its content type | The view can open the wrong node, reject a valid filter, or lose its expected sort, layout, or context-menu behavior | Keep canonical paths, URI recognition, URL node mapping, filter validation, content mapping, start folders, and music view state aligned. MusicDbUrl.cpp, MusicDbPaths.h, TestGUIWindowMusicNav.cpp, GUIViewStateMusic.cpp |
| A shared context action is visible for an item that cannot be played, queued, or resolved to the required music type | The menu offers an action that fails or opens the wrong information dialog | Keep action visibility checks aligned with execution paths and cross-library identity properties. ContextMenus.cpp, ContextMenus.cpp |
| An information lookup is canceled after a provider request starts | The UI can mistake incomplete data for a successful album or artist result | Propagate cancellation and require the provider success state before using the result. GUIDialogMusicInfo.cpp |
| A playlist editor treats a media file as a folder click or loses its source order | The editor can play an item instead of adding it, or save a different playlist than the user built | Keep source browsing, queue expansion, editor order, and playlist-file serialization aligned. GUIWindowMusicPlaylistEditor.cpp, GUIWindowMusicPlaylistEditor.cpp |
| Artwork changes do not clear related song art | The current playlist or audio display can keep stale album or artist fallback art | Clear affected playlist items and refresh the current playing song after the database update. MusicUtils.cpp |
| The requested music-video or music-library identity cannot be matched | The info action opens the wrong media type or does nothing | Resolve the artist or album identity before converting between music and video paths. GUIWindowMusicNav.cpp |
Key files
| File | Why to read it |
|---|---|
| xbmc/…/Song.h | Defines song-level data and its links to albums, artists, tags, playback history, and contributors. |
| xbmc/…/Album.h | Defines album grouping, release types, dates, artwork, and the songs in a release. |
| xbmc/…/Album.cpp | Shows how album artist credits merge tag and provider identity, and how album detail records are saved and loaded. |
| xbmc/…/Artist.h | Defines artist identity, credits, biography data, discography, and artwork. |
| xbmc/…/Artist.cpp | Shows how scraped artist identity and detail records merge with tag-derived data. |
| xbmc/…/AudioType.h | Defines the audio release types used to distinguish albums, singles, and audiobooks. |
| xbmc/…/MusicInfoTag.h | Shows the common tag view used by files, database items, and UI metadata. |
| xbmc/…/MusicInfoTag.cpp | Shows how song and album records become common tags and how tag values support sorting and display. |
| xbmc/…/MatroskaTagReader.cpp | Explains how Matroska tags, editions, chapters, and fallback metadata become music records. |
| xbmc/…/MatroskaTagLibStream.h | Explains how Matroska metadata can be read through remote virtual-file-system sources with fewer network reads. |
| xbmc/…/TagLibVersion.h | Defines when the higher-fidelity Matroska reader is safe and when FFmpeg is used instead. |
| xbmc/…/TestMatroskaTagReaderFFmpeg.cpp | Protects fallback chapter ranges and records the expected differences from TagLib. |
| xbmc/…/MusicInfoScanner.cpp | Explains path scanning, tag reads, album grouping, artwork assignment, and metadata enrichment. |
| xbmc/…/MusicInfoLoader.cpp | Explains how file views combine cached tags, database records, and source-file reads. |
| xbmc/…/MusicDatabase.h | Defines the durable music relationships, navigation queries, artwork access, audiobook bookmarks, and tag-scan version contract. |
| xbmc/…/MusicDatabase.cpp | Shows durable music relationships, artwork records, cleanup links, discography matching, audiobook chapters, and transaction effects. |
| xbmc/…/MusicDbUrl.cpp | Shows how music database paths become typed, filtered database requests. |
| xbmc/…/MusicDbPaths.h | Names the shared database paths that connect music database queries, item links, and navigation views. |
| xbmc/…/MusicLibraryQueue.cpp | Shows how scans and other library jobs are scheduled and how views refresh. |
| xbmc/…/MusicEmbeddedCoverLoaderFFmpeg.cpp | Shows how attached picture streams become embedded music cover art. |
| xbmc/…/MusicThumbLoader.cpp | Shows how library, embedded, user, folder, and cached art reach music items. |
| xbmc/…/MusicUtils.cpp | Shows music playback and queue expansion plus asynchronous artwork and rating updates. |
| xbmc/…/MusicDatabaseDirectory.cpp | Explains how database paths become browsable music views and when disc levels are flattened. |
| xbmc/…/GUIViewStateMusic.cpp | Explains music-specific sort fields, view choices, and source behavior. |
| xbmc/…/GUIWindowMusicNav.cpp | Shows music search, playlists, scan controls, context menus, music-video links, audiobook selection, and optical-disc actions. |
| xbmc/…/GUIWindowMusicBase.cpp | Shows shared file and library browsing behavior plus scan, info, queue, playlist, audiobook, disc, and source actions. |
| xbmc/…/ContextMenus.cpp | Shows shared visibility and execution rules for music information, browse, playback, and queue actions. |
| xbmc/…/GUIDialogMusicInfo.cpp | Shows album and artist details, provider refresh, rating changes, and artwork selection. |
| xbmc/…/GUIDialogSongInfo.cpp | Shows song tag loading, related album and artist data, song artwork, and rating behavior. |
| xbmc/…/GUIWindowMusicPlaylistEditor.cpp | Shows source browsing and the editing, ordering, loading, and saving of music playlists. |
| xbmc/…/TestMusicFileItemClassify.cpp | Protects the boundary between audio, audiobooks, cue sheets, lyrics, database items, and other media types. |
| xbmc/…/TestGUIWindowMusicNav.cpp | Protects the mapping from named music start folders to library nodes. |
| xbmc/…/TestMusicInfoTag.cpp | Protects album and artist detail-record round trips, legacy record reading, and tag value trimming. |
| xbmc/…/TestMusicDatabase.cpp | Protects artist discography cleanup and database commits without a GUI. |