MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
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 
18 class META_PUBLIC MetadataFactoryMultiResult : public QEvent
19 {
20  public:
22  results(res) {}
24 
26 
27  static Type kEventType;
28 };
29 
30 class META_PUBLIC MetadataFactorySingleResult : public QEvent
31 {
32  public:
33  MetadataFactorySingleResult(MetadataLookup *res) : QEvent(kEventType),
34  result(res) {}
36 
38 
39  static Type kEventType;
40 };
41 
42 class META_PUBLIC MetadataFactoryNoResult : public QEvent
43 {
44  public:
45  MetadataFactoryNoResult(MetadataLookup *res) : QEvent(kEventType),
46  result(res) {}
48 
50 
51  static Type kEventType;
52 };
53 
54 class META_PUBLIC MetadataFactoryVideoChanges : public QEvent
55 {
56  public:
57  MetadataFactoryVideoChanges(QList<int> adds, QList<int> movs,
58  QList<int>dels) : QEvent(kEventType),
59  additions(adds), moved(movs),
60  deleted(dels) {}
62 
63  QList<int> additions; // newly added intids
64  QList<int> moved; // intids moved to new filename
65  QList<int> deleted; // orphaned/deleted intids
66 
67  static Type kEventType;
68 };
69 
70 class META_PUBLIC MetadataFactory : public QObject
71 {
72 
73  public:
74 
75  MetadataFactory(QObject *parent);
76  ~MetadataFactory();
77 
78  void Lookup(ProgramInfo *pginfo, bool automatic = true,
79  bool getimages = true, bool allowgeneric = false);
80  void Lookup(VideoMetadata *metadata, bool automatic = true,
81  bool getimages = true, bool allowgeneric = false);
82  void Lookup(RecordingRule *recrule, bool automatic = true,
83  bool getimages = true, bool allowgeneric = false);
84  void Lookup(MetadataLookup *lookup);
85 
86  MetadataLookupList SynchronousLookup(QString title,
87  QString subtitle,
88  QString inetref,
89  int season,
90  int episode,
91  QString grabber,
92  bool allowgeneric = false);
93  MetadataLookupList SynchronousLookup(MetadataLookup *lookup);
94 
95  void VideoScan();
96  void VideoScan(QStringList hosts);
97 
98  bool IsRunning() { return m_lookupthread->isRunning() ||
99  m_imagedownload->isRunning() ||
100  m_videoscanner->isRunning(); };
101 
102  bool VideoGrabbersFunctional();
103 
104  private:
105 
106  void customEvent(QEvent *levent);
107 
108  void OnMultiResult(MetadataLookupList list);
109  void OnSingleResult(MetadataLookup *lookup);
110  void OnNoResult(MetadataLookup *lookup);
111  void OnImageResult(MetadataLookup *lookup);
112 
113  void OnVideoResult(MetadataLookup *lookup);
114 
115  QObject *m_parent;
118 
122 
123  // Variables used in synchronous mode
125  bool m_sync;
126 };
127 
128 META_PUBLIC LookupType GuessLookupType(ProgramInfo *pginfo);
129 META_PUBLIC LookupType GuessLookupType(MetadataLookup *lookup);
130 META_PUBLIC LookupType GuessLookupType(RecordingRule *recrule);
131 
132 #endif