![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <MusicInfoScanner.h>
Public Types | |
enum | SCAN_FLAGS { SCAN_NORMAL = 0 , SCAN_ONLINE = 1 << 0 , SCAN_BACKGROUND = 1 << 1 , SCAN_RESCAN = 1 << 2 , SCAN_ARTISTS = 1 << 3 , SCAN_ALBUMS = 1 << 4 } |
Flags for controlling the scanning process. More... | |
![]() | |
enum class | InfoRet { CANCELLED , INFO_ERROR , NOT_NEEDED , HAVE_ALREADY , NOT_FOUND , ADDED } |
Return values from the information lookup functions. More... | |
enum class | InfoType { NONE = 0 , FULL = 1 , URL = 2 , OVERRIDE = 3 , COMBINED = 4 , ERROR_NFO = 5 , TITLE = 6 } |
Public Member Functions | |
CMusicInfoScanner () | |
~CMusicInfoScanner () override | |
void | Start (const std::string &strDirectory, int flags) |
void | FetchAlbumInfo (const std::string &strDirectory, bool refresh=false) |
void | FetchArtistInfo (const std::string &strDirectory, bool refresh=false) |
void | Stop () |
InfoRet | UpdateAlbumInfo (CAlbum &album, const ADDON::ScraperPtr &scraper, bool bAllowSelection, CGUIDialogProgress *pDialog=nullptr) |
Scrape additional album information and update the music database with it. Given an album, search for it using the given scraper. If info is found, update the database and artwork with the new information. | |
InfoRet | UpdateArtistInfo (CArtist &artist, const ADDON::ScraperPtr &scraper, bool bAllowSelection, CGUIDialogProgress *pDialog=nullptr) |
Scrape additional artist information and update the music database with it. Given an artist, search for it using the given scraper. If info is found, update the database and artwork with the new information. | |
![]() | |
virtual void | Cancel () |
virtual | ~IRunnable ()=default |
![]() | |
virtual | ~CInfoScanner ()=default |
Empty destructor. | |
void | ShowDialog (bool show) |
Set whether or not to show a progress dialog. | |
bool | IsScanning () const |
Returns whether or not a scan is in progress. | |
Static Public Member Functions | |
static void | FileItemsToAlbums (CFileItemList &items, VECALBUMS &albums, MAPSONGS *songsMap=NULL) |
Categorize FileItems into Albums, Songs, and Artists This takes a list of FileItems and turns it into a tree of Albums, Artists, and Songs. Albums are defined uniquely by the album name and album artist. | |
![]() | |
static bool | HasNoMedia (const std::string &strDirectory) |
Check if the folder is excluded from scanning process. | |
Protected Member Functions | |
virtual void | Process () |
bool | DoScan (const std::string &strDirectory) override |
InfoRet | UpdateDatabaseAlbumInfo (CAlbum &album, const ADDON::ScraperPtr &scraper, bool bAllowSelection, CGUIDialogProgress *pDialog=nullptr) |
Scrape additional album information and update the database. Search for the given album using the given scraper. If info is found, update the database and artwork with the new information. | |
InfoRet | UpdateDatabaseArtistInfo (CArtist &artist, const ADDON::ScraperPtr &scraper, bool bAllowSelection, CGUIDialogProgress *pDialog=nullptr) |
Scrape additional artist information and update the database. Search for the given artist using the given scraper. If info is found, update the database and artwork with the new information. | |
InfoRet | DownloadAlbumInfo (const CAlbum &album, const ADDON::ScraperPtr &scraper, MUSIC_GRABBER::CMusicAlbumInfo &albumInfo, bool bUseScrapedMBID, CGUIDialogProgress *pDialog=nullptr) |
Using the scrapers download metadata for an album Given a CAlbum style struct containing some data about an album, query the scrapers to try and get more information about the album. The responsibility is with the caller to do something with that information. It will be passed back in a MusicInfo struct, which you can save, display to the user or throw away. | |
InfoRet | DownloadArtistInfo (const CArtist &artist, const ADDON::ScraperPtr &scraper, MUSIC_GRABBER::CMusicArtistInfo &artistInfo, bool bUseScrapedMBID, CGUIDialogProgress *pDialog=nullptr) |
Using the scrapers download metadata for an artist Given a CAlbum style struct containing some data about an artist, query the scrapers to try and get more information about the artist. The responsibility is with the caller to do something with that information. It will be passed back in a MusicInfo struct, which you can save, display to the user or throw away. | |
std::vector< CVariant > | GetArtWhitelist (const MediaType &mediaType, int iArtLevel) |
Get the types of art for an artist or album that are to be automatically fetched from local files during scanning. | |
bool | AddLocalArtwork (std::map< std::string, std::string > &art, const std::string &mediaType, const std::string &mediaName, const std::string &artfolder, int discnum=0) |
Add extra local artwork for albums and artists This common utility scans the given folder for local (non-thumb) art. The art types checked are determined by whitelist and usealllocalart settings. | |
bool | AddRemoteArtwork (std::map< std::string, std::string > &art, const std::string &mediaType, const CScraperUrl &thumbURL) |
Add extra remote artwork for albums and artists This common utility fills the gaps in artwork using the first available art of each type from the possible art URL results of previous scraping. The art types applied are determined by whitelist and usealllocalart settings. | |
bool | AddArtistArtwork (CArtist &artist, const std::string &artfolder) |
Add art for an artist This scans the given folder for local art and/or applies the first available art of each type from the possible art URLs previously scraped. Art is added to any already stored by previous scanning etc.The art types processed are determined by whitelist and other art settings. When usealllocalart is enabled then all local image files are applied as art (providing name is valid for an art type), and then the URL list of remote art is checked adding the first available image of each art type not yet in the art map. Art found is saved in the album structure and the music database. The images found are cached. | |
bool | AddAlbumArtwork (CAlbum &album) |
Add art for an album This scans the album folder, and any disc set subfolders, for local art and/or applies the first available art of each type from the possible art URLs previously scraped. Only those subfolders beneath the album folder containing music files tagged with same unique disc number are scanned. Art is added to any already stored by previous scanning, only "thumb" is optionally replaced. The art types processed are determined by whitelist and other art settings. When usealllocalart is enabled then all local image files are applied as art (providing name is valid for an art type), and then the URL list of remote art is checked adding the first available image of each art type not yet in the art map. Art found is saved in the album structure and the music database. The images found are cached. | |
int | RetrieveMusicInfo (const std::string &strDirectory, CFileItemList &items) |
Scan in the ID3/Ogg/FLAC tags for a bunch of FileItems Given a list of FileItems, scan in the tags for those FileItems and populate a new FileItemList with the files that were successfully scanned. Add album to library, populate a list of album ids added for possible scraping later. Any files which couldn't be scanned (no/bad tags) are discarded in the process. | |
void | RetrieveLocalArt () |
void | ScrapeInfoAddedAlbums () |
InfoRet | ScanTags (const CFileItemList &items, CFileItemList &scannedItems) |
Scan in the ID3/Ogg/FLAC tags for a bunch of FileItems Given a list of FileItems, scan in the tags for those FileItems and populate a new FileItemList with the files that were successfully scanned. Any files which couldn't be scanned (no/bad tags) are discarded in the process. | |
int | GetPathHash (const CFileItemList &items, std::string &hash) |
void | Run () override |
int | CountFiles (const CFileItemList &items, bool recursive) |
int | CountFilesRecursively (const std::string &strPath) |
bool | ResolveMusicBrainz (const std::string &strMusicBrainzID, const ADDON::ScraperPtr &preferredScraper, CScraperUrl &musicBrainzURL) |
Resolve a MusicBrainzID to a URL If we have a MusicBrainz ID for an artist or album, resolve it to an MB URL and set up the scrapers accordingly. | |
void | ScannerWait (unsigned int milliseconds) |
![]() | |
CInfoScanner ()=default | |
Protected constructor to only allow subclass instances. | |
Static Protected Member Functions | |
static void | FindArtForAlbums (VECALBUMS &albums, const std::string &path) |
Find art for albums Based on the albums in the folder, finds whether we have unique album art and assigns to the album if we do. | |
Protected Attributes | |
int | m_currentItem |
int | m_itemCount |
bool | m_bStop |
bool | m_needsCleanup = false |
int | m_scanType = 0 |
int | m_idSourcePath |
CMusicDatabase | m_musicDatabase |
std::set< int > | m_albumsAdded |
std::set< std::string > | m_seenPaths |
int | m_flags |
CThread | m_fileCountReader |
![]() | |
std::set< std::string > | m_pathsToScan |
Set of paths to scan. | |
bool | m_showDialog = false |
Whether or not to show progress bar dialog. | |
CGUIDialogProgressBarHandle * | m_handle = nullptr |
Progress bar handle. | |
bool | m_bRunning = false |
Whether or not scanner is running. | |
bool | m_bCanInterrupt = false |
Whether or not scanner is currently interruptible. | |
bool | m_bClean = false |
Whether or not to perform cleaning during scanning. | |
Flags for controlling the scanning process.
Enumerator | |
---|---|
SCAN_NORMAL | |
SCAN_ONLINE | |
SCAN_BACKGROUND | |
SCAN_RESCAN | |
SCAN_ARTISTS | |
SCAN_ALBUMS |
CMusicInfoScanner::CMusicInfoScanner | ( | ) |
|
overridedefault |
Add art for an album This scans the album folder, and any disc set subfolders, for local art and/or applies the first available art of each type from the possible art URLs previously scraped. Only those subfolders beneath the album folder containing music files tagged with same unique disc number are scanned. Art is added to any already stored by previous scanning, only "thumb" is optionally replaced. The art types processed are determined by whitelist and other art settings. When usealllocalart is enabled then all local image files are applied as art (providing name is valid for an art type), and then the URL list of remote art is checked adding the first available image of each art type not yet in the art map. Art found is saved in the album structure and the music database. The images found are cached.
artist | [in/out] an album, the art is set |
|
protected |
Add art for an artist This scans the given folder for local art and/or applies the first available art of each type from the possible art URLs previously scraped. Art is added to any already stored by previous scanning etc.The art types processed are determined by whitelist and other art settings. When usealllocalart is enabled then all local image files are applied as art (providing name is valid for an art type), and then the URL list of remote art is checked adding the first available image of each art type not yet in the art map. Art found is saved in the album structure and the music database. The images found are cached.
artist | [in/out] an artist, the art is set |
artfolder | [in] path of the location to search for local art files |
|
protected |
Add extra local artwork for albums and artists This common utility scans the given folder for local (non-thumb) art. The art types checked are determined by whitelist and usealllocalart settings.
art | [in/out] map of art type and file location (URL or path) pairs |
mediaType | [in] artist or album |
mediaName | [in] artist or album name that may be stripped from image file names |
artfolder | [in] path of folder containing local image files |
|
protected |
Add extra remote artwork for albums and artists This common utility fills the gaps in artwork using the first available art of each type from the possible art URL results of previous scraping. The art types applied are determined by whitelist and usealllocalart settings.
art | [in/out] map of art type and file location (URL or path) pairs |
mediaType | [in] artist or album |
thumbURL | [in] URLs for potential remote artwork (provided by scrapers) |
|
protected |
|
protected |
|
overrideprotectedvirtual |
Implements CInfoScanner.
|
protected |
Using the scrapers download metadata for an album Given a CAlbum style struct containing some data about an album, query the scrapers to try and get more information about the album. The responsibility is with the caller to do something with that information. It will be passed back in a MusicInfo struct, which you can save, display to the user or throw away.
album | [in] a partially or fully filled out album structure containing the search query |
scraper | [in] the scraper to query, usually the default or the relevant scraper for the musicdb path |
albumInfo | [in/out] a CMusicAlbumInfo struct which will be populated with the output of the scraper |
bUseScrapedMBID | [in] should scraper use any previously scraped mbid to identify the artist, or use artist name? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
|
protected |
Using the scrapers download metadata for an artist Given a CAlbum style struct containing some data about an artist, query the scrapers to try and get more information about the artist. The responsibility is with the caller to do something with that information. It will be passed back in a MusicInfo struct, which you can save, display to the user or throw away.
artist | [in] a partially or fully filled out artist structure containing the search query |
scraper | [in] the scraper to query, usually the default or the relevant scraper for the musicdb path |
artistInfo | [in/out] a CMusicAlbumInfo struct which will be populated with the output of the scraper |
bUseScrapedMBID | [in] should scraper use any previously scraped mbid to identify the album, or use album and artist name? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
|
static |
Categorize FileItems into Albums, Songs, and Artists This takes a list of FileItems and turns it into a tree of Albums, Artists, and Songs. Albums are defined uniquely by the album name and album artist.
songs | [in/out] list of songs to categorise - albumartist field may be altered. |
albums | [out] albums found within these songs. |
|
staticprotected |
Find art for albums Based on the albums in the folder, finds whether we have unique album art and assigns to the album if we do.
In order of priority:
albums | [in/out] list of albums to categorise - art field may be altered. |
path | [in] path containing albums. |
|
protected |
Get the types of art for an artist or album that are to be automatically fetched from local files during scanning.
mediaType | [in] artist or album |
iArtLevel | [in] art level |
|
protected |
|
protectedvirtual |
|
protected |
Resolve a MusicBrainzID to a URL If we have a MusicBrainz ID for an artist or album, resolve it to an MB URL and set up the scrapers accordingly.
preferredScraper | [in] A ScraperPtr to the preferred album/artist scraper. |
musicBrainzURL | [out] will be populated with the MB URL for the artist/album. |
|
protected |
|
protected |
Scan in the ID3/Ogg/FLAC tags for a bunch of FileItems Given a list of FileItems, scan in the tags for those FileItems and populate a new FileItemList with the files that were successfully scanned. Add album to library, populate a list of album ids added for possible scraping later. Any files which couldn't be scanned (no/bad tags) are discarded in the process.
items | [in] list of FileItems to scan |
scannedItems | [in] list to populate with the scannedItems |
|
protected |
Scan in the ID3/Ogg/FLAC tags for a bunch of FileItems Given a list of FileItems, scan in the tags for those FileItems and populate a new FileItemList with the files that were successfully scanned. Any files which couldn't be scanned (no/bad tags) are discarded in the process.
items | [in] list of FileItems to scan |
scannedItems | [in] list to populate with the scannedItems |
|
protected |
void CMusicInfoScanner::Stop | ( | ) |
CInfoScanner::InfoRet CMusicInfoScanner::UpdateAlbumInfo | ( | CAlbum & | album, |
const ADDON::ScraperPtr & | scraper, | ||
bool | bAllowSelection, | ||
CGUIDialogProgress * | pDialog = nullptr ) |
Scrape additional album information and update the music database with it. Given an album, search for it using the given scraper. If info is found, update the database and artwork with the new information.
album | [in/out] the album to update |
scraper | [in] the album scraper to use |
bAllowSelection | [in] should we allow the user to manually override the info with a GUI if the album is not found? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
CInfoScanner::InfoRet CMusicInfoScanner::UpdateArtistInfo | ( | CArtist & | artist, |
const ADDON::ScraperPtr & | scraper, | ||
bool | bAllowSelection, | ||
CGUIDialogProgress * | pDialog = nullptr ) |
Scrape additional artist information and update the music database with it. Given an artist, search for it using the given scraper. If info is found, update the database and artwork with the new information.
artist | [in/out] the artist to update |
scraper | [in] the artist scraper to use |
bAllowSelection | [in] should we allow the user to manually override the info with a GUI if the album is not found? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
|
protected |
Scrape additional album information and update the database. Search for the given album using the given scraper. If info is found, update the database and artwork with the new information.
album | [in/out] the album to update |
scraper | [in] the album scraper to use |
bAllowSelection | [in] should we allow the user to manually override the info with a GUI if the album is not found? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
|
protected |
Scrape additional artist information and update the database. Search for the given artist using the given scraper. If info is found, update the database and artwork with the new information.
artist | [in/out] the artist to update |
scraper | [in] the artist scraper to use |
bAllowSelection | [in] should we allow the user to manually override the info with a GUI if the album is not found? |
pDialog | [in] a progress dialog which this and downstream functions can update with status, if required |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |