MythTV  master
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 
13 {
14  Q_DECLARE_TR_FUNCTIONS(MusicFileScanner)
15 
17  {
21  kBoth
22  };
23 
25  {
26  QString startDir;
28  };
29 
30  using MusicLoadedMap = QMap <QString, MusicFileData>;
31  public:
32  MusicFileScanner(void);
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, const 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;
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 
74 #endif // _MUSICFILESCANNER_H_
bool updateLastRunEnd(void)
Definition: filldata.cpp:40
QMap< QString, int > IdCache
static QStringList BuildFileList(const QString &dir, const QStringList &filters)
QMap< QString, MusicFileData > MusicLoadedMap
#define META_PUBLIC
Definition: mythmetaexp.h:9
QStringList m_startDirs
unsigned int uint
Definition: compat.h:140
bool updateLastRunStatus(QString &status)
Definition: filldata.cpp:57
static int ScanMusic(const MythUtilCommandLineParser &)
bool updateLastRunStart(void)
Definition: filldata.cpp:48