![]() |
Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
|
Queue for music library jobs. More...
#include <MusicLibraryQueue.h>
Public Member Functions | |
~CMusicLibraryQueue () override | |
void | ExportLibrary (const CLibExportSettings &settings, bool showDialog=false) |
Enqueue a music library export job. More... | |
void | ImportLibrary (const std::string &xmlFile, bool showDialog=false) |
Enqueue a music library import job. More... | |
void | ScanLibrary (const std::string &strDirectory, int flags=0, bool showProgress=true) |
Enqueue a music library update job, scanning tags embedded in music files and optionally scraping additional data. More... | |
void | StartAlbumScan (const std::string &strDirectory, bool refresh=false) |
Enqueue an album scraping job fetching additional album data. More... | |
void | StartArtistScan (const std::string &strDirectory, bool refresh=false) |
Enqueue an artist scraping job fetching additional artist data. More... | |
bool | IsScanningLibrary () const |
Check if a library scan or cleaning is in progress. More... | |
void | StopLibraryScanning () |
Stop and dequeue all scanning jobs. More... | |
void | CleanLibrary (bool showDialog=false) |
Enqueue an asynchronous library cleaning job. More... | |
void | CleanLibraryModal () |
Executes a library cleaning with a modal dialog. However UI rendering of dialog is on same thread as the cleaning process, so mouse movement is stilted and opportunities to cancel the process limited. More... | |
void | AddJob (CMusicLibraryJob *job) |
Adds the given job to the queue. More... | |
void | CancelJob (CMusicLibraryJob *job) |
Cancels the given job and removes it from the queue. More... | |
void | CancelAllJobs () |
Cancels all running and queued jobs. More... | |
bool | IsRunning () const |
Whether any jobs are running or not. More... | |
Static Public Member Functions | |
static CMusicLibraryQueue & | GetInstance () |
Gets the singleton instance of the music library queue. More... | |
Protected Member Functions | |
void | OnJobComplete (unsigned int jobID, bool success, CJob *job) override |
The callback used when a job completes. More... | |
void | Refresh () |
Notifies all to refresh the current listings. More... | |
![]() | |
bool | QueueEmpty () const |
Returns if we still have jobs waiting to be processed NOTE: This function does not take into account the jobs that are currently processing. More... | |
CJobQueue (bool lifo=false, unsigned int jobsAtOnce=1, CJob::PRIORITY priority=CJob::PRIORITY_LOW) | |
CJobQueue constructor. More... | |
~CJobQueue () override | |
CJobQueue destructor Cancels any in-process jobs, and destroys the job queue. More... | |
bool | AddJob (CJob *job) |
Add a job to the queue On completion of the job (or destruction of the job queue) the CJob object will be destroyed. More... | |
template<typename F > | |
void | Submit (F &&f) |
Add a function f to this job queue. More... | |
void | CancelJob (const CJob *job) |
Cancel a job in the queue Cancels a job in the queue. Any job currently being processed may complete after this call has completed, but OnJobComplete will not be performed. If the job is only queued then it will be removed from the queue and deleted. More... | |
void | CancelJobs () |
Cancel all jobs in the queue Removes all jobs from the queue. Any job currently being processed may complete after this call has completed, but OnJobComplete will not be performed. More... | |
bool | IsProcessing () const |
Check whether the queue is processing a job. More... | |
void | OnJobComplete (unsigned int jobID, bool success, CJob *job) override |
The callback used when a job completes. More... | |
![]() | |
virtual | ~IJobCallback ()=default |
Destructor for job call back objects. More... | |
virtual void | OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job) |
An optional callback function that a job may call while processing. More... | |
Queue for music library jobs.
The queue can only process a single job at any time and every job will be executed at the lowest priority.
|
override |
void CMusicLibraryQueue::AddJob | ( | CMusicLibraryJob * | job | ) |
Adds the given job to the queue.
[in] | job | Music library job to be queued. |
void CMusicLibraryQueue::CancelAllJobs | ( | ) |
Cancels all running and queued jobs.
void CMusicLibraryQueue::CancelJob | ( | CMusicLibraryJob * | job | ) |
Cancels the given job and removes it from the queue.
[in] | job | Music library job to be canceled and removed from the queue. |
void CMusicLibraryQueue::CleanLibrary | ( | bool | showDialog = false | ) |
Enqueue an asynchronous library cleaning job.
[in] | showDialog | Show a model progress dialog while cleaning. Default is false. |
void CMusicLibraryQueue::CleanLibraryModal | ( | ) |
Executes a library cleaning with a modal dialog. However UI rendering of dialog is on same thread as the cleaning process, so mouse movement is stilted and opportunities to cancel the process limited.
void CMusicLibraryQueue::ExportLibrary | ( | const CLibExportSettings & | settings, |
bool | showDialog = false |
||
) |
Enqueue a music library export job.
[in] | settings | Library export settings |
[in] | showDialog | Show a progress dialog while (asynchronously) exporting, otherwise export in synchronous |
|
static |
Gets the singleton instance of the music library queue.
void CMusicLibraryQueue::ImportLibrary | ( | const std::string & | xmlFile, |
bool | showDialog = false |
||
) |
Enqueue a music library import job.
[in] | xmlFile | xml file to import |
[in] | showDialog | Show a progress dialog while (asynchronously) exporting, otherwise export in synchronous |
bool CMusicLibraryQueue::IsRunning | ( | ) | const |
Whether any jobs are running or not.
bool CMusicLibraryQueue::IsScanningLibrary | ( | ) | const |
Check if a library scan or cleaning is in progress.
|
overrideprotectedvirtual |
The callback used when a job completes.
OnJobComplete is called at the completion of the job's DoWork() function, and is used to return information to the caller on the result of the job. On returning form this function the CJobManager will destroy this job.
jobID | the unique id of the job (as retrieved from CJobManager::AddJob) |
success | the result from the DoWork call |
job | the job that has been processed. The job will be destroyed after this function returns |
Implements IJobCallback.
|
protected |
Notifies all to refresh the current listings.
void CMusicLibraryQueue::ScanLibrary | ( | const std::string & | strDirectory, |
int | flags = 0 , |
||
bool | showProgress = true |
||
) |
Enqueue a music library update job, scanning tags embedded in music files and optionally scraping additional data.
[in] | strDirectory | Directory to scan or "" (empty string) for a global scan. |
[in] | flags | Flags for controlling the scanning process. See xbmc/music/infoscanner/MusicInfoScanner.h for possible values. |
[in] | showProgress | Whether or not to show a progress dialog. Defaults to true |
void CMusicLibraryQueue::StartAlbumScan | ( | const std::string & | strDirectory, |
bool | refresh = false |
||
) |
Enqueue an album scraping job fetching additional album data.
[in] | strDirectory | Virtual path that identifies which albums to process or "" (empty string) for all albums |
[in] | refresh | Whether or not to refresh data for albums that have previously been scraped |
void CMusicLibraryQueue::StartArtistScan | ( | const std::string & | strDirectory, |
bool | refresh = false |
||
) |
Enqueue an artist scraping job fetching additional artist data.
[in] | strDirectory | Virtual path that identifies which artists to process or "" (empty string) for all artists |
[in] | refresh | Whether or not to refresh data for artists that have previously been scraped |
void CMusicLibraryQueue::StopLibraryScanning | ( | ) |
Stop and dequeue all scanning jobs.