sbIMediaScanQuery Interface Reference

An object to scan through the files of a folder (and optionally subfolders). More...

import "sbIMediaLibrary.idl";

List of all members.

Public Member Functions

void setDirectory (in AString strDirectory)
 Set the directory to scan.
AString getDirectory ()
 Get the directory to scan.
void setRecurse (in PRBool bRecurse)
 Set the scan to run recursively under the given directory.
PRBool getRecurse ()
 Whether or not the scan will run recursively.
void setCallback (in sbIMediaScanCallback pCallback)
 Set the callback object for the scan.
sbIMediaScanCallback getCallback ()
 Get the callback object for the scan.
PRUint32 getFileCount ()
 Get the number of files found.
void addFilePath (in AString strFilePath)
 USER CODE SHOULD NOT REFERENCE THIS METHOD.
AString getFilePath (in PRUint32 nIndex)
 Get the N'th file from the results of the scan.
PRBool isScanning ()
 Whether or not the scan operation is executing.
void setIsScanning (in PRBool bIsScanning)
 USER CODE SHOULD NOT REFERENCE THIS METHOD.
AString getLastFileFound ()
 Returns the most recent file found by the scan.
AString getCurrentScanPath ()
 Returns the most recent directory scanned.
void setCurrentScanPath (in AString strScanPath)
 USER CODE SHOULD NOT REFERENCE THIS METHOD.


Detailed Description

An object to scan through the files of a folder (and optionally subfolders).

This object is used to rapidly gather a list of all the files found under a given directory path. It runs from a separate thread.

User code may call getCurrentScanPath() and getLastFileFound() from the main thread to get a periodic snapshot of the current progress of the scan.

Execute a scan by creating a scan query, filling it out, and passing it to the sbIMediaScan interface for processing:

function ScanBeneathADirectory(aPath) {
  // Create the objects
  var aMediaScan = Components.classes["@songbirdnest.com/Songbird/MediaScan;1"]
    .createInstance(Components.interfaces.sbIMediaScan);
  var aMediaScanQuery = Components.classes["@songbirdnest.com/Songbird/MediaScanQuery;1"]
    .createInstance(Components.interfaces.sbIMediaScanQuery);

  // Setup the query
  aMediaScanQuery.setDirectory(aPath);
  aMediaScanQuery.setRecurse(true);
          
  // Execute the query
  aMediaScan.submitQuery(aMediaScanQuery);
  return aMediaScanQuery;
}

See also:
sbIMediaScanCallback, sbIMediaScan, MediaScan.h

Definition at line 527 of file sbIMediaLibrary.idl.


Member Function Documentation

sbIMediaScanCallback sbIMediaScanQuery::getCallback (  ) 

Get the callback object for the scan.

Returns:
The callback object
See also:
sbIMediaScanCallback, setCallback

AString sbIMediaScanQuery::getCurrentScanPath (  ) 

Returns the most recent directory scanned.

This method may be called while the scan is executing to provide a periodic snapshot of the scan results.

Returns:
The path to the last file found
See also:
getLastFileFound, setCurrentScanPath

AString sbIMediaScanQuery::getDirectory (  ) 

Get the directory to scan.

Returns:
The directory to scan
See also:
setDirectory, setRecurse, getRecurse

PRUint32 sbIMediaScanQuery::getFileCount (  ) 

Get the number of files found.

Returns:
The number of files found
See also:
getFilePath

AString sbIMediaScanQuery::getFilePath ( in PRUint32  nIndex  ) 

Get the N'th file from the results of the scan.

Don't call this while isScanning() is true.

Parameters:
nIndex The index of the files array to retrieve
See also:
getFileCount

AString sbIMediaScanQuery::getLastFileFound (  ) 

Returns the most recent file found by the scan.

This method may be called while the scan is executing to provide a periodic snapshot of the scan results.

Returns:
The path to the last file found
See also:
getCurrentScanPath

PRBool sbIMediaScanQuery::getRecurse (  ) 

Whether or not the scan will run recursively.

Returns:
If true, scan subdirectories
See also:
setDirectory, getDirectory, setRecurse

PRBool sbIMediaScanQuery::isScanning (  ) 

Whether or not the scan operation is executing.

Returns:
True, if the scan is executing
See also:
sbIDatabaseQuery

void sbIMediaScanQuery::setCallback ( in sbIMediaScanCallback  pCallback  ) 

Set the callback object for the scan.

Parameters:
pCallback The callback object
See also:
sbIMediaScanCallback, getCallback

void sbIMediaScanQuery::setDirectory ( in AString  strDirectory  ) 

Set the directory to scan.

Parameters:
strDirectory The directory to scan
See also:
getDirectory, setRecurse, getRecurse

void sbIMediaScanQuery::setRecurse ( in PRBool  bRecurse  ) 

Set the scan to run recursively under the given directory.

Parameters:
bRecurse If true, scan subdirectories
See also:
setDirectory, getDirectory, getRecurse


The documentation for this interface was generated from the following file:
Generated on Mon Aug 21 21:01:55 2006 for Songbird by  doxygen 1.4.7