MythTV  master
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
StorageGroup Class Reference

#include <storagegroup.h>

Public Member Functions

 StorageGroup (QString group="", QString hostname="", const bool allowFallback=true)
 StorageGroup constructor. More...
 
void Init (const QString &group="Default", const QString &hostname="", const bool allowFallback=true)
 Initilizes the groupname, hostname, and dirlist. More...
 
QString getName (void) const
 
QStringList GetDirList (void) const
 
QString GetFirstDir (bool appendSlash=false) const
 
QStringList GetDirFileList (const QString &dir, const QString &base, bool recursive=false, bool onlyDirs=false)
 
QStringList GetDirList (const QString &Path, bool recursive=false)
 
QStringList GetFileList (const QString &Path, bool recursive=false)
 
QStringList GetFileInfoList (const QString &Path)
 
bool FileExists (const QString &filename)
 
QStringList GetFileInfo (const QString &filename)
 
QString FindFile (const QString &filename)
 
QString FindFileDir (const 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) More...
 
static bool FindDirs (const QString &group="Default", const QString &hostname="", QStringList *dirlist=nullptr)
 Finds and and optionally initialize a directory list associated with a Storage Group. More...
 
static void CheckAllStorageGroupDirs (void)
 
static QStringList getRecordingsGroups (void)
 
static QStringList getGroupDirs (const QString &groupname, const 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
 

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::StorageGroup ( QString  group = "",
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 48 of file storagegroup.cpp.

Member Function Documentation

◆ Init()

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
allowFallbackallow the storage group search code to fall back if no dirs exist for the specified group/host

Definition at line 105 of file storagegroup.cpp.

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

◆ getName()

QString StorageGroup::getName ( void  ) const
inline

Definition at line 21 of file storagegroup.h.

◆ GetDirList() [1/2]

QStringList StorageGroup::GetDirList ( void  ) const
inline

◆ GetFirstDir()

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

Definition at line 188 of file storagegroup.cpp.

Referenced by HttpConfig::ProcessRequest().

◆ GetDirFileList()

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

Definition at line 201 of file storagegroup.cpp.

Referenced by GetDirList(), and GetFileList().

◆ GetDirList() [2/2]

QStringList StorageGroup::GetDirList ( const QString &  Path,
bool  recursive = false 
)

Definition at line 255 of file storagegroup.cpp.

◆ GetFileList()

QStringList StorageGroup::GetFileList ( const QString &  Path,
bool  recursive = false 
)

◆ GetFileInfoList()

QStringList StorageGroup::GetFileInfoList ( const QString &  Path)

◆ FileExists()

bool StorageGroup::FileExists ( const QString &  filename)

Definition at line 350 of file storagegroup.cpp.

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

◆ GetFileInfo()

QStringList StorageGroup::GetFileInfo ( const QString &  filename)

◆ GetRelativePathname()

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 420 of file storagegroup.cpp.

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

◆ FindDirs()

bool StorageGroup::FindDirs ( const QString &  group = "Default",
const QString &  hostname = "",
QStringList *  dirlist = nullptr 
)
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 536 of file storagegroup.cpp.

Referenced by GetGroupToUse(), Init(), and ScanMusic().

◆ FindFile()

QString StorageGroup::FindFile ( const QString &  filename)

◆ FindFileDir()

QString StorageGroup::FindFileDir ( const QString &  filename)

Definition at line 625 of file storagegroup.cpp.

Referenced by FindFile(), and FindFileDir().

◆ FindNextDirMostFree()

QString StorageGroup::FindNextDirMostFree ( void  )

◆ CheckAllStorageGroupDirs()

void StorageGroup::CheckAllStorageGroupDirs ( void  )
static

Definition at line 726 of file storagegroup.cpp.

Referenced by run_backend().

◆ getRecordingsGroups()

QStringList StorageGroup::getRecordingsGroups ( void  )
static

Definition at line 786 of file storagegroup.cpp.

Referenced by Dvr::GetRecStorageGroupList(), and StoreOptMixin::Load().

◆ getGroupDirs()

QStringList StorageGroup::getGroupDirs ( const QString &  groupname,
const QString &  host 
)
static

◆ ClearGroupToUseCache()

void StorageGroup::ClearGroupToUseCache ( void  )
static

Definition at line 858 of file storagegroup.cpp.

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

◆ GetGroupToUse()

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

Definition at line 864 of file storagegroup.cpp.

Referenced by generate_file_url(), and RemoteGetFileList().

◆ StaticInit()

void StorageGroup::StaticInit ( void  )
staticprivate

Definition at line 61 of file storagegroup.cpp.

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

Member Data Documentation

◆ kDefaultStorageDir

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

Definition at line 45 of file storagegroup.h.

Referenced by FindNextDirMostFree(), and Init().

◆ kSpecialGroups

const QStringList StorageGroup::kSpecialGroups
static
Initial value:
= QStringList()
<< QT_TRANSLATE_NOOP("(StorageGroups)", "LiveTV")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "DB Backups")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Videos")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Trailers")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Coverart")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Fanart")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Screenshots")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Banners")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Photographs")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "Music")
<< QT_TRANSLATE_NOOP("(StorageGroups)", "MusicArt")

Definition at line 46 of file storagegroup.h.

Referenced by MainServer::BackendQueryDiskSpace(), getRecordingsGroups(), StorageGroupListEditor::Load(), FileServerHandler::QueryFileSystems(), StorageGroupEditor::SetLabel(), StorageGroupEditor::ShowDeleteDialog(), and ProgramInfo::ToMap().

◆ m_staticInitDone

bool StorageGroup::m_staticInitDone = false
staticprivate

Definition at line 58 of file storagegroup.h.

Referenced by StaticInit().

◆ m_staticInitLock

QMutex StorageGroup::m_staticInitLock
staticprivate

Definition at line 59 of file storagegroup.h.

Referenced by StaticInit().

◆ m_groupname

QString StorageGroup::m_groupname
private

Definition at line 61 of file storagegroup.h.

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

◆ m_hostname

QString StorageGroup::m_hostname
private

Definition at line 62 of file storagegroup.h.

Referenced by Init(), and StorageGroup().

◆ m_allowFallback

bool StorageGroup::m_allowFallback
private

Definition at line 63 of file storagegroup.h.

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

◆ m_dirlist

QStringList StorageGroup::m_dirlist
private

◆ m_builtinGroups

QMap< QString, QString > StorageGroup::m_builtinGroups
staticprivate

Definition at line 66 of file storagegroup.h.

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

◆ s_groupToUseLock

QMutex StorageGroup::s_groupToUseLock
staticprivate

Definition at line 68 of file storagegroup.h.

Referenced by ClearGroupToUseCache(), and GetGroupToUse().

◆ s_groupToUseCache

QHash< QString, QString > StorageGroup::s_groupToUseCache
staticprivate

Definition at line 69 of file storagegroup.h.

Referenced by ClearGroupToUseCache(), and GetGroupToUse().


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