MythTV  master
storagegroup.h
Go to the documentation of this file.
1 #ifndef _STORAGEGROUP_H
2 #define _STORAGEGROUP_H
3 
4 #include <QStringList>
5 #include <QMutex>
6 #include <QHash>
7 #include <QMap>
8 
9 #include "mythbaseexp.h"
10 
12 {
13  public:
14  StorageGroup(const QString &group = "", const QString &hostname = "",
15  const bool allowFallback = true);
16 
17  void Init(const QString &group = "Default",
18  const QString &hostname = "",
19  const bool allowFallback = true);
20 
21  QString getName(void) const { return m_groupname; }
22 
23  QStringList GetDirList(void) const { return m_dirlist; }
24  QString GetFirstDir(bool appendSlash = false) const;
25 
26  QStringList GetDirFileList(const QString &dir, const QString &base,
27  bool recursive = false, bool onlyDirs = false);
28  QStringList GetDirList(const QString &Path, bool recursive = false);
29  QStringList GetFileList(const QString &Path, bool recursive = false);
30  QStringList GetFileInfoList(const QString &Path);
31  bool FileExists(const QString &filename);
32  QStringList GetFileInfo(const QString &filename);
33  static QString GetRelativePathname(const QString &filename);
34  static bool FindDirs(const QString &group = "Default",
35  const QString &hostname = "",
36  QStringList *dirlist = nullptr);
37 
38  QString FindFile(const QString &filename);
39  QString FindFileDir(const QString &filename);
40 
41  QString FindNextDirMostFree(void);
42 
43  static void CheckAllStorageGroupDirs(void);
44 
45  static const char *kDefaultStorageDir;
46  static const QStringList kSpecialGroups;
47 
48  static QStringList getRecordingsGroups(void);
49  static QStringList getGroupDirs(const QString &groupname,
50  const QString &host);
51 
52  static void ClearGroupToUseCache(void);
53  static QString GetGroupToUse(
54  const QString &host, const QString &sgroup);
55 
56  private:
57  static void StaticInit(void);
58  static bool m_staticInitDone;
59  static QMutex m_staticInitLock;
60 
61  QString m_groupname;
62  QString m_hostname;
64  QStringList m_dirlist;
65 
66  static QMap<QString, QString> m_builtinGroups;
67 
68  static QMutex s_groupToUseLock;
69  static QHash<QString,QString> s_groupToUseCache;
70 };
71 
72 #endif
73 
74 /* vim: set expandtab tabstop=4 shiftwidth=4: */
QStringList GetDirList(void) const
Definition: storagegroup.h:23
static QHash< QString, QString > s_groupToUseCache
Definition: storagegroup.h:69
static QMutex m_staticInitLock
Definition: storagegroup.h:59
static bool m_staticInitDone
Definition: storagegroup.h:58
static const QStringList kSpecialGroups
Definition: storagegroup.h:46
static QMap< QString, QString > m_builtinGroups
Definition: storagegroup.h:66
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
static QMutex s_groupToUseLock
Definition: storagegroup.h:68
static const char * kDefaultStorageDir
Definition: storagegroup.h:45
string hostname
Definition: caa.py:17
bool m_allowFallback
Definition: storagegroup.h:63
QString getName(void) const
Definition: storagegroup.h:21
QString m_hostname
Definition: storagegroup.h:62
QString m_groupname
Definition: storagegroup.h:61
QStringList m_dirlist
Definition: storagegroup.h:64