FileScanner Class Reference

#include <filescanner.h>

List of all members.


Detailed Description

Definition at line 18 of file filescanner.h.


Public Member Functions

 FileScanner ()
 ~FileScanner ()
void SearchDir (QString &directory)
 Scan a directory recursively for music and albumart. Inserts, updates and removes any files any files found in the database.

Private Member Functions

void BuildFileList (QString &directory, MusicLoadedMap &music_files, int parentid)
 Builds a list of all the files found descending recursively into the given directory.
int GetDirectoryId (const QString &directory, const int &parentid)
 Get an ID for the given directory from the database. If it doesn't already exist in the database, insert it.
bool HasFileChanged (const QString &filename, const QString &date_modified)
 Check if file has been modified since given date/time.
void AddFileToDB (const QString &filename)
 Insert file details into database. If it is an audio file, read the metadata and insert that information at the same time.
void RemoveFileFromDB (const QString &filename)
 Removes a file from the database.
void UpdateFileInDB (const QString &filename)
 Updates a file in the database.
void ScanMusic (MusicLoadedMap &music_files)
 Check a list of files against musics files already in the database.
void ScanArtwork (MusicLoadedMap &music_files)
 Check a list of files against images already in the database.
void cleanDB ()
 Clear orphaned entries from the genre, artist, album and albumart tables.

Private Attributes

QString m_startdir
IdCache m_directoryid
IdCache m_artistid
IdCache m_genreid
IdCache m_albumid
Decoderm_decoder

Constructor & Destructor Documentation

FileScanner::FileScanner (  ) 

Definition at line 20 of file filescanner.cpp.

FileScanner::~FileScanner (  ) 

Definition at line 65 of file filescanner.cpp.


Member Function Documentation

void FileScanner::SearchDir ( QString &  directory  ) 

Scan a directory recursively for music and albumart. Inserts, updates and removes any files any files found in the database.

Parameters:
directory Directory to scan
Returns:
Nothing.

Definition at line 495 of file filescanner.cpp.

Referenced by MusicCallback(), preMusic(), runRipCD(), and runScan().

void FileScanner::BuildFileList ( QString &  directory,
MusicLoadedMap music_files,
int  parentid 
) [private]

Builds a list of all the files found descending recursively into the given directory.

Parameters:
directory Directory to begin search
music_files A pointer to the MusicLoadedMap to store the results
parentid The id of the parent directory in the music_directories table. The root directory should have an id of 0
Returns:
Nothing.

Definition at line 81 of file filescanner.cpp.

Referenced by SearchDir().

int FileScanner::GetDirectoryId ( const QString &  directory,
const int &  parentid 
) [private]

Get an ID for the given directory from the database. If it doesn't already exist in the database, insert it.

Parameters:
directory Relative path to directory, from base dir
parentid The id of the parent directory in the music_directories table. The root directory should have an id of 0
Returns:
Directory id

Definition at line 151 of file filescanner.cpp.

Referenced by BuildFileList().

bool FileScanner::HasFileChanged ( const QString &  filename,
const QString &  date_modified 
) [private]

Check if file has been modified since given date/time.

Parameters:
filename File to examine
date_modified Date to use in comparison
Returns:
True if file has been modified, otherwise false

Definition at line 202 of file filescanner.cpp.

Referenced by ScanMusic().

void FileScanner::AddFileToDB ( const QString &  filename  )  [private]

Insert file details into database. If it is an audio file, read the metadata and insert that information at the same time.

If it is an image file, just insert the filename and type.

Parameters:
filename Full path to file.
Returns:
Nothing.

Definition at line 235 of file filescanner.cpp.

Referenced by SearchDir().

void FileScanner::RemoveFileFromDB ( const QString &  filename  )  [private]

Removes a file from the database.

Parameters:
filename Full path to file.
Returns:
Nothing.

Definition at line 382 of file filescanner.cpp.

Referenced by SearchDir().

void FileScanner::UpdateFileInDB ( const QString &  filename  )  [private]

Updates a file in the database.

Parameters:
filename Full path to file.
Returns:
Nothing.

Definition at line 423 of file filescanner.cpp.

Referenced by SearchDir().

void FileScanner::ScanMusic ( MusicLoadedMap music_files  )  [private]

Check a list of files against musics files already in the database.

Parameters:
music_files MusicLoadedMap
Returns:
Nothing.

Definition at line 556 of file filescanner.cpp.

Referenced by SearchDir().

void FileScanner::ScanArtwork ( MusicLoadedMap music_files  )  [private]

Check a list of files against images already in the database.

Parameters:
music_files MusicLoadedMap
Returns:
Nothing.

Definition at line 615 of file filescanner.cpp.

Referenced by SearchDir().

void FileScanner::cleanDB (  )  [private]

Clear orphaned entries from the genre, artist, album and albumart tables.

Returns:
Nothing.

Definition at line 313 of file filescanner.cpp.

Referenced by SearchDir().


Member Data Documentation

QString FileScanner::m_startdir [private]

Definition at line 39 of file filescanner.h.

Referenced by AddFileToDB(), FileScanner(), and UpdateFileInDB().

Definition at line 40 of file filescanner.h.

Referenced by AddFileToDB(), FileScanner(), and UpdateFileInDB().

Definition at line 41 of file filescanner.h.

Referenced by AddFileToDB(), FileScanner(), and UpdateFileInDB().

Definition at line 43 of file filescanner.h.


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

Generated on Sat Dec 18 05:16:03 2010 for MythTV by  doxygen 1.5.5