Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Class to store and read tag information. More...
#include <MusicDatabase.h>
Public Member Functions | |
CMusicDatabase (void) | |
~CMusicDatabase (void) override | |
bool | Open () override |
bool | CommitTransaction () override |
void | EmptyCache () |
void | Clean () |
int | Cleanup (CGUIDialogProgress *progressDialog=nullptr) |
bool | LookupCDDBInfo (bool bRequery=false) |
void | DeleteCDDBInfo () |
int | AddSong (const int idSong, const CDateTime &dtDateNew, const int idAlbum, const std::string &strTitle, const std::string &strMusicBrainzTrackID, const std::string &strPathAndFileName, const std::string &strComment, const std::string &strMood, const std::string &strThumb, const std::string &artistDisp, const std::string &artistSort, const std::vector< std::string > &genres, int iTrack, int iDuration, const std::string &strReleaseDate, const std::string &strOrigReleaseDate, std::string &strDiscSubtitle, const int iTimesPlayed, int iStartOffset, int iEndOffset, const CDateTime &dtLastPlayed, float rating, int userrating, int votes, int iBPM, int iBitRate, int iSampleRate, int iChannels, const std::string &songVideoURL, const ReplayGain &replayGain) |
Add a song to the database. | |
bool | GetSong (int idSong, CSong &song) |
bool | UpdateSong (CSong &song, bool bArtists=true, bool bArtistLinks=true) |
Update a song and all its nested entities (genres, artists, contributors) | |
int | UpdateSong (int idSong, const std::string &strTitle, const std::string &strMusicBrainzTrackID, const std::string &strPathAndFileName, const std::string &strComment, const std::string &strMood, const std::string &strThumb, const std::string &artistDisp, const std::string &artistSort, const std::vector< std::string > &genres, int iTrack, int iDuration, const std::string &strReleaseDate, const std::string &strOrigReleaseDate, const std::string &strDiscSubtitle, int iTimesPlayed, int iStartOffset, int iEndOffset, const CDateTime &dtLastPlayed, float rating, int userrating, int votes, const ReplayGain &replayGain, int iBPM, int iBitRate, int iSampleRate, int iChannels, const std::string &songVideoURL) |
Update a song in the database. | |
bool | GetSongByFileName (const std::string &strFileName, CSong &song, int64_t startOffset=0) |
bool | GetSongsByPath (const std::string &strPath, MAPSONGS &songmap, bool bAppendToMap=false) |
bool | Search (const std::string &search, CFileItemList &items) |
bool | RemoveSongsFromPath (const std::string &path, MAPSONGS &songmap, bool exact=true) |
void | CheckArtistLinksChanged () |
bool | SetSongUserrating (const std::string &filePath, int userrating) |
bool | SetSongUserrating (int idSong, int userrating) |
bool | SetSongVotes (const std::string &filePath, int votes) |
int | GetSongByArtistAndAlbumAndTitle (const std::string &strArtist, const std::string &strAlbum, const std::string &strTitle) |
bool | AddAlbum (CAlbum &album, int idSource) |
Add an album and all its songs to the database. | |
bool | UpdateAlbum (CAlbum &album) |
Update an album and all its nested entities (artists, songs etc) | |
int | AddAlbum (const std::string &strAlbum, const std::string &strMusicBrainzAlbumID, const std::string &strReleaseGroupMBID, const std::string &strArtist, const std::string &strArtistSort, const std::string &strGenre, const std::string &strReleaseDate, const std::string &strOrigReleaseDate, bool bBoxedSet, const std::string &strRecordLabel, const std::string &strType, const std::string &strReleaseStatus, bool bCompilation, CAlbum::ReleaseType releaseType) |
Add an album to the database. | |
bool | GetAlbum (int idAlbum, CAlbum &album, bool getSongs=true) |
retrieve an album, optionally with all songs. | |
int | UpdateAlbum (int idAlbum, const std::string &strAlbum, const std::string &strMusicBrainzAlbumID, const std::string &strReleaseGroupMBID, const std::string &strArtist, const std::string &strArtistSort, const std::string &strGenre, const std::string &strMoods, const std::string &strStyles, const std::string &strThemes, const std::string &strReview, const std::string &strImage, const std::string &strLabel, const std::string &strType, const std::string &strReleaseStatus, float fRating, int iUserrating, int iVotes, const std::string &strReleaseDate, const std::string &strOrigReleaseDate, bool bBoxedSet, bool bCompilation, CAlbum::ReleaseType releaseType, bool bScrapedMBID) |
bool | ClearAlbumLastScrapedTime (int idAlbum) |
bool | HasAlbumBeenScraped (int idAlbum) |
bool | AddAudioBook (const CFileItem &item) |
bool | SetResumeBookmarkForAudioBook (const CFileItem &item, int bookmark) |
bool | GetResumeBookmarkForAudioBook (const CFileItem &item, int &bookmark) |
bool | InsideScannedPath (const std::string &path) |
Checks if the given path is inside a folder that has already been scanned into the library. | |
int | GetAlbumIdByPath (const std::string &path) |
bool | GetAlbumFromSong (int idSong, CAlbum &album) |
int | GetAlbumByName (const std::string &strAlbum, const std::string &strArtist="") |
int | GetAlbumByName (const std::string &strAlbum, const std::vector< std::string > &artist) |
bool | GetMatchingMusicVideoAlbum (const std::string &strAlbum, const std::string &strArtist, int &idAlbum, std::string &strReview) |
bool | SearchAlbumsByArtistName (const std::string &strArtist, CFileItemList &items) |
int | GetAlbumByMatch (const CAlbum &album) |
std::string | GetAlbumById (int id) |
std::string | GetAlbumDiscTitle (int idAlbum, int idDisc) |
bool | SetAlbumUserrating (const int idAlbum, int userrating) |
int | GetAlbumDiscsCount (int idAlbum) |
bool | UpdateArtist (const CArtist &artist) |
int | AddArtist (const std::string &strArtist, const std::string &strMusicBrainzArtistID, const std::string &strSortName, bool bScrapedMBID=false) |
int | AddArtist (const std::string &strArtist, const std::string &strMusicBrainzArtistID, bool bScrapedMBID=false) |
bool | GetArtist (int idArtist, CArtist &artist, bool fetchAll=false) |
bool | GetArtistExists (int idArtist) |
int | GetLastArtist () |
int | GetArtistFromMBID (const std::string &strMusicBrainzArtistID, std::string &artistname) |
int | UpdateArtist (int idArtist, const std::string &strArtist, const std::string &strSortName, const std::string &strMusicBrainzArtistID, bool bScrapedMBID, const std::string &strType, const std::string &strGender, const std::string &strDisambiguation, const std::string &strBorn, const std::string &strFormed, const std::string &strGenres, const std::string &strMoods, const std::string &strStyles, const std::string &strInstruments, const std::string &strBiography, const std::string &strDied, const std::string &strDisbanded, const std::string &strYearsActive, const std::string &strImage) |
bool | UpdateArtistScrapedMBID (int idArtist, const std::string &strMusicBrainzArtistID) |
bool | GetTranslateBlankArtist () |
void | SetTranslateBlankArtist (bool translate) |
bool | HasArtistBeenScraped (int idArtist) |
bool | ClearArtistLastScrapedTime (int idArtist) |
int | AddArtistDiscography (int idArtist, const CDiscoAlbum &discoAlbum) |
bool | DeleteArtistDiscography (int idArtist) |
bool | GetArtistDiscography (int idArtist, CFileItemList &items) |
bool | AddArtistVideoLinks (const CArtist &artist) |
bool | DeleteArtistVideoLinks (const int idArtist) |
std::string | GetArtistById (int id) |
int | GetArtistByName (const std::string &strArtist) |
int | GetArtistByMatch (const CArtist &artist) |
bool | GetArtistFromSong (int idSong, CArtist &artist) |
bool | IsSongArtist (int idSong, int idArtist) |
bool | IsSongAlbumArtist (int idSong, int idArtist) |
std::string | GetRoleById (int id) |
bool | UpdateArtistSortNames (int idArtist=-1) |
Propagate artist sort name into the concatenated artist sort name strings held for songs and albums. | |
int | AddPath (const std::string &strPath) |
bool | GetPaths (std::set< std::string > &paths) |
bool | SetPathHash (const std::string &path, const std::string &hash) |
bool | GetPathHash (const std::string &path, std::string &hash) |
bool | GetAlbumPaths (int idAlbum, std::vector< std::pair< std::string, int > > &paths) |
bool | GetAlbumPath (int idAlbum, std::string &basePath) |
int | GetDiscnumberForPathID (int idPath) |
bool | GetOldArtistPath (int idArtist, std::string &path) |
bool | GetArtistPath (const CArtist &artist, std::string &path) |
bool | GetAlbumFolder (const CAlbum &album, const std::string &strAlbumPath, std::string &strFolder) |
bool | GetArtistFolderName (const CArtist &artist, std::string &strFolder) |
bool | GetArtistFolderName (const std::string &strArtist, const std::string &strMusicBrainzArtistID, std::string &strFolder) |
bool | UpdateSources () |
int | AddSource (const std::string &strName, const std::string &strMultipath, const std::vector< std::string > &vecPaths, int id=-1) |
int | UpdateSource (const std::string &strOldName, const std::string &strName, const std::string &strMultipath, const std::vector< std::string > &vecPaths) |
bool | RemoveSource (const std::string &strName) |
int | GetSourceFromPath (const std::string &strPath) |
bool | AddAlbumSource (int idAlbum, int idSource) |
bool | AddAlbumSources (int idAlbum, const std::string &strPath) |
bool | DeleteAlbumSources (int idAlbum) |
bool | GetSources (CFileItemList &items) |
bool | GetSourcesByArtist (int idArtist, CFileItem *item) |
bool | GetSourcesByAlbum (int idAlbum, CFileItem *item) |
bool | GetSourcesBySong (int idSong, const std::string &strPath, CFileItem *item) |
int | GetSourceByName (const std::string &strSource) |
std::string | GetSourceById (int id) |
int | AddGenre (std::string &strGenre) |
std::string | GetGenreById (int id) |
int | GetGenreByName (const std::string &strGenre) |
bool | AddAlbumArtist (int idArtist, int idAlbum, const std::string &strArtist, int iOrder) |
bool | GetAlbumsByArtist (int idArtist, std::vector< int > &albums) |
bool | GetArtistsByAlbum (int idAlbum, CFileItem *item) |
bool | GetArtistsByAlbum (int idAlbum, std::vector< std::string > &artistIDs) |
bool | DeleteAlbumArtistsByAlbum (int idAlbum) |
int | AddRole (const std::string &strRole) |
bool | AddSongArtist (int idArtist, int idSong, const std::string &strRole, const std::string &strArtist, int iOrder) |
bool | AddSongArtist (int idArtist, int idSong, int idRole, const std::string &strArtist, int iOrder) |
int | AddSongContributor (int idSong, const std::string &strRole, const std::string &strArtist, const std::string &strSort) |
void | AddSongContributors (int idSong, const VECMUSICROLES &contributors, const std::string &strSort) |
int | GetRoleByName (const std::string &strRole) |
bool | GetRolesByArtist (int idArtist, CFileItem *item) |
bool | GetSongsByArtist (int idArtist, std::vector< int > &songs) |
bool | GetArtistsBySong (int idSong, std::vector< int > &artists) |
bool | DeleteSongArtistsBySong (int idSong) |
bool | AddSongGenres (int idSong, const std::vector< std::string > &genres) |
bool | GetGenresBySong (int idSong, std::vector< int > &genres) |
bool | GetGenresByAlbum (int idAlbum, CFileItem *item) |
bool | GetGenresByArtist (int idArtist, CFileItem *item) |
bool | GetIsAlbumArtist (int idArtist, CFileItem *item) |
bool | GetTop100 (const std::string &strBaseDir, CFileItemList &items) |
bool | GetTop100Albums (VECALBUMS &albums) |
bool | GetTop100AlbumSongs (const std::string &strBaseDir, CFileItemList &item) |
bool | GetRecentlyAddedAlbums (VECALBUMS &albums, unsigned int limit=0) |
bool | GetRecentlyAddedAlbumSongs (const std::string &strBaseDir, CFileItemList &item, unsigned int limit=0) |
bool | GetRecentlyPlayedAlbums (VECALBUMS &albums) |
bool | GetRecentlyPlayedAlbumSongs (const std::string &strBaseDir, CFileItemList &item) |
int | GetCompilationAlbumsCount () |
bool | IsAlbumBoxset (int idAlbum) |
int | GetBoxsetsCount () |
int | GetSinglesCount () |
int | GetArtistCountForRole (int role) |
int | GetArtistCountForRole (const std::string &strRole) |
void | IncrementPlayCount (const CFileItem &item) |
Increment the playcount of an item Increments the playcount and updates the last played date. | |
bool | CleanupOrphanedItems () |
bool | GetGenresNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter(), bool countOnly=false) |
bool | GetSourcesNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter(), bool countOnly=false) |
bool | GetYearsNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter()) |
bool | GetRolesNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter()) |
bool | GetArtistsNav (const std::string &strBaseDir, CFileItemList &items, bool albumArtistsOnly=false, int idGenre=-1, int idAlbum=-1, int idSong=-1, const Filter &filter=Filter(), const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetCommonNav (const std::string &strBaseDir, const std::string &table, const std::string &labelField, CFileItemList &items, const Filter &filter, bool countOnly) |
bool | GetAlbumTypesNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter(), bool countOnly=false) |
bool | GetMusicLabelsNav (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter(), bool countOnly=false) |
bool | GetAlbumsNav (const std::string &strBaseDir, CFileItemList &items, int idGenre=-1, int idArtist=-1, const Filter &filter=Filter(), const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetDiscsNav (const std::string &strBaseDir, CFileItemList &items, int idAlbum, const Filter &filter=Filter(), const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetAlbumsByYear (const std::string &strBaseDir, CFileItemList &items, int year) |
bool | GetSongsNav (const std::string &strBaseDir, CFileItemList &items, int idGenre, int idArtist, int idAlbum, const SortDescription &sortDescription=SortDescription()) |
bool | GetSongsByYear (const std::string &baseDir, CFileItemList &items, int year) |
bool | GetSongsByWhere (const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription()) |
bool | GetSongsFullByWhere (const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription(), bool artistData=false) |
bool | GetAlbumsByWhere (const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetDiscsByWhere (const std::string &baseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetDiscsByWhere (CMusicDbUrl &musicUrl, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
bool | GetArtistsByWhere (const std::string &strBaseDir, const Filter &filter, CFileItemList &items, const SortDescription &sortDescription=SortDescription(), bool countOnly=false) |
int | GetDiscsCount (const std::string &baseDir, const Filter &filter=Filter()) |
int | GetSongsCount (const Filter &filter=Filter()) |
bool | GetFilter (CDbUrl &musicUrl, Filter &filter, SortDescription &sorting) override |
int | GetOrderFilter (const std::string &type, const SortDescription &sorting, Filter &filter) |
unsigned int | GetRandomSongIDs (const Filter &filter, std::vector< std::pair< int, int > > &songIDs) |
Gets song IDs in random order that match the filter criteria. | |
bool | GetGenresJSON (CFileItemList &items, bool bSources=false) |
bool | GetArtistsByWhereJSON (const std::set< std::string > &fields, const std::string &baseDir, CVariant &result, int &total, const SortDescription &sortDescription=SortDescription()) |
bool | GetAlbumsByWhereJSON (const std::set< std::string > &fields, const std::string &baseDir, CVariant &result, int &total, const SortDescription &sortDescription=SortDescription()) |
bool | GetSongsByWhereJSON (const std::set< std::string > &fields, const std::string &baseDir, CVariant &result, int &total, const SortDescription &sortDescription=SortDescription()) |
bool | SetScraper (int id, const CONTENT_TYPE &content, const ADDON::ScraperPtr &scraper) |
bool | SetScraperAll (const std::string &strBaseDir, const ADDON::ScraperPtr &scraper) |
bool | GetScraper (int id, const CONTENT_TYPE &content, ADDON::ScraperPtr &scraper) |
bool | ScraperInUse (const std::string &scraperID) const |
Check whether a given scraper is in use. | |
bool | GetItems (const std::string &strBaseDir, CFileItemList &items, const Filter &filter=Filter(), const SortDescription &sortDescription=SortDescription()) |
bool | GetItems (const std::string &strBaseDir, const std::string &itemType, CFileItemList &items, const Filter &filter=Filter(), const SortDescription &sortDescription=SortDescription()) |
std::string | GetItemById (const std::string &itemType, int id) |
void | ExportToXML (const CLibExportSettings &settings, CGUIDialogProgress *progressDialog=nullptr) |
bool | ExportSongHistory (TiXmlNode *pNode, CGUIDialogProgress *progressDialog=nullptr) |
void | ImportFromXML (const std::string &xmlFile, CGUIDialogProgress *progressDialog=nullptr) |
bool | ImportSongHistory (const std::string &xmlFile, const int total, CGUIDialogProgress *progressDialog=nullptr) |
void | SetPropertiesForFileItem (CFileItem &item) |
void | SetItemUpdated (int mediaId, const std::string &mediaType) |
void | SetArtForItem (int mediaId, const std::string &mediaType, const std::string &artType, const std::string &url) |
Sets art for a database item. Sets a single piece of art for a database item. | |
void | SetArtForItem (int mediaId, const std::string &mediaType, const std::map< std::string, std::string > &art) |
Sets art for a database item. Sets multiple pieces of art for a database item. | |
bool | GetArtForItem (int songId, int albumId, int artistId, bool bPrimaryArtist, std::vector< ArtForThumbLoader > &art) |
Fetch all related art for a database item. Fetches multiple pieces of art for a database item including that for related media types Given song id art for the related album, artist(s) and albumartist(s) will also be fetched, looking up the album and artist when ids are not provided. Given album id (and not song id) art for the related artist(s) will also be fetched, looking up the artist(s) when id are not provided. | |
bool | GetArtForItem (int mediaId, const std::string &mediaType, std::map< std::string, std::string > &art) |
Fetch art for a database item. Fetches multiple pieces of art for a database item. | |
std::string | GetArtForItem (int mediaId, const std::string &mediaType, const std::string &artType) |
Fetch art for a database item. Fetches a single piece of art for a database item. | |
bool | RemoveArtForItem (int mediaId, const MediaType &mediaType, const std::string &artType) |
Remove art for a database item. Removes a single piece of art for a database item. | |
bool | RemoveArtForItem (int mediaId, const MediaType &mediaType, const std::set< std::string > &artTypes) |
Remove art for a database item. Removes multiple pieces of art for a database item. | |
bool | GetArtTypes (const MediaType &mediaType, std::vector< std::string > &artTypes) |
Fetch the distinct types of art held in the database for a type of media. | |
std::vector< std::string > | GetAvailableArtTypesForItem (int mediaId, const MediaType &mediaType) |
Fetch the distinct types of available-but-unassigned art held in the database for a specific media item. | |
std::vector< CScraperUrl::SUrlEntry > | GetAvailableArtForItem (int mediaId, const MediaType &mediaType, const std::string &artType) |
Fetch the list of available-but-unassigned art URLs held in the database for a specific media item and art type. | |
virtual int | GetMusicNeedsTagScan () |
Check if music files need all tags rescanning regardless of file being unchanged because the tag processing has changed (which may happen without db version changes) since they where last scanned. | |
void | SetMusicNeedsTagScan (int version) |
Set minimum version number of db needed when tag data scanned from music files. | |
void | SetMusicTagScanVersion (int version=0) |
Set the version number of tag data. | |
std::string | GetLibraryLastUpdated () |
void | SetLibraryLastUpdated () |
std::string | GetLibraryLastCleaned () |
void | SetLibraryLastCleaned () |
std::string | GetArtistLinksUpdated () |
void | SetArtistLinksUpdated () |
std::string | GetGenresLastAdded () |
std::string | GetSongsLastAdded () |
std::string | GetAlbumsLastAdded () |
std::string | GetArtistsLastAdded () |
std::string | GetSongsLastModified () |
std::string | GetAlbumsLastModified () |
std::string | GetArtistsLastModified () |
std::vector< std::string > | GetUsedImages (const std::vector< std::string > &imagesToCheck) const |
Check the passed in list of images if used in this database. Used to clean the image cache. | |
Public Member Functions inherited from CDatabase | |
CDatabase () | |
virtual | ~CDatabase (void) |
bool | IsOpen () |
virtual void | Close () |
bool | Compress (bool bForce=true) |
void | Interrupt () |
bool | Open (const DatabaseSettings &db) |
void | BeginTransaction () |
void | RollbackTransaction () |
void | CopyDB (const std::string &latestDb) |
void | DropAnalytics () |
std::string | PrepareSQL (std::string strStmt,...) const |
std::string | GetSingleValue (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) const |
Get a single value from a table. | |
std::string | GetSingleValue (const std::string &query) const |
std::string | GetSingleValue (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const |
Get a single value from a query on a dataset. | |
int | GetSingleValueInt (const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause=std::string(), const std::string &strOrderBy=std::string()) const |
Get a single integer value from a table. | |
int | GetSingleValueInt (const std::string &query) const |
int | GetSingleValueInt (const std::string &query, const std::unique_ptr< dbiplus::Dataset > &ds) const |
Get a single integer value from a query on a dataset. | |
bool | DeleteValues (const std::string &strTable, const Filter &filter=Filter()) |
Delete values from a table. | |
bool | ExecuteQuery (const std::string &strQuery) |
Execute a query that does not return any result. Note that if BeginMultipleExecute() has been called, the query will be queued until CommitMultipleExecute() is called. | |
bool | ResultQuery (const std::string &strQuery) const |
Execute a query that returns a result. | |
bool | BeginMultipleExecute () |
Start a multiple execution queue. Any ExecuteQuery() function following this call will be queued rather than executed until CommitMultipleExecute() is performed. NOTE: Queries that rely on any queued execute query will not function as expected during this period! | |
bool | CommitMultipleExecute () |
Commit the multiple execution queue to the database. Queries are performed within a transaction, and the transaction is rolled back should any one query fail. | |
bool | QueueInsertQuery (const std::string &strQuery) |
Put an INSERT or REPLACE query in the queue. | |
bool | CommitInsertQueries () |
Commit all queries in the queue. | |
size_t | GetInsertQueriesCount () |
Get the number of INSERT queries in the queue. | |
bool | QueueDeleteQuery (const std::string &strQuery) |
Put a DELETE query in the queue. | |
bool | CommitDeleteQueries () |
Commit all queued DELETE queries. | |
size_t | GetDeleteQueriesCount () |
Get the number of DELETE queries in the queue. | |
virtual bool | BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl) |
virtual bool | BuildSQL (const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl, SortDescription &sorting) |
bool | Connect (const std::string &dbName, const DatabaseSettings &db, bool create) |
Static Public Member Functions | |
static void | SetPropertiesFromArtist (CFileItem &item, const CArtist &artist) |
static void | SetPropertiesFromAlbum (CFileItem &item, const CAlbum &album) |
Protected Member Functions | |
void | CreateTables () override |
void | CreateAnalytics () override |
int | GetMinSchemaVersion () const override |
int | GetSchemaVersion () const override |
const char * | GetBaseDBName () const override |
Protected Member Functions inherited from CDatabase | |
void | Split (const std::string &strFileNameAndPath, std::string &strPath, std::string &strFileName) |
bool | CreateDatabase () |
Create database tables and analytics as needed. Calls CreateTables() and CreateAnalytics() on child classes. | |
int | GetDBVersion () |
bool | BuildSQL (const std::string &strQuery, const Filter &filter, std::string &strSQL) const |
Protected Attributes | |
std::map< std::string, int > | m_genreCache |
std::map< std::string, int > | m_pathCache |
Protected Attributes inherited from CDatabase | |
bool | m_sqlite |
whether we use sqlite (defaults to true) | |
std::unique_ptr< dbiplus::Database > | m_pDB |
std::unique_ptr< dbiplus::Dataset > | m_pDS |
std::unique_ptr< dbiplus::Dataset > | m_pDS2 |
const CProfileManager & | m_profileManager |
Friends | |
class | DatabaseUtils |
class | TestDatabaseUtilsHelper |
Class to store and read tag information.
CMusicDatabase can be used to read and store tag information for faster access. It is based on sqlite (http://www.sqlite.org).
Here is the database layout:
CMusicDatabase::CMusicDatabase | ( | void | ) |
|
override |
Add an album and all its songs to the database.
album | the album to add |
idSource | the music source id |
int CMusicDatabase::AddAlbum | ( | const std::string & | strAlbum, |
const std::string & | strMusicBrainzAlbumID, | ||
const std::string & | strReleaseGroupMBID, | ||
const std::string & | strArtist, | ||
const std::string & | strArtistSort, | ||
const std::string & | strGenre, | ||
const std::string & | strReleaseDate, | ||
const std::string & | strOrigReleaseDate, | ||
bool | bBoxedSet, | ||
const std::string & | strRecordLabel, | ||
const std::string & | strType, | ||
const std::string & | strReleaseStatus, | ||
bool | bCompilation, | ||
CAlbum::ReleaseType | releaseType ) |
Add an album to the database.
strAlbum | the album title |
strMusicBrainzAlbumID | the Musicbrainz Id |
strArtist | the album artist name(s) display string |
strArtistSort | the album artist name(s) sort string |
strGenre | the album genre(s) |
strReleaseDate | [in] the release date of the album ISO8601 format |
strOrigReleaseDate | [in] the original release date of the album ISO8601 format |
bBoxedSet | if the album is a boxset |
strRecordLabel | the recording label |
strType | album type (Musicbrainz release type e.g. "Broadcast, Soundtrack, live"), |
strReleaseStatus | (see https://musicbrainz.org/doc/Release#Status) |
bCompilation | if the album is a compilation |
releaseType | "album" or "single" |
bool CMusicDatabase::AddAlbumArtist | ( | int | idArtist, |
int | idAlbum, | ||
const std::string & | strArtist, | ||
int | iOrder ) |
int CMusicDatabase::AddArtist | ( | const std::string & | strArtist, |
const std::string & | strMusicBrainzArtistID, | ||
bool | bScrapedMBID = false ) |
int CMusicDatabase::AddArtist | ( | const std::string & | strArtist, |
const std::string & | strMusicBrainzArtistID, | ||
const std::string & | strSortName, | ||
bool | bScrapedMBID = false ) |
int CMusicDatabase::AddArtistDiscography | ( | int | idArtist, |
const CDiscoAlbum & | discoAlbum ) |
int CMusicDatabase::AddGenre | ( | std::string & | strGenre | ) |
int CMusicDatabase::AddPath | ( | const std::string & | strPath | ) |
int CMusicDatabase::AddRole | ( | const std::string & | strRole | ) |
int CMusicDatabase::AddSong | ( | const int | idSong, |
const CDateTime & | dtDateNew, | ||
const int | idAlbum, | ||
const std::string & | strTitle, | ||
const std::string & | strMusicBrainzTrackID, | ||
const std::string & | strPathAndFileName, | ||
const std::string & | strComment, | ||
const std::string & | strMood, | ||
const std::string & | strThumb, | ||
const std::string & | artistDisp, | ||
const std::string & | artistSort, | ||
const std::vector< std::string > & | genres, | ||
int | iTrack, | ||
int | iDuration, | ||
const std::string & | strReleaseDate, | ||
const std::string & | strOrigReleaseDate, | ||
std::string & | strDiscSubtitle, | ||
const int | iTimesPlayed, | ||
int | iStartOffset, | ||
int | iEndOffset, | ||
const CDateTime & | dtLastPlayed, | ||
float | rating, | ||
int | userrating, | ||
int | votes, | ||
int | iBPM, | ||
int | iBitRate, | ||
int | iSampleRate, | ||
int | iChannels, | ||
const std::string & | songVideoURL, | ||
const ReplayGain & | replayGain ) |
Add a song to the database.
idSong | [in] the original database ID of the song to reuse (-1 when new) |
dtDateNew | [in] the datetime the original ID was new |
idAlbum | [in] the database ID of the album for the song |
strTitle | [in] the title of the song (required to be non-empty) |
strMusicBrainzTrackID | [in] the MusicBrainz track ID of the song |
strPathAndFileName | [in] the path and filename to the song |
strComment | [in] the ids of the added songs |
strMood | [in] the mood of the added song |
strThumb | [in] the ids of the added songs |
artistDisp | [in] the assembled artist name(s) display string |
artistSort | [in] the artist name(s) sort string |
genres | [in] a vector of genres to which this song belongs |
iTrack | [in] the track number and disc number of the song |
iDuration | [in] the duration of the song |
strReleaseDate | [in] the release date of the song ISO8601 format |
strOrigReleaseDate | [in] the original release date of the song ISO8601 format |
strDiscSubtitle | [in] subtitle of a disc |
iTimesPlayed | [in] the number of times the song has been played |
iStartOffset | [in] the start offset of the song (when using a single audio file with a .cue) |
iEndOffset | [in] the end offset of the song (when using a single audio file with .cue) |
dtLastPlayed | [in] the time the song was last played |
rating | [in] a rating for the song |
userrating | [in] a userrating (my rating) for the song |
votes | [in] a vote counter for the song rating |
songVideoURL | [in] url to video of the song |
replayGain | [in] album and track replaygain and peak values |
bool CMusicDatabase::AddSongArtist | ( | int | idArtist, |
int | idSong, | ||
const std::string & | strRole, | ||
const std::string & | strArtist, | ||
int | iOrder ) |
bool CMusicDatabase::AddSongArtist | ( | int | idArtist, |
int | idSong, | ||
int | idRole, | ||
const std::string & | strArtist, | ||
int | iOrder ) |
int CMusicDatabase::AddSongContributor | ( | int | idSong, |
const std::string & | strRole, | ||
const std::string & | strArtist, | ||
const std::string & | strSort ) |
void CMusicDatabase::AddSongContributors | ( | int | idSong, |
const VECMUSICROLES & | contributors, | ||
const std::string & | strSort ) |
int CMusicDatabase::AddSource | ( | const std::string & | strName, |
const std::string & | strMultipath, | ||
const std::vector< std::string > & | vecPaths, | ||
int | id = -1 ) |
void CMusicDatabase::CheckArtistLinksChanged | ( | ) |
void CMusicDatabase::Clean | ( | ) |
int CMusicDatabase::Cleanup | ( | CGUIDialogProgress * | progressDialog = nullptr | ) |
bool CMusicDatabase::CleanupOrphanedItems | ( | ) |
void CMusicDatabase::DeleteCDDBInfo | ( | ) |
void CMusicDatabase::EmptyCache | ( | ) |
bool CMusicDatabase::ExportSongHistory | ( | TiXmlNode * | pNode, |
CGUIDialogProgress * | progressDialog = nullptr ) |
void CMusicDatabase::ExportToXML | ( | const CLibExportSettings & | settings, |
CGUIDialogProgress * | progressDialog = nullptr ) |
retrieve an album, optionally with all songs.
idAlbum | the database id of the album. |
album | [out] the album to fill. |
getSongs | whether or not to retrieve songs, defaults to true. |
std::string CMusicDatabase::GetAlbumById | ( | int | id | ) |
int CMusicDatabase::GetAlbumByName | ( | const std::string & | strAlbum, |
const std::string & | strArtist = "" ) |
int CMusicDatabase::GetAlbumByName | ( | const std::string & | strAlbum, |
const std::vector< std::string > & | artist ) |
bool CMusicDatabase::GetAlbumFolder | ( | const CAlbum & | album, |
const std::string & | strAlbumPath, | ||
std::string & | strFolder ) |
int CMusicDatabase::GetAlbumIdByPath | ( | const std::string & | path | ) |
bool CMusicDatabase::GetAlbumPaths | ( | int | idAlbum, |
std::vector< std::pair< std::string, int > > & | paths ) |
bool CMusicDatabase::GetAlbumsByWhere | ( | const std::string & | baseDir, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetAlbumsByWhereJSON | ( | const std::set< std::string > & | fields, |
const std::string & | baseDir, | ||
CVariant & | result, | ||
int & | total, | ||
const SortDescription & | sortDescription = SortDescription() ) |
bool CMusicDatabase::GetAlbumsByYear | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
int | year ) |
std::string CMusicDatabase::GetAlbumsLastAdded | ( | ) |
std::string CMusicDatabase::GetAlbumsLastModified | ( | ) |
bool CMusicDatabase::GetAlbumsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
int | idGenre = -1, | ||
int | idArtist = -1, | ||
const Filter & | filter = Filter(), | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetAlbumTypesNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
bool | countOnly = false ) |
std::string CMusicDatabase::GetArtForItem | ( | int | mediaId, |
const std::string & | mediaType, | ||
const std::string & | artType ) |
Fetch art for a database item. Fetches a single piece of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
artType | the type of art to retrieve, eg "thumb", "fanart". |
bool CMusicDatabase::GetArtForItem | ( | int | mediaId, |
const std::string & | mediaType, | ||
std::map< std::string, std::string > & | art ) |
Fetch art for a database item. Fetches multiple pieces of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
art | [out] a map of <type, url> where type is "thumb", "fanart", etc. and url is the original url of the art. |
bool CMusicDatabase::GetArtForItem | ( | int | songId, |
int | albumId, | ||
int | artistId, | ||
bool | bPrimaryArtist, | ||
std::vector< ArtForThumbLoader > & | art ) |
Fetch all related art for a database item. Fetches multiple pieces of art for a database item including that for related media types Given song id art for the related album, artist(s) and albumartist(s) will also be fetched, looking up the album and artist when ids are not provided. Given album id (and not song id) art for the related artist(s) will also be fetched, looking up the artist(s) when id are not provided.
songId | the id in the song table, -1 when song art not being fetched |
albumId | the id in the album table, -1 when album art not being fetched |
artistId | the id in the artist table, -1 when artist not known |
bPrimaryArtist | true if art from only the first song artist or album artist is to be fetched |
art | [out] a vector, each element having media type e.g. "artist", "album" or "song", artType e.g. "thumb", "fanart", etc., prefix of "", "artist" or "albumartist" etc. giving the kind of artist relationship, and the original url of the art. |
std::string CMusicDatabase::GetArtistById | ( | int | id | ) |
int CMusicDatabase::GetArtistByName | ( | const std::string & | strArtist | ) |
int CMusicDatabase::GetArtistCountForRole | ( | const std::string & | strRole | ) |
bool CMusicDatabase::GetArtistDiscography | ( | int | idArtist, |
CFileItemList & | items ) |
bool CMusicDatabase::GetArtistFolderName | ( | const std::string & | strArtist, |
const std::string & | strMusicBrainzArtistID, | ||
std::string & | strFolder ) |
int CMusicDatabase::GetArtistFromMBID | ( | const std::string & | strMusicBrainzArtistID, |
std::string & | artistname ) |
std::string CMusicDatabase::GetArtistLinksUpdated | ( | ) |
bool CMusicDatabase::GetArtistsByWhere | ( | const std::string & | strBaseDir, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetArtistsByWhereJSON | ( | const std::set< std::string > & | fields, |
const std::string & | baseDir, | ||
CVariant & | result, | ||
int & | total, | ||
const SortDescription & | sortDescription = SortDescription() ) |
std::string CMusicDatabase::GetArtistsLastAdded | ( | ) |
std::string CMusicDatabase::GetArtistsLastModified | ( | ) |
bool CMusicDatabase::GetArtistsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
bool | albumArtistsOnly = false, | ||
int | idGenre = -1, | ||
int | idAlbum = -1, | ||
int | idSong = -1, | ||
const Filter & | filter = Filter(), | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetArtTypes | ( | const MediaType & | mediaType, |
std::vector< std::string > & | artTypes ) |
Fetch the distinct types of art held in the database for a type of media.
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
artTypes | [out] the types of art e.g. "thumb", "fanart", etc. |
std::vector< CScraperUrl::SUrlEntry > CMusicDatabase::GetAvailableArtForItem | ( | int | mediaId, |
const MediaType & | mediaType, | ||
const std::string & | artType ) |
Fetch the list of available-but-unassigned art URLs held in the database for a specific media item and art type.
mediaId | the id in the media (artist/album) table. |
mediaType | corresponds to the table the item resides in (artist/album). |
artType | e.g. "thumb", "fanart", etc. |
std::vector< std::string > CMusicDatabase::GetAvailableArtTypesForItem | ( | int | mediaId, |
const MediaType & | mediaType ) |
Fetch the distinct types of available-but-unassigned art held in the database for a specific media item.
mediaId | the id in the media (artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (artist/album). |
|
inlineoverrideprotectedvirtual |
Implements CDatabase.
int CMusicDatabase::GetBoxsetsCount | ( | ) |
bool CMusicDatabase::GetCommonNav | ( | const std::string & | strBaseDir, |
const std::string & | table, | ||
const std::string & | labelField, | ||
CFileItemList & | items, | ||
const Filter & | filter, | ||
bool | countOnly ) |
int CMusicDatabase::GetCompilationAlbumsCount | ( | ) |
bool CMusicDatabase::GetDiscsByWhere | ( | CMusicDbUrl & | musicUrl, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetDiscsByWhere | ( | const std::string & | baseDir, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetDiscsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
int | idAlbum, | ||
const Filter & | filter = Filter(), | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | countOnly = false ) |
|
overridevirtual |
Reimplemented from CDatabase.
std::string CMusicDatabase::GetGenreById | ( | int | id | ) |
int CMusicDatabase::GetGenreByName | ( | const std::string & | strGenre | ) |
bool CMusicDatabase::GetGenresJSON | ( | CFileItemList & | items, |
bool | bSources = false ) |
std::string CMusicDatabase::GetGenresLastAdded | ( | ) |
bool CMusicDatabase::GetGenresNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
bool | countOnly = false ) |
std::string CMusicDatabase::GetItemById | ( | const std::string & | itemType, |
int | id ) |
bool CMusicDatabase::GetItems | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
const SortDescription & | sortDescription = SortDescription() ) |
bool CMusicDatabase::GetItems | ( | const std::string & | strBaseDir, |
const std::string & | itemType, | ||
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
const SortDescription & | sortDescription = SortDescription() ) |
int CMusicDatabase::GetLastArtist | ( | ) |
std::string CMusicDatabase::GetLibraryLastCleaned | ( | ) |
std::string CMusicDatabase::GetLibraryLastUpdated | ( | ) |
bool CMusicDatabase::GetMatchingMusicVideoAlbum | ( | const std::string & | strAlbum, |
const std::string & | strArtist, | ||
int & | idAlbum, | ||
std::string & | strReview ) |
|
inlineoverrideprotectedvirtual |
Reimplemented from CDatabase.
bool CMusicDatabase::GetMusicLabelsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
bool | countOnly = false ) |
|
virtual |
Check if music files need all tags rescanning regardless of file being unchanged because the tag processing has changed (which may happen without db version changes) since they where last scanned.
int CMusicDatabase::GetOrderFilter | ( | const std::string & | type, |
const SortDescription & | sorting, | ||
Filter & | filter ) |
bool CMusicDatabase::GetPathHash | ( | const std::string & | path, |
std::string & | hash ) |
bool CMusicDatabase::GetPaths | ( | std::set< std::string > & | paths | ) |
unsigned int CMusicDatabase::GetRandomSongIDs | ( | const Filter & | filter, |
std::vector< std::pair< int, int > > & | songIDs ) |
Gets song IDs in random order that match the filter criteria.
filter | the criteria to apply in the query |
songIDs | a vector of <1, id> pairs suited to party mode use |
bool CMusicDatabase::GetRecentlyAddedAlbumSongs | ( | const std::string & | strBaseDir, |
CFileItemList & | item, | ||
unsigned int | limit = 0 ) |
bool CMusicDatabase::GetRecentlyPlayedAlbumSongs | ( | const std::string & | strBaseDir, |
CFileItemList & | item ) |
std::string CMusicDatabase::GetRoleById | ( | int | id | ) |
int CMusicDatabase::GetRoleByName | ( | const std::string & | strRole | ) |
bool CMusicDatabase::GetRolesNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter() ) |
bool CMusicDatabase::GetScraper | ( | int | id, |
const CONTENT_TYPE & | content, | ||
ADDON::ScraperPtr & | scraper ) |
int CMusicDatabase::GetSinglesCount | ( | ) |
int CMusicDatabase::GetSongByArtistAndAlbumAndTitle | ( | const std::string & | strArtist, |
const std::string & | strAlbum, | ||
const std::string & | strTitle ) |
bool CMusicDatabase::GetSongByFileName | ( | const std::string & | strFileName, |
CSong & | song, | ||
int64_t | startOffset = 0 ) |
bool CMusicDatabase::GetSongsByPath | ( | const std::string & | strPath, |
MAPSONGS & | songmap, | ||
bool | bAppendToMap = false ) |
bool CMusicDatabase::GetSongsByWhere | ( | const std::string & | baseDir, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription() ) |
bool CMusicDatabase::GetSongsByWhereJSON | ( | const std::set< std::string > & | fields, |
const std::string & | baseDir, | ||
CVariant & | result, | ||
int & | total, | ||
const SortDescription & | sortDescription = SortDescription() ) |
bool CMusicDatabase::GetSongsByYear | ( | const std::string & | baseDir, |
CFileItemList & | items, | ||
int | year ) |
bool CMusicDatabase::GetSongsFullByWhere | ( | const std::string & | baseDir, |
const Filter & | filter, | ||
CFileItemList & | items, | ||
const SortDescription & | sortDescription = SortDescription(), | ||
bool | artistData = false ) |
std::string CMusicDatabase::GetSongsLastAdded | ( | ) |
std::string CMusicDatabase::GetSongsLastModified | ( | ) |
bool CMusicDatabase::GetSongsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
int | idGenre, | ||
int | idArtist, | ||
int | idAlbum, | ||
const SortDescription & | sortDescription = SortDescription() ) |
std::string CMusicDatabase::GetSourceById | ( | int | id | ) |
int CMusicDatabase::GetSourceByName | ( | const std::string & | strSource | ) |
int CMusicDatabase::GetSourceFromPath | ( | const std::string & | strPath | ) |
bool CMusicDatabase::GetSources | ( | CFileItemList & | items | ) |
bool CMusicDatabase::GetSourcesNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter(), | ||
bool | countOnly = false ) |
bool CMusicDatabase::GetTop100 | ( | const std::string & | strBaseDir, |
CFileItemList & | items ) |
bool CMusicDatabase::GetTop100AlbumSongs | ( | const std::string & | strBaseDir, |
CFileItemList & | item ) |
|
inline |
std::vector< std::string > CMusicDatabase::GetUsedImages | ( | const std::vector< std::string > & | imagesToCheck | ) | const |
Check the passed in list of images if used in this database. Used to clean the image cache.
imagesToCheck |
bool CMusicDatabase::GetYearsNav | ( | const std::string & | strBaseDir, |
CFileItemList & | items, | ||
const Filter & | filter = Filter() ) |
void CMusicDatabase::ImportFromXML | ( | const std::string & | xmlFile, |
CGUIDialogProgress * | progressDialog = nullptr ) |
bool CMusicDatabase::ImportSongHistory | ( | const std::string & | xmlFile, |
const int | total, | ||
CGUIDialogProgress * | progressDialog = nullptr ) |
Increment the playcount of an item Increments the playcount and updates the last played date.
item | CFileItem to increment the playcount for |
bool CMusicDatabase::InsideScannedPath | ( | const std::string & | path | ) |
Checks if the given path is inside a folder that has already been scanned into the library.
path | the path we want to check |
bool CMusicDatabase::RemoveArtForItem | ( | int | mediaId, |
const MediaType & | mediaType, | ||
const std::set< std::string > & | artTypes ) |
Remove art for a database item. Removes multiple pieces of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
arttypes | a set of types, e.g. "thumb", "fanart", etc. to be removed. |
bool CMusicDatabase::RemoveArtForItem | ( | int | mediaId, |
const MediaType & | mediaType, | ||
const std::string & | artType ) |
Remove art for a database item. Removes a single piece of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
artType | the type of art to remove, eg "thumb", "fanart". |
bool CMusicDatabase::RemoveSource | ( | const std::string & | strName | ) |
bool CMusicDatabase::ScraperInUse | ( | const std::string & | scraperID | ) | const |
Check whether a given scraper is in use.
scraperID | the scraper to check for. |
bool CMusicDatabase::Search | ( | const std::string & | search, |
CFileItemList & | items ) |
bool CMusicDatabase::SearchAlbumsByArtistName | ( | const std::string & | strArtist, |
CFileItemList & | items ) |
void CMusicDatabase::SetArtForItem | ( | int | mediaId, |
const std::string & | mediaType, | ||
const std::map< std::string, std::string > & | art ) |
Sets art for a database item. Sets multiple pieces of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
art | a map of <type, url> where type is "thumb", "fanart", etc. and url is the original url of the art. |
void CMusicDatabase::SetArtForItem | ( | int | mediaId, |
const std::string & | mediaType, | ||
const std::string & | artType, | ||
const std::string & | url ) |
Sets art for a database item. Sets a single piece of art for a database item.
mediaId | the id in the media (song/artist/album) table. |
mediaType | the type of media, which corresponds to the table the item resides in (song/artist/album). |
artType | the type of art to set, e.g. "thumb", "fanart" |
url | the url to the art (this is the original url, not a cached url). |
void CMusicDatabase::SetArtistLinksUpdated | ( | ) |
void CMusicDatabase::SetLibraryLastCleaned | ( | ) |
void CMusicDatabase::SetLibraryLastUpdated | ( | ) |
Set minimum version number of db needed when tag data scanned from music files.
version | the version number of db |
Set the version number of tag data.
version | the version number of db when tags last scanned, 0 (default) means current db version |
bool CMusicDatabase::SetPathHash | ( | const std::string & | path, |
const std::string & | hash ) |
bool CMusicDatabase::SetScraper | ( | int | id, |
const CONTENT_TYPE & | content, | ||
const ADDON::ScraperPtr & | scraper ) |
bool CMusicDatabase::SetScraperAll | ( | const std::string & | strBaseDir, |
const ADDON::ScraperPtr & | scraper ) |
Update an album and all its nested entities (artists, songs etc)
album | the album to update |
int CMusicDatabase::UpdateAlbum | ( | int | idAlbum, |
const std::string & | strAlbum, | ||
const std::string & | strMusicBrainzAlbumID, | ||
const std::string & | strReleaseGroupMBID, | ||
const std::string & | strArtist, | ||
const std::string & | strArtistSort, | ||
const std::string & | strGenre, | ||
const std::string & | strMoods, | ||
const std::string & | strStyles, | ||
const std::string & | strThemes, | ||
const std::string & | strReview, | ||
const std::string & | strImage, | ||
const std::string & | strLabel, | ||
const std::string & | strType, | ||
const std::string & | strReleaseStatus, | ||
float | fRating, | ||
int | iUserrating, | ||
int | iVotes, | ||
const std::string & | strReleaseDate, | ||
const std::string & | strOrigReleaseDate, | ||
bool | bBoxedSet, | ||
bool | bCompilation, | ||
CAlbum::ReleaseType | releaseType, | ||
bool | bScrapedMBID ) |
int CMusicDatabase::UpdateArtist | ( | int | idArtist, |
const std::string & | strArtist, | ||
const std::string & | strSortName, | ||
const std::string & | strMusicBrainzArtistID, | ||
bool | bScrapedMBID, | ||
const std::string & | strType, | ||
const std::string & | strGender, | ||
const std::string & | strDisambiguation, | ||
const std::string & | strBorn, | ||
const std::string & | strFormed, | ||
const std::string & | strGenres, | ||
const std::string & | strMoods, | ||
const std::string & | strStyles, | ||
const std::string & | strInstruments, | ||
const std::string & | strBiography, | ||
const std::string & | strDied, | ||
const std::string & | strDisbanded, | ||
const std::string & | strYearsActive, | ||
const std::string & | strImage ) |
bool CMusicDatabase::UpdateArtistScrapedMBID | ( | int | idArtist, |
const std::string & | strMusicBrainzArtistID ) |
Propagate artist sort name into the concatenated artist sort name strings held for songs and albums.
int | idArtist to propagate sort name for, -1 means all artists |
Update a song and all its nested entities (genres, artists, contributors)
song | [in/out] the song to update, artist ids are returned in artist credits |
bArtists | to update artist credits and contributors, default is true |
bArtists | to check and log if artist links have changed, default is true |
int CMusicDatabase::UpdateSong | ( | int | idSong, |
const std::string & | strTitle, | ||
const std::string & | strMusicBrainzTrackID, | ||
const std::string & | strPathAndFileName, | ||
const std::string & | strComment, | ||
const std::string & | strMood, | ||
const std::string & | strThumb, | ||
const std::string & | artistDisp, | ||
const std::string & | artistSort, | ||
const std::vector< std::string > & | genres, | ||
int | iTrack, | ||
int | iDuration, | ||
const std::string & | strReleaseDate, | ||
const std::string & | strOrigReleaseDate, | ||
const std::string & | strDiscSubtitle, | ||
int | iTimesPlayed, | ||
int | iStartOffset, | ||
int | iEndOffset, | ||
const CDateTime & | dtLastPlayed, | ||
float | rating, | ||
int | userrating, | ||
int | votes, | ||
const ReplayGain & | replayGain, | ||
int | iBPM, | ||
int | iBitRate, | ||
int | iSampleRate, | ||
int | iChannels, | ||
const std::string & | songVideoURL ) |
Update a song in the database.
idSong | [in] the database ID of the song to update |
strTitle | [in] the title of the song (required to be non-empty) |
strMusicBrainzTrackID | [in] the MusicBrainz track ID of the song |
strPathAndFileName | [in] the path and filename to the song |
strComment | [in] the ids of the added songs |
strMood | [in] the mood of the added song |
strThumb | [in] the ids of the added songs |
artistDisp | [in] the artist name(s) display string |
artistSort | [in] the artist name(s) sort string |
genres | [in] a vector of genres to which this song belongs |
iTrack | [in] the track number and disc number of the song |
iDuration | [in] the duration of the song |
strReleaseDate | [in] the release date of the song ISO8601 format |
strOrigReleaseDate | [in] the original release date of the song ISO8601 format |
strDiscSubtitle | [in] subtitle of a disc |
iTimesPlayed | [in] the number of times the song has been played |
iStartOffset | [in] the start offset of the song (when using a single audio file with a .cue) |
iEndOffset | [in] the end offset of the song (when using a single audio file with .cue) |
dtLastPlayed | [in] the time the song was last played |
rating | [in] a rating for the song |
userrating | [in] a userrating (my rating) for the song |
votes | [in] a vote counter for the song rating |
replayGain | [in] album and track replaygain and peak values |
iBPM | [in] the beats per minute of a song |
iBitRate | [in] the bitrate of the song file |
iSampleRate | [in] the sample rate of the song file |
iChannels | [in] the number of audio channels in the song file |
songVideoURL | [in] url link to a video of the song |
int CMusicDatabase::UpdateSource | ( | const std::string & | strOldName, |
const std::string & | strName, | ||
const std::string & | strMultipath, | ||
const std::vector< std::string > & | vecPaths ) |
bool CMusicDatabase::UpdateSources | ( | ) |
|
friend |
|
friend |
|
protected |
|
protected |