MythTV
master
mythtv
libs
libmythmetadata
musicfilescanner.h
Go to the documentation of this file.
1
#ifndef MUSICFILESCANNER_H
2
#define MUSICFILESCANNER_H
3
4
// MythTV
5
#include "
mythmetaexp.h
"
6
7
// Qt headers
8
#include <QCoreApplication>
9
10
using
IdCache
= QMap<QString, int>;
11
12
class
META_PUBLIC
MusicFileScanner
13
{
14
Q_DECLARE_TR_FUNCTIONS(
MusicFileScanner
)
15
16
enum
MusicFileLocation
: std::uint8_t
17
{
18
kFileSystem
,
19
kDatabase
,
20
kNeedUpdate
,
21
kBoth
22
};
23
24
struct
MusicFileData
25
{
26
QString
startDir
;
27
MusicFileLocation
location {kFileSystem};
28
};
29
30
using
MusicLoadedMap
= QMap <QString, MusicFileData>;
31
public
:
32
explicit
MusicFileScanner
(
bool
force
=
false
);
33
~
MusicFileScanner
(
void
) =
default
;
34
35
void
SearchDirs(
const
QStringList &dirList);
36
37
static
bool
IsRunning(
void
);
38
39
private
:
40
void
BuildFileList
(QString &directory,
MusicLoadedMap
&music_files,
MusicLoadedMap
&art_files,
int
parentid);
41
static
int
GetDirectoryId(
const
QString &directory,
int
parentid);
42
static
bool
HasFileChanged(
const
QString &
filename
,
const
QString &date_modified);
43
void
AddFileToDB(
const
QString &
filename
,
const
QString &startDir);
44
void
RemoveFileFromDB (
const
QString &
filename
,
const
QString &startDir);
45
void
UpdateFileInDB(
const
QString &
filename
,
const
QString &startDir);
46
void
ScanMusic
(
MusicLoadedMap
&music_files);
47
void
ScanArtwork(
MusicLoadedMap
&music_files);
48
static
void
cleanDB();
49
static
bool
IsArtFile(
const
QString &
filename
);
50
static
bool
IsMusicFile(
const
QString &
filename
);
51
52
static
void
updateLastRunEnd
(
void
);
53
static
void
updateLastRunStart
(
void
);
54
static
void
updateLastRunStatus
(QString &status);
55
56
QStringList
m_startDirs
;
57
IdCache
m_directoryid
;
58
IdCache
m_artistid
;
59
IdCache
m_genreid
;
60
IdCache
m_albumid
;
61
62
uint
m_tracksTotal {0};
63
uint
m_tracksUnchanged {0};
64
uint
m_tracksAdded {0};
65
uint
m_tracksRemoved {0};
66
uint
m_tracksUpdated {0};
67
uint
m_coverartTotal {0};
68
uint
m_coverartUnchanged {0};
69
uint
m_coverartAdded {0};
70
uint
m_coverartRemoved {0};
71
uint
m_coverartUpdated {0};
72
73
bool
m_forceupdate {
false
};
74
};
75
76
#endif // MUSICFILESCANNER_H
MusicFileScanner::MusicLoadedMap
QMap< QString, MusicFileData > MusicLoadedMap
Definition:
musicfilescanner.h:30
updateLastRunStart
bool updateLastRunStart(void)
Definition:
filldata.cpp:46
MusicFileScanner::m_artistid
IdCache m_artistid
Definition:
musicfilescanner.h:58
force
bool force
Definition:
mythcommflag.cpp:70
mythmetaexp.h
ScanMusic
static int ScanMusic(const MythUtilCommandLineParser &cmdline)
Definition:
musicmetautils.cpp:184
MusicFileScanner::m_albumid
IdCache m_albumid
Definition:
musicfilescanner.h:60
BuildFileList
static QStringList BuildFileList(const QString &dir, const QStringList &filters)
Definition:
mythmusic.cpp:455
MusicFileScanner::MusicFileLocation
MusicFileLocation
Definition:
musicfilescanner.h:16
updateLastRunEnd
bool updateLastRunEnd(void)
Definition:
filldata.cpp:38
MusicFileScanner::kNeedUpdate
@ kNeedUpdate
Definition:
musicfilescanner.h:20
MusicFileScanner::m_directoryid
IdCache m_directoryid
Definition:
musicfilescanner.h:57
MusicFileScanner
Definition:
musicfilescanner.h:12
MusicFileScanner::m_genreid
IdCache m_genreid
Definition:
musicfilescanner.h:59
MusicFileScanner::kFileSystem
@ kFileSystem
Definition:
musicfilescanner.h:18
updateLastRunStatus
bool updateLastRunStatus(QString &status)
Definition:
filldata.cpp:55
MusicFileScanner::MusicFileData::startDir
QString startDir
Definition:
musicfilescanner.h:26
MusicFileScanner::MusicFileData
Definition:
musicfilescanner.h:24
MusicFileScanner::m_startDirs
QStringList m_startDirs
Definition:
musicfilescanner.h:56
build_compdb.filename
filename
Definition:
build_compdb.py:21
META_PUBLIC
#define META_PUBLIC
Definition:
mythmetaexp.h:9
IdCache
QMap< QString, int > IdCache
Definition:
musicfilescanner.h:10
MusicFileScanner::kDatabase
@ kDatabase
Definition:
musicfilescanner.h:19
uint
unsigned int uint
Definition:
freesurround.h:24
Generated on Sun Jan 5 2025 03:16:16 for MythTV by
1.8.17