MythTV  0.26-pre
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes
StorageGroup Class Reference

#include <storagegroup.h>

List of all members.

Public Member Functions

 StorageGroup (const QString group="", const QString hostname="", const bool allowFallback=true)
 StorageGroup constructor.
void Init (const QString group="Default", const QString hostname="", const bool allowFallback=true)
 Initilizes the groupname, hostname, and dirlist.
QString getName (void) const
QStringList GetDirList (void) const
QString GetFirstDir (bool appendSlash=false) const
QStringList GetDirFileList (QString dir, QString base, bool recursive=false)
QStringList GetFileList (QString Path, bool recursive=false)
QStringList GetFileInfoList (QString Path)
bool FileExists (QString filename)
QStringList GetFileInfo (QString filename)
QString FindFile (QString filename)
QString FindFileDir (QString filename)
QString FindNextDirMostFree (void)

Static Public Member Functions

static QString GetRelativePathname (const QString &filename)
 Returns the relative pathname of a file by comparing the filename against all Storage Group directories (and MythVideo's startupdir)
static bool FindDirs (const QString group="Default", const QString hostname="", QStringList *dirlist=NULL)
 Finds and and optionally initialize a directory list associated with a Storage Group.
static void CheckAllStorageGroupDirs (void)
static QStringList getRecordingsGroups (void)
static QStringList getGroupDirs (QString groupname, QString host)
static void ClearGroupToUseCache (void)
static QString GetGroupToUse (const QString &host, const QString &sgroup)

Static Public Attributes

static const char * kDefaultStorageDir = "/mnt/store"
static const QStringList kSpecialGroups = "Banners"

Static Private Member Functions

static void StaticInit (void)

Private Attributes

QString m_groupname
QString m_hostname
bool m_allowFallback
QStringList m_dirlist

Static Private Attributes

static bool m_staticInitDone = false
static QMutex m_staticInitLock
static QMap< QString, QString > m_builtinGroups
static QMutex s_groupToUseLock
static QHash< QString, QString > s_groupToUseCache

Detailed Description

Definition at line 11 of file storagegroup.h.


Constructor & Destructor Documentation

StorageGroup::StorageGroup ( const QString  group = "",
const QString  hostname = "",
const bool  allowFallback = true 
)

StorageGroup constructor.

Parameters:
groupstorage group to search, blank will search all groups.
hostnamehostname where to search, blank will search all hosts' directories, but only in local directory structure. This is parameter is ignored if group is an empty string.
allowFallbackallow the storage group search code to fall back if no dirs exist for the specified group/host

Definition at line 45 of file storagegroup.cpp.


Member Function Documentation

void StorageGroup::Init ( const QString  group = "Default",
const QString  hostname = "",
const bool  allowFallback = true 
)

Initilizes the groupname, hostname, and dirlist.

First attempts to find the Storage Group defined with the specified name for the given host. If not found, checks for the named Storage Group, as defined across all hosts. If not found, tries the "Default" Storage Group for the given host. If not found, tries the "Default" Storage Group, as defined across all hosts.

Parameters:
groupThe name of the Storage Group
hostnameThe host whose Storage Group definition is desired

Definition at line 101 of file storagegroup.cpp.

Referenced by getLocalStorageGroupPath(), FileServerHandler::LocalFilePath(), MainServer::LocalFilePath(), and StorageGroup().

QString StorageGroup::getName ( void  ) const [inline]

Definition at line 21 of file storagegroup.h.

QStringList StorageGroup::GetDirList ( void  ) const [inline]

Definition at line 24 of file storagegroup.h.

Referenced by Scheduler::FillRecordingDir(), and DBUtil::GetBackupDirectory().

QString StorageGroup::GetFirstDir ( bool  appendSlash = false) const

Definition at line 189 of file storagegroup.cpp.

Referenced by HttpConfig::ProcessRequest().

QStringList StorageGroup::GetDirFileList ( QString  dir,
QString  base,
bool  recursive = false 
)

Definition at line 203 of file storagegroup.cpp.

Referenced by GetFileList().

QStringList StorageGroup::GetFileList ( QString  Path,
bool  recursive = false 
)
QStringList StorageGroup::GetFileInfoList ( QString  Path)
bool StorageGroup::FileExists ( QString  filename)

Definition at line 332 of file storagegroup.cpp.

Referenced by GetFileInfo(), and ProgramInfo::GetPlaybackURL().

QStringList StorageGroup::GetFileInfo ( QString  filename)
QString StorageGroup::GetRelativePathname ( const QString &  filename) [static]

Returns the relative pathname of a file by comparing the filename against all Storage Group directories (and MythVideo's startupdir)

Parameters:
filenameThe full pathname of the file to use
Returns:
The relative path if it can be determined, otherwise the full input filename is returned back to the caller.

Definition at line 399 of file storagegroup.cpp.

Referenced by ProgramInfo::ClearMarkupMap(), ProgramInfo::ClearPositionMap(), doUpgradeVideoDatabaseSchema(), FileServerHandler::HandleDownloadFile(), MainServer::HandleDownloadFile(), ProgramInfo::QueryMarkupMap(), ProgramInfo::QueryPositionMap(), ProgramInfo::SaveMarkupMap(), ProgramInfo::SavePositionMap(), and ProgramInfo::SavePositionMapDelta().

bool StorageGroup::FindDirs ( const QString  group = "Default",
const QString  hostname = "",
QStringList *  dirlist = NULL 
) [static]

Finds and and optionally initialize a directory list associated with a Storage Group.

Parameters:
groupThe name of the Storage Group
hostnameThe host whose directory list should be checked, first
dirlistOptional pointer to a QStringList to hold found dir list
Returns:
true if directories were found

Definition at line 515 of file storagegroup.cpp.

Referenced by GetGroupToUse(), and Init().

QString StorageGroup::FindFile ( QString  filename)
QString StorageGroup::FindFileDir ( QString  filename)

Definition at line 604 of file storagegroup.cpp.

Referenced by FindFile(), and FindFileDir().

Definition at line 711 of file storagegroup.cpp.

Referenced by run_backend().

QStringList StorageGroup::getRecordingsGroups ( void  ) [static]

Definition at line 771 of file storagegroup.cpp.

Referenced by StoreOptMixin::Load().

QStringList StorageGroup::getGroupDirs ( QString  groupname,
QString  host 
) [static]

Definition at line 797 of file storagegroup.cpp.

Referenced by GetVideoDirsByHost().

Definition at line 842 of file storagegroup.cpp.

Referenced by PBHEventHandler::PBHEventHandler(), and VideoDialog::VideoDialog().

QString StorageGroup::GetGroupToUse ( const QString &  host,
const QString &  sgroup 
) [static]

Definition at line 848 of file storagegroup.cpp.

Referenced by generate_file_url(), generate_myth_url(), and RemoteGetFileList().

void StorageGroup::StaticInit ( void  ) [static, private]

Definition at line 59 of file storagegroup.cpp.

Referenced by FindDirs(), GetRelativePathname(), and Init().


Member Data Documentation

const char * StorageGroup::kDefaultStorageDir = "/mnt/store" [static]

Definition at line 46 of file storagegroup.h.

Referenced by FindNextDirMostFree(), and Init().

const QStringList StorageGroup::kSpecialGroups = "Banners" [static]

Definition at line 58 of file storagegroup.h.

Referenced by StaticInit().

QMutex StorageGroup::m_staticInitLock [static, private]

Definition at line 59 of file storagegroup.h.

Referenced by StaticInit().

QString StorageGroup::m_groupname [private]

Definition at line 61 of file storagegroup.h.

Referenced by CheckAllStorageGroupDirs(), FindFileDir(), Init(), and StorageGroup().

QString StorageGroup::m_hostname [private]

Definition at line 62 of file storagegroup.h.

Referenced by Init(), and StorageGroup().

Definition at line 63 of file storagegroup.h.

Referenced by FindFileDir(), FindNextDirMostFree(), Init(), and StorageGroup().

QStringList StorageGroup::m_dirlist [private]
QMap< QString, QString > StorageGroup::m_builtinGroups [static, private]

Definition at line 66 of file storagegroup.h.

Referenced by FindDirs(), GetRelativePathname(), Init(), and StaticInit().

QMutex StorageGroup::s_groupToUseLock [static, private]

Definition at line 68 of file storagegroup.h.

Referenced by ClearGroupToUseCache(), and GetGroupToUse().

QHash< QString, QString > StorageGroup::s_groupToUseCache [static, private]

Definition at line 69 of file storagegroup.h.

Referenced by ClearGroupToUseCache(), and GetGroupToUse().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends