00001 #ifndef METADATAFACTORY_H_
00002 #define METADATAFACTORY_H_
00003
00004
00005 #include "metadatacommon.h"
00006 #include "metadataimagedownload.h"
00007 #include "metadatadownload.h"
00008
00009
00010 #include "videoscan.h"
00011
00012
00013 #include "mythmetaexp.h"
00014
00015 class VideoMetadata;
00016 class RecordingRule;
00017
00018 class META_PUBLIC MetadataFactoryMultiResult : public QEvent
00019 {
00020 public:
00021 MetadataFactoryMultiResult(MetadataLookupList res) : QEvent(kEventType),
00022 results(res) {}
00023 ~MetadataFactoryMultiResult() {}
00024
00025 MetadataLookupList results;
00026
00027 static Type kEventType;
00028 };
00029
00030 class META_PUBLIC MetadataFactorySingleResult : public QEvent
00031 {
00032 public:
00033 MetadataFactorySingleResult(MetadataLookup *res) : QEvent(kEventType),
00034 result(res) {}
00035 ~MetadataFactorySingleResult() {}
00036
00037 MetadataLookup *result;
00038
00039 static Type kEventType;
00040 };
00041
00042 class META_PUBLIC MetadataFactoryNoResult : public QEvent
00043 {
00044 public:
00045 MetadataFactoryNoResult(MetadataLookup *res) : QEvent(kEventType),
00046 result(res) {}
00047 ~MetadataFactoryNoResult() {}
00048
00049 MetadataLookup *result;
00050
00051 static Type kEventType;
00052 };
00053
00054 class META_PUBLIC MetadataFactoryVideoChanges : public QEvent
00055 {
00056 public:
00057 MetadataFactoryVideoChanges(QList<int> adds, QList<int> movs,
00058 QList<int>dels) : QEvent(kEventType),
00059 additions(adds), moved(movs),
00060 deleted(dels) {}
00061 ~MetadataFactoryVideoChanges() {}
00062
00063 QList<int> additions;
00064 QList<int> moved;
00065 QList<int> deleted;
00066
00067 static Type kEventType;
00068 };
00069
00070 class META_PUBLIC MetadataFactory : public QObject
00071 {
00072
00073 public:
00074
00075 MetadataFactory(QObject *parent);
00076 ~MetadataFactory();
00077
00078 void Lookup(ProgramInfo *pginfo, bool automatic = true,
00079 bool getimages = true, bool allowgeneric = false);
00080 void Lookup(VideoMetadata *metadata, bool automatic = true,
00081 bool getimages = true, bool allowgeneric = false);
00082 void Lookup(RecordingRule *recrule, bool automatic = true,
00083 bool getimages = true, bool allowgeneric = false);
00084 void Lookup(MetadataLookup *lookup);
00085
00086 MetadataLookupList SynchronousLookup(QString title,
00087 QString subtitle,
00088 QString inetref,
00089 int season,
00090 int episode,
00091 QString grabber,
00092 bool allowgeneric = false);
00093 MetadataLookupList SynchronousLookup(MetadataLookup *lookup);
00094
00095 void VideoScan();
00096 void VideoScan(QStringList hosts);
00097
00098 bool IsRunning() { return m_lookupthread->isRunning() ||
00099 m_imagedownload->isRunning() ||
00100 m_videoscanner->isRunning(); };
00101
00102 bool VideoGrabbersFunctional();
00103
00104 private:
00105
00106 void customEvent(QEvent *levent);
00107
00108 void OnMultiResult(MetadataLookupList list);
00109 void OnSingleResult(MetadataLookup *lookup);
00110 void OnNoResult(MetadataLookup *lookup);
00111 void OnImageResult(MetadataLookup *lookup);
00112
00113 void OnVideoResult(MetadataLookup *lookup);
00114
00115 QObject *m_parent;
00116 MetadataDownload *m_lookupthread;
00117 MetadataImageDownload *m_imagedownload;
00118
00119 VideoScannerThread *m_videoscanner;
00120 VideoMetadataListManager *m_mlm;
00121 bool m_scanning;
00122
00123
00124 MetadataLookupList m_returnList;
00125 bool m_sync;
00126 };
00127
00128 META_PUBLIC LookupType GuessLookupType(ProgramInfo *pginfo);
00129 META_PUBLIC LookupType GuessLookupType(MetadataLookup *lookup);
00130 META_PUBLIC LookupType GuessLookupType(RecordingRule *recrule);
00131
00132 #endif