/
storagegroup.h
74 lines (55 loc) · 2.32 KB
/
storagegroup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef STORAGEGROUP_H
#define STORAGEGROUP_H
#include <QStringList>
#include <QMutex>
#include <QHash>
#include <QMap>
#include "mythbaseexp.h"
class MBASE_PUBLIC StorageGroup
{
public:
explicit StorageGroup(QString group = "", QString hostname = "",
bool allowFallback = true);
void Init(const QString &group = "Default",
const QString &hostname = "",
bool allowFallback = true);
QString getName(void) const { return m_groupname; }
QStringList GetDirList(void) const { return m_dirlist; }
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);
static QString GetRelativePathname(const QString &filename);
static bool FindDirs(const QString &group = "Default",
const QString &hostname = "",
QStringList *dirlist = nullptr);
QString FindFile(const QString &filename);
QString FindFileDir(const QString &filename);
QString FindNextDirMostFree(void);
static void CheckAllStorageGroupDirs(void);
static const char *kDefaultStorageDir;
static const QStringList kSpecialGroups;
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);
private:
static void StaticInit(void);
static bool m_staticInitDone;
static QMutex m_staticInitLock;
QString m_groupname;
QString m_hostname;
bool m_allowFallback;
QStringList m_dirlist;
static QMap<QString, QString> m_builtinGroups;
static QMutex s_groupToUseLock;
static QHash<QString,QString> s_groupToUseCache;
};
#endif // STORAGEGROUP_H
/* vim: set expandtab tabstop=4 shiftwidth=4: */