Databases/MyMusic

From Official Kodi Wiki
Jump to: navigation, search
Kodi Databases

See also:

Home icon grey.png   ▶ Development
▶ Userdata
▶ Databases ▶ MyMusic



1 The Music Library

This database contains all information concerning music files that has been added to the Music Library. It is used in the Music portion of Kodi.

The current stable release of Kodi is using the following version of the database:

Kodi v18 - MyMusic72.db


Warning: The databases are critical components of Kodi. We strongly urge that you do not interfere with them, unless you have knowledge and experience with database designs.



2 Views

Views are standard queries, often long or complicated queries saved in the database for convenience. The views below allow you to easily access all the information about songs and albums in the Music Library, across all the linking tables.


2.1 albumartistview

This table combines album with each album artist.

Column Name Data Type Description
idAlbum integer ID from album table
idArtist integer ID from artist table
idrole integer = 0 (fake role ID field)
strRole text = "AlbumArtist" (fake role desc field)
strArtist varchar(256) Artist name
strSortName text See: Sort Name
strMusicBrainzArtistID text Musicbrainz artist ID
iOrder integer Order artist appears in credits


2.2 albumview

A view of the album table with some additional fields aggregated from the songs of that album.

Column Name Data Type Description
idAlbum integer ID from Album Table
strAlbum varchar(256) Album Name
strMusicBrainzAlbumID text MusicBrainz album ID
strReleaseGroupMBID text The ID that groups variations of the same release
strArtists text Album artist(s) description (not always a concatenation of names)
strArtistSort text See: Sort Name
strGenres text Album genres (denormalised concatenation of values in genre table)
iYear integer Album release year
strMoods text Album moods
strStyles text Album styles
strThemes text Album themes
strReview text Album review
strLabel text Album recording label
strType text Album Type e.g. "Soundtrack / Live"
strImage text URLs for available remote album images
fRating float Album rating
iUserrating integer Album user rating (out of 10)
iVotes integer Votes (for album rating)
bCompilation integer Compilation flag
bScrapedMBID integer Indicates if mbid(s) have been fetched by scraping or from tags
lastScraped varchar(20) Date & time of last scrape
iTimesPlayed integer Average of number of times songs on album are played
strReleaseType text Internal type - "album" or "single"
dateAdded text Music file timestamp of newest song on album
lastPlayed text Last date any song on album was played


2.3 artistview

A view of the artist table with an additional field aggregated from the songs by that artist.

Column Name Data Type Description
idArtist integer ID from artist table
strArtist varchar(256) Artist name
strSortName text See: Sort Name
strMusicBrainzArtistID text Musicbrainz artist ID
strType text Type of performer
strGender text Male or Female artist
strDisambiguation text See: Disambiguation Comment
strBorn text Artist birthday (and place)
strFormed text Band formation information
strGenres text Artist genres (just text, no link to genre table)
strMoods text Artist moods
strStyles text Artist styles
strInstruments text Artist instruments
strBiography text Artist biography
strDied text Date artist died (and place)
strDisbanded text Band disbanded information
strYearsActive text Years artist is active
strImage text URLs of available artist images
strFanart text URLs of available artist fanart
bScrapedMBID integer Indicates if mbid(s) have been fetched by scraping or from tags
lastScraped varchar(20) Date & time of last scrape
dateAdded text Music file timestamp of newest song by artist


2.4 songartistview

A view that joins song to artist and artist role.

Column Name Data Type Description
idSong integer ID from song table
idArtist integer ID from artist table
idrole integer ID from role table
strRole text Description of role
strArtist varchar(256) Artist name
strSortName text See: Sort Name
strMusicBrainzArtistID text Musicbrainz artist ID Hash
iOrder integer Order artist appears in song credits


2.5 songview

A view that joins song to album and path.

Column Name Data Type Description
idSong integer ID from song table
strArtists text Song artist(s) description (not always a concatenation of names)
strArtistSort text See: Sort Name
strGenres text Song Genres (denormalised concatenation of values in genre table)
strTitle varchar(512) Song title
iTrack integer Song track number
iDuration integer Song duration in seconds
iYear integer Songs release year
strFileName text Name of music file
strMusicBrainzTrackID text Musicbrainz track ID
iTimesPlayed integer Play count
iStartOffset integer Start position (in seconds) when song from cuesheet
iEndOffset integer End position (in seconds) when song from cuesheet
lastplayed varchar(20) Date & time last played
rating float Song rating
userrating integer Song rated by user (out of 10)
votes integer Votes for song rating
comment text Song description or comment
idAlbum integer ID from album table
strAlbum varchar(256) Album title
strPath varchar(512) Full path for music file
bCompilation integer Compilation flag (song is on a compilation album)
strAlbumArtists text Album artist(s) description (not always a concatenation of names)
strAlbumArtistSort text See: Sort Name
strAlbumReleaseType text Internal type - "album" or "single"
mood text Song mood
dateAdded text Music file timestamp
strReplayGain text Contains album gain, album peak, track gain, track peak data in one string
Return to top


3 Tables

3.1 album

An album. This equates to what Musicbrainz call a "release" and represents the unique release (i.e. issuing) of an item on a specific date with specific release information such as the country, label, etc. Hence album title and artist do not have to be unique as long as we have the release ID (Musicbrainz album ID), Kodi can handle different versions of the same album e.g. original release and then a later remaster (both same title and artist).

Column Name Data Type Description MusicFileTag ** NFO (xml) Tag
idAlbum integer ID from Album Table
strAlbum varchar(256) Album Name ALBUM <title></title>
strMusicBrainzAlbumID text MusicBrainz album ID MUSICBRAINZ_ALBUMID <musicBrainzAlbumID></musicBrainzAlbumID>
strReleaseGroupMBID text The ID that groups variations of the same release MusicBrainz Release Group Id <musicbrainzreleasegroupid></musicbrainzreleasegroupid>
strArtistDisp text Album artist(s) description (not always a concatenation of names) ALBUMARTIST,

ALBUMARTISTS,

<artistdesc></artistdesc>
strArtistSort text See: Sort Name ARTISTSORT
strGenres text Album genres (denormalised concatenation of values in genre table) GENRE <genre></genre> ^^
iYear integer Album release year YEAR or DATE <year></year>
bCompilation integer Compilation flag COMPILATION <compilation></compilation>
strMoods text Album moods <mood></mood> ^^
strStyles text Album styles <style></style> ^^
strThemes text Album themes <theme></theme> ^^
strReview text Album review <review></review>
strImage text URLs for available remote album images <thumb preview="path"></thumb>
strLabel text Album recording label LABEL <label></label>
strType text Album Type e.g. "Soundtrack / Live" RELEASETYPE <type></type>
fRating float Album rating <rating max="10"></rating>
iVotes integer Votes (for album rating) <votes></votes>
iUserrating integer Album user rating (out of 10) <userrating max="10"></userrating>
lastScraped text Date/time data scraped from online sources or NFO files
bScrapedMBID integer Indicates if mbid(s) have been fetched by scraping or from tags
strReleaseType text Internal type - "album" or "single" <releasetype></releasetype>
idInfoSetting integer Indicates which scraper setting was used for that item. 0 = default scraper.
Linked to infosetting table
Notes
** MusicFileTag column shows related Vorbis/Flac tags. Click on column heading for other tag types
^^ Multiple entries of the XML tag are allowed


3.2 album_artist

This table links albums to the Source folder

Column Name Data Type Description
idArtist integer Foreign key to artist table
idAlbum integer Foreign key to album table
iOrder integer Order of artist names for credits
strArtist text Artist name (denormalised)


3.3 album_source

This table links artists and albums

Column Name Data Type Description
idArtist integer Foreign key to source table
idAlbum integer Foreign key to album table


3.4 art

The current artwork for artists and albums

Column Name Data Type Description NFO (xml) Tag
art_id integer Primary Key
media_id integer Foreign key to album or artist table
media_type text Used in combination with media_id- "album" or "artist"
type text art type e.g. "thumb", "fanart" etc.
  <fanart></fanart>
OR  
  <thumb></thumb>
url text URL of image (can be remote, local or music file with art embedded)
  <thumb aspect="poster" preview=""></thumb>
  <fanart>
    <thumb preview=""></thumb>
  </fanart>


3.5 artist

An artist is generally a musician, group of musicians, or other music professional (like a producer or engineer). E.g. Bob Dylan, Pink Floyd, London Symphony Orchestra, Andrew Collins (producer).

Column Name Data Type Description MusicFileTag ** NFO (xml) Tag
idArtist integer ID from artist table
strArtist varchar(256) Artist name ARTIST, ARTISTS,
ALBUMARTIST and

ALBUMARTISTS

<name></name>
strMusicBrainzArtistID text Musicbrainz artist ID MUSICBRAINZ_ARTISTID <musicBrainzArtistID></musicBrainzArtistID>
strSortName text See: Sort Name ALBUMARTISTSORT
strType text Type of performer <type></type>
strGender text Male or Female artist <gender></gender>
strDisambiguation text See: Disambiguation Comment <disambiguation></disambiguation>
strBorn text Artist birthday (and place) <born></born>
strFormed text Band formation information <formed></formed>
strGenres text Artist genres (just text, no link to genre table) <genre></genre> ^^
strMoods text Artist moods <mood></mood> ^^
strStyles text Artist styles <style></style> ^^
strInstruments text Artist instruments <instruments></instruments> ^^
strBiography text Artist biography <biography></biography>
strDied text Date artist died (and place) <died></died>
strDisbanded text Band disbanded information <disbanded></disbanded>
strYearsActive text Years artist is active <yearsactive></yearsactive> ^^
strImage text URLs of available artist images <thumb preview=" "></thumb> ^^
strFanart text URLs of available artist fanart <fanart><thumb preview=""></thumb></fanart> ^^
lastScraped varchar(20) Date last scraped metadata
bScrapedMBID integer Indicates if mbid(s) have been fetched by scraping or from tags
idInfoSetting integer Indicates which scraper setting was used for that item. 0 = default scraper.
Linked to infosetting table
Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types
^^ Multiple entries of the tag are allowed


3.6 audiobook

For use with Audiobooks. Holds Resume Point information only.

Column Name Data Type Description
idBook integer Id of Resume Point
strBook varchar(256) Title link to album table
strAuthor text Author link to artist table
bookmark integer Resume Point (millisec)
file text Path to audiobook
dateAdded varchar(20) Date & Time bookmark created


3.7 discography

The discography of an artist. This is returned when additional information for an artist is scraped from online sources or NFO files. It has no relationship with the albums actually in the user's music collection, it is just details about the artist.

Column Name Data Type Description NFO (xml) Tag
idArtist integer Foreign key to artist table
strAlbum text Album title
<album>
  <title></title>
</album>
strYear text Year album released
<album>
  <year></year>
</album>


3.8 genre

A music genre. This is a lookup table that enumerates the song genre values read from the genre tags embedded in music files e.g. "Progressive Rock", "Baroque" etc. But could contain anything that has been given as a "genre", and is not strictly limited to music genres.

Column Name Data Type Description MusicFileTag ** NFO (xml) Tag
idGenre integer Primary Key
strGenre varchar(256) Genre Name GENRE <genre></genre> ^^
Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types
^^ Multiple entries of the tag are allowed


3.9 infosetting

As scrapers and scraper settings can be changed per individual Album and Artist, this table details the settings of additional scrapers used. If only the default scraper for Album and Artist are used, there are no entries here.

Column Name Data Type Description
idSetting integer Primary Key
strScraperPath text Scraper details
strSettings text Scraper settings


3.10 path

The path of a folder containing music that has been scanned into the music library. This holds hash values of name, size, and timestamp for each folder and sub folder that is used to determine if the conents have changed and thererfore the music files need rescanning as part of library update.

Column Name Data Type Description
idPath integer Primary Key
strPath varchar(512) Media path
strHash text Hash value


3.11 role

An artist role, a way that an artist has contributed to or been involved with a song. This could be by being in the song artist credits ("artist"), as a musician ("Guitar", "Orchestra" or "vocals" etc.), as composer, conductor, lyricist etc. or involved in some other way as music professional e.g. producer, engineer, mixer etc. This is a lookup table that enumerates the various roles that have been read from tags embedded in music files.

Column Name Data Type Description MusicFileTag **
idrole integer Primary Key
strRole text Description of role

ARTIST, ARRANGER, COMPOSER, CONDUCTOR,
DJMIXER, ENGINEER, LYRICIST, MIXER,
PRODUCER, REMIXER and PERFORMER

Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types


3.12 song

A song. It is the way that the individual track(s) from a music file are held in the music library. Generally a music file contains just one song, however it may contain more and have an associated cuesheet (separately or embedded) that identifies the individual tracks. A song may be from an album (the release of several tracks as one product so includes EPs etc. ), or a single. Singles from an artist (no album title given in the embedded tags) are internally linked with a fake album in the album table.

The music library can contain songs with the same title, artist credits, track number and album as long as they come from separate music files. Unexpectedly Musicbrainz Track ID is not unique on an album, recordings are sometimes repeated e.g. "[silence]" or on a disc set.

Column Name Data Type Description MusicFileTag ** XML Tags
idSong integer ID from song table
idAlbum integer ID from album table
idPath integer Foreign key to path table
strArtistDisp text Album artist(s) description (not always a concatenation of names) ALBUMARTIST,

ALBUMARTISTS,

<artistdesc></artistdesc>
strArtistSort text See: Sort Name ALBUMARTISTSORT
strArtists text Song artist(s) description (not always a concatenation of names) ARTIST and ARTISTS
strGenres text Song Genres (denormalised concatenation of values in genre table) GENRE
strTitle varchar(512) Song title TITLE
iTrack integer Song disc (upper 4 bytes) and track number (lower 4 bytes) TRACKNUMBER and
DISCNUMBER
iDuration integer Song duration in seconds
iYear integer Songs release year YEAR or DATE
strFileName text Name of music file
strMusicBrainzTrackID text Musicbrainz track ID MUSICBRAINZ_TRACKID
iTimesPlayed integer Play count
iStartOffset integer Start position (in seconds) when song from cuesheet
iEndOffset integer End position (in seconds) when song from cuesheet
lastplayed varchar(20) Date & time last played
rating float Song rating
votes integer Votes for song rating
userrating integer Song rated by user (out of 10) RATING
comment text Song description or comment COMMENT
mood text Song mood MOOD
strReplayGain text Contains album gain, album peak, track gain, track peak data in one string
dateAdded text Music file timestamp
Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types


3.13 song_artist

This table links songs to artists and the roles they contributed.

Column Name Data Type Description
idArtist integer Foreign key to artist table
idSong integer Foreign key to song table
idRole integer Foreign key to role table
iOrder integer Order in artist credits
strArtist text Name of artist (denormalised)


3.14 song_genre

This table links the songs with their genres.

Column Name Data Type Description
idGenre integer Foreign key to genre table
idSong integer Foreign key to song table
iOrder integer Genre order when concatenating to single string


3.15 source

List of Sources

Column Name Data Type Description
idSource integer Primary Key
strName text Folder name
strMultipath text Path or multipath:// of source folder(s)


3.16 source_path

A source can be multi-path (made as a collection of separate folders). The source_path table holds the separate paths per individual source

Column Name Data Type Description
idSource integer Primary Key and Foreign key to source table
idPath integer
strPath varchar(512) Path to source folder


3.17 version

Database version

Column Name Data Type Description
idVersion integer Version of the music database
iCompressCount integer Number of times database has been compressed


3.18 versiontagscan

Used to hold minimal scanning process related data

Column Name Data Type Description
idVersion integer Keeps track of what version of db tag processing was used to populate the db
iNeedsScan integer Is set per Kodi release to indicate the minimum db version needed before a forced rescan on tags is necessary. Used when newer versions have related tag scanning changes
lastscanned varchar(20) Date & Time last scan was run. Useful because when rescanning the ids change and add-ons can check if their own data is still valid or a resync is required.


Return to top