Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CVideoLibraryQueue Class Reference

Queue for video library jobs. More...

#include <VideoLibraryQueue.h>

Inheritance diagram for CVideoLibraryQueue:
CJobQueue IJobCallback

Public Member Functions

 ~CVideoLibraryQueue () override
 
void ScanLibrary (const std::string &directory, bool scanAll=false, bool showProgress=true)
 Enqueue a library scan job.
 
bool IsScanningLibrary () const
 Check if a library scan is in progress.
 
void StopLibraryScanning ()
 Stop and dequeue all scanning jobs.
 
bool CleanLibrary (const std::set< int > &paths=std::set< int >(), bool asynchronous=true, CGUIDialogProgressBarHandle *progressBar=NULL)
 Enqueue a library cleaning job.
 
bool CleanLibraryModal (const std::set< int > &paths=std::set< int >())
 Executes a library cleaning with a modal dialog.
 
void RefreshItem (std::shared_ptr< CFileItem > item, bool ignoreNfo=false, bool forceRefresh=true, bool refreshAll=false, const std::string &searchTitle="")
 Enqueues a job to refresh the details of the given item.
 
bool RefreshItemModal (std::shared_ptr< CFileItem > item, bool forceRefresh=true, bool refreshAll=false)
 Refreshes the details of the given item with a modal dialog.
 
void MarkAsWatched (const std::shared_ptr< CFileItem > &item, bool watched)
 Queue a watched status update job.
 
void ResetResumePoint (const std::shared_ptr< CFileItem > &item)
 Queue a reset resume point job.
 
void AddJob (CVideoLibraryJob *job)
 Adds the given job to the queue.
 
void CancelJob (CVideoLibraryJob *job)
 Cancels the given job and removes it from the queue.
 
void CancelAllJobs ()
 Cancels all running and queued jobs.
 
bool IsRunning () const
 Whether any jobs are running or not.
 

Static Public Member Functions

static CVideoLibraryQueueGetInstance ()
 Gets the singleton instance of the video library queue.
 

Protected Member Functions

void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 The callback used when a job completes.
 
void Refresh ()
 Notifies all to refresh the current listings.
 
- Protected Member Functions inherited from CJobQueue
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.
 
 CJobQueue (bool lifo=false, unsigned int jobsAtOnce=1, CJob::PRIORITY priority=CJob::PRIORITY_LOW)
 CJobQueue constructor.
 
 ~CJobQueue () override
 CJobQueue destructor Cancels any in-process jobs, and destroys the job queue.
 
bool AddJob (CJob *job)
 Add a job to the queue On completion of the job, destruction of the job queue or in case the job could not be added successfully, the CJob object will be destroyed.
 
template<typename F >
void Submit (F &&f)
 Add a function f to this job queue.
 
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.
 
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.
 
bool IsProcessing () const
 Check whether the queue is processing a job.
 
void OnJobAbort (unsigned int jobID, CJob *job) override
 The callback used when a job will be aborted.
 
- Protected Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects.
 
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.
 

Detailed Description

Queue for video library jobs.

The queue can only process a single job at any time and every job will be executed at the lowest priority.

Constructor & Destructor Documentation

◆ ~CVideoLibraryQueue()

CVideoLibraryQueue::~CVideoLibraryQueue ( )
override

Member Function Documentation

◆ AddJob()

void CVideoLibraryQueue::AddJob ( CVideoLibraryJob * job)

Adds the given job to the queue.

Parameters
[in]jobVideo library job to be queued.

◆ CancelAllJobs()

void CVideoLibraryQueue::CancelAllJobs ( )

Cancels all running and queued jobs.

◆ CancelJob()

void CVideoLibraryQueue::CancelJob ( CVideoLibraryJob * job)

Cancels the given job and removes it from the queue.

Parameters
[in]jobVideo library job to be canceled and removed from the queue.

◆ CleanLibrary()

bool CVideoLibraryQueue::CleanLibrary ( const std::set< int > & paths = std::set<int>(),
bool asynchronous = true,
CGUIDialogProgressBarHandle * progressBar = NULL )

Enqueue a library cleaning job.

Parameters
[in]pathsSet with database IDs of paths to be cleaned
[in]asynchronousRun the clean job asynchronously. Defaults to true
[in]progressBarProgress bar to update in GUI. Defaults to NULL (no progress bar to update)
Returns
True if the video library cleaning job has started, false otherwise

◆ CleanLibraryModal()

bool CVideoLibraryQueue::CleanLibraryModal ( const std::set< int > & paths = std::set<int>())

Executes a library cleaning with a modal dialog.

Parameters
[in]pathsSet with database IDs of paths to be cleaned
Returns
True if the video library cleaning job has started, false otherwise

◆ GetInstance()

CVideoLibraryQueue & CVideoLibraryQueue::GetInstance ( )
static

Gets the singleton instance of the video library queue.

◆ IsRunning()

bool CVideoLibraryQueue::IsRunning ( ) const

Whether any jobs are running or not.

◆ IsScanningLibrary()

bool CVideoLibraryQueue::IsScanningLibrary ( ) const

Check if a library scan is in progress.

Returns
True if a scan is in progress, false otherwise

◆ MarkAsWatched()

void CVideoLibraryQueue::MarkAsWatched ( const std::shared_ptr< CFileItem > & item,
bool watched )

Queue a watched status update job.

Parameters
[in]itemItem to update watched status for
[in]watchedNew watched status

◆ OnJobComplete()

void CVideoLibraryQueue::OnJobComplete ( unsigned int jobID,
bool success,
CJob * job )
overrideprotectedvirtual

The callback used when a job completes.

CJobQueue implementation will cleanup the internal processing queue and then queue the next job at the job manager, if any.

Parameters
jobIDthe unique id of the job (as retrieved from CJobManager::AddJob)
successthe result from the DoWork call
jobthe job that has been processed.
See also
CJobManager, IJobCallback and CJob

Reimplemented from CJobQueue.

◆ Refresh()

void CVideoLibraryQueue::Refresh ( )
protected

Notifies all to refresh the current listings.

◆ RefreshItem()

void CVideoLibraryQueue::RefreshItem ( std::shared_ptr< CFileItem > item,
bool ignoreNfo = false,
bool forceRefresh = true,
bool refreshAll = false,
const std::string & searchTitle = "" )

Enqueues a job to refresh the details of the given item.

Parameters
[in,out]itemVideo item to be refreshed
[in]ignoreNfoWhether or not to ignore local NFO files
[in]forceRefreshWhether to force a complete refresh (including NFO or internet lookup)
[in]refreshAllWhether to refresh all sub-items (in case of a tvshow)
[in]searchTitleTitle to use for the search (instead of determining it from the item's filename/path)

◆ RefreshItemModal()

bool CVideoLibraryQueue::RefreshItemModal ( std::shared_ptr< CFileItem > item,
bool forceRefresh = true,
bool refreshAll = false )

Refreshes the details of the given item with a modal dialog.

Parameters
[in,out]itemVideo item to be refreshed
[in]forceRefreshWhether to force a complete refresh (including NFO or internet lookup)
[in]refreshAllWhether to refresh all sub-items (in case of a tvshow)
Returns
True if the item has been successfully refreshed, false otherwise.

◆ ResetResumePoint()

void CVideoLibraryQueue::ResetResumePoint ( const std::shared_ptr< CFileItem > & item)

Queue a reset resume point job.

Parameters
[in]itemItem to reset the resume point for

◆ ScanLibrary()

void CVideoLibraryQueue::ScanLibrary ( const std::string & directory,
bool scanAll = false,
bool showProgress = true )

Enqueue a library scan job.

Parameters
[in]directoryDirectory to scan
[in]scanAllIgnore exclude setting for items. Defaults to false
[in]showProgressWhether or not to show a progress dialog. Defaults to true

◆ StopLibraryScanning()

void CVideoLibraryQueue::StopLibraryScanning ( )

Stop and dequeue all scanning jobs.


The documentation for this class was generated from the following files: