Databases/MyMusic

From Official Kodi Wiki
< Databases
Revision as of 02:46, 27 February 2018 by Karellen (talk | contribs) (Create Page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Kodi Databases

See also:

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



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 v17 - MyMusic60.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.



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.


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
strMusicBrainzArtistID text Musicbrainz artist ID
iOrder integer Order artist appears in credits


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
strArtists text Album artist(s) description (not always a concatenation of names)
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
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


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
strMusicBrainzArtistID text Musicbrainz artist ID
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
dateAdded text Music file timestamp of newest song by artist


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
strMusicBrainzArtistID text Musicbrainz artist ID Hash
iOrder integer Order artist appears in song credits


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)
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 char 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)
strAlbumReleaseType text Internal type - "album" or "single"
mood text Song mood
dateAdded text Music file timestamp
Return to top


Tables

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>
strArtists text Album artist(s) description (not always a concatenation of names) ALBUMARTIST,

ALBUMARTISTS,
ARTIST and ARTISTS

<artistdesc></artistdesc>
strGenres text Album genres (denormalised concatenation of values in genre table) GENRE <genre></genre> ^^
iYear integer Album release year YEAR or DATE <year></year>
idThumb integer [Unused]
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>
iUserrating integer Album user rating (out of 10) <userrating max="10"></userrating>
lastScraped text Date/time data scraped from online sources or NFO files
strReleaseType text Internal type - "album" or "single" <releasetype></releasetype>
iVotes integer Votes (for album rating) <votes></votes>
Notes
** MusicFileTag column shows related Vorbis/Flac tags. Click on column heading for other tag types
^^ Multiple entries of the XML tag are allowed


album_artist

This table links artists and albums

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)


album_genre

This links albums with their genres.

Column Name Data Type Description
idGenre integer Foreign key to genre(music) table
idAlbum integer Foreign key to album table
iOrder integer Order of genre for concatentation


albuminfosong

Track listing information for the tracks on an album. This is returned when additional information for an album is scraped from online sources or NFO files. It has no relationship with the songs actually in the user's music collection, it is just more descriptive details about the album.

Column Name Data Type Description NFO (xml) Tag
idAlbumInfoSong integer Primary Key
idAlbumInfo integer Foreign key to album table
iTrack integer Track number
<track>
  <position></position>
</track>
strTitle text Track title
<track>
  <title></title>
</track>
iDuration integer Track duration in seconds
<track>
  <duration></duration>
</track>


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 "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)
<art>
  <fanart>E:\Music\U2\fanart.jpg</fanart>
  <thumb>E:\Music\U2\folder.jpg</thumb>
</art>


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>
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
Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types
^^ Multiple entries of the tag are allowed


content

The scraper addon and settings used for scraping additional information for specific albums or artists.

Column Name Data Type Description
strPath text Virtual path encoding what album or artist e.g. "musicdb://artists/235"
strScraperPath text Scraper name e.g. "metadata.artists.universal"
strContent text "artists" or "albums"
strSettings text Scraper settings as XML


cue

Cuesheet information that has been extracted from a FLAC file. Generally Cuesheets as separate files are not handled in this way, only those embedded in FLAC files.

Column Name Data Type Description MusicFileTag
idPath integer Foreign key to music path of where file is located
strFileName text Name of FLAC file the cuesheet is embedded in
strCuesheet text Cuesheet CUESHEET


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>


genre(music)

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


path(music)

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


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


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 **
idSong integer ID from song table
idAlbum integer ID from album table
idPath integer Foreign key to path table
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
dwFileNameCRC text [unused]
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
idThumb integer [unused]
lastplayed varchar(20) Date & time last played
rating char Song rating
userrating integer Song rated by user (out of 10) RATING
comment text Song description or comment COMMENT
mood text Song mood MOOD
dateAdded text Music file timestamp
votes integer Votes for song rating
Notes
** MusicFileTag column shows Vorbis/Flac tags. Click on column heading for other tag types


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)


song_genre

This table links the songs with their genres.

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


version(music)

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


Return to top