MythTV  master
metadatafactory.h
Go to the documentation of this file.
1 #ifndef METADATAFACTORY_H_
2 #define METADATAFACTORY_H_
3 
4 // Needed to perform a lookup
5 #include "metadatacommon.h"
7 #include "metadatadownload.h"
8 
9 // Needed to perform scans
10 #include "videoscan.h"
11 
12 // Symbol visibility
13 #include "mythmetaexp.h"
14 
15 class VideoMetadata;
16 class RecordingRule;
17 
19 {
20  public:
22  : QEvent(kEventType), results(res) {}
23  ~MetadataFactoryMultiResult() = default;
24 
26 
27  static Type kEventType;
28 };
29 
31 {
32  public:
34  : QEvent(kEventType), result(res)
35  {
36  if (result)
37  {
38  result->IncrRef();
39  }
40  }
42  {
43  if (result)
44  {
45  result->DecrRef();
46  result = nullptr;
47  }
48  }
49 
51 
52  static Type kEventType;
53 };
54 
55 class META_PUBLIC MetadataFactoryNoResult : public QEvent
56 {
57  public:
59  : QEvent(kEventType), result(res)
60  {
61  if (result)
62  {
63  result->IncrRef();
64  }
65  }
67  {
68  if (result)
69  {
70  result->DecrRef();
71  result = nullptr;
72  }
73  }
74 
76 
77  static Type kEventType;
78 };
79 
81 {
82  public:
83  MetadataFactoryVideoChanges(QList<int> adds, QList<int> movs,
84  QList<int>dels) : QEvent(kEventType),
85  additions(adds), moved(movs),
86  deleted(dels) {}
87  ~MetadataFactoryVideoChanges() = default;
88 
89  QList<int> additions; // newly added intids
90  QList<int> moved; // intids moved to new filename
91  QList<int> deleted; // orphaned/deleted intids
92 
93  static Type kEventType;
94 };
95 
96 class META_PUBLIC MetadataFactory : public QObject
97 {
98 
99  public:
100 
101  explicit MetadataFactory(QObject *parent);
102  ~MetadataFactory();
103 
104  void Lookup(ProgramInfo *pginfo, bool automatic = true,
105  bool getimages = true, bool allowgeneric = false);
106  void Lookup(VideoMetadata *metadata, bool automatic = true,
107  bool getimages = true, bool allowgeneric = false);
108  void Lookup(RecordingRule *recrule, bool automatic = true,
109  bool getimages = true, bool allowgeneric = false);
110  void Lookup(MetadataLookup *lookup);
111 
112  MetadataLookupList SynchronousLookup(QString title,
113  QString subtitle,
114  QString inetref,
115  int season,
116  int episode,
117  QString grabber,
118  bool allowgeneric = false);
119  MetadataLookupList SynchronousLookup(MetadataLookup *lookup);
120 
121  void VideoScan();
122  void VideoScan(QStringList hosts);
123 
124  bool IsRunning() { return m_lookupthread->isRunning() ||
125  m_imagedownload->isRunning() ||
126  m_videoscanner->isRunning(); };
127 
128  bool VideoGrabbersFunctional();
129 
130  private:
131 
132  void customEvent(QEvent *levent) override; // QObject
133 
134  void OnMultiResult(MetadataLookupList list);
135  void OnSingleResult(MetadataLookup *lookup);
136  void OnNoResult(MetadataLookup *lookup);
137  void OnImageResult(MetadataLookup *lookup);
138 
139  void OnVideoResult(MetadataLookup *lookup);
140 
143 
147 
148  // Variables used in synchronous mode
150  bool m_sync;
151 };
152 
157 META_PUBLIC LookupType GuessLookupType(const QString& inetref);
158 
159 #endif
MetadataLookup * result
MetadataFactoryNoResult(MetadataLookup *res)
MetadataLookupList results
VideoMetadataListManager * m_mlm
Holds information on recordings and videos.
Definition: programinfo.h:66
MetadataFactoryMultiResult(MetadataLookupList res)
MetadataFactorySingleResult(MetadataLookup *res)
MetadataFactoryVideoChanges(QList< int > adds, QList< int > movs, QList< int >dels)
#define META_PUBLIC
Definition: mythmetaexp.h:9
MetadataDownload * m_lookupthread
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:31
META_PUBLIC LookupType GuessLookupType(ProgramInfo *pginfo)
MetadataLookupList m_returnList
MetadataImageDownload * m_imagedownload
LookupType
VideoScannerThread * m_videoscanner