MythTV master
metadatadownload.h
Go to the documentation of this file.
1#ifndef METADATADOWNLOAD_H
2#define METADATADOWNLOAD_H
3
4#include <QStringList>
5#include <QMutex>
6#include <QEvent>
7
10
11class META_PUBLIC MetadataLookupEvent : public QEvent
12{
13 public:
14 explicit MetadataLookupEvent(const MetadataLookupList& lul) : QEvent(kEventType),
15 m_lookupList(lul) {}
16 ~MetadataLookupEvent() override = default;
17
19
20 static const Type kEventType;
21};
22
24{
25 public:
26 explicit MetadataLookupFailure(const MetadataLookupList& lul) : QEvent(kEventType),
27 m_lookupList(lul) {}
28 ~MetadataLookupFailure() override = default;
29
31
32 static const Type kEventType;
33};
34
36{
37 public:
38
39 explicit MetadataDownload(QObject *parent)
40 : MThread("MetadataDownload"), m_parent(parent) {}
41 ~MetadataDownload() override;
42
43 void addLookup(MetadataLookup *lookup);
44 void prependLookup(MetadataLookup *lookup);
45 void cancel();
46
47 static QString GetMovieGrabber();
48 static QString GetTelevisionGrabber();
49 static QString GetGameGrabber();
50
51 static bool runGrabberTest(const QString &grabberpath);
52 static bool MovieGrabberWorks();
53 static bool TelevisionGrabberWorks();
54
55 protected:
56
57 void run() override; // MThread
58
59 static QString getMXMLPath(const QString& filename);
60 static QString getNFOPath(const QString& filename);
61
62 private:
63 // Video handling
64 static MetadataLookupList handleMovie(MetadataLookup* lookup);
65 static MetadataLookupList handleTelevision(MetadataLookup* lookup);
66 static MetadataLookupList handleVideoUndetermined(MetadataLookup* lookup);
67 static MetadataLookupList handleRecordingGeneric(MetadataLookup* lookup);
68
69 static MetadataLookupList handleGame(MetadataLookup* lookup);
70
71 static unsigned int findExactMatchCount(MetadataLookupList list,
72 const QString &originaltitle,
73 bool withArt) ;
74 static MetadataLookup* findBestMatch(MetadataLookupList list,
75 const QString &originaltitle) ;
76 static MetadataLookupList runGrabber(const QString& cmd,
77 const QStringList& args,
78 MetadataLookup* lookup,
79 bool passseas = true);
80 static MetadataLookupList readMXML(const QString& MXMLpath,
81 MetadataLookup* lookup,
82 bool passseas = true);
83 static MetadataLookupList readNFO(const QString& NFOpath,
84 MetadataLookup* lookup);
85
86 QObject *m_parent {nullptr};
88 QMutex m_mutex;
89};
90
91#endif /* METADATADOWNLOAD_H */
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
MetadataLookupList m_lookupList
MetadataDownload(QObject *parent)
~MetadataLookupEvent() override=default
static const Type kEventType
MetadataLookupEvent(const MetadataLookupList &lul)
MetadataLookupList m_lookupList
~MetadataLookupFailure() override=default
MetadataLookupList m_lookupList
static const Type kEventType
MetadataLookupFailure(const MetadataLookupList &lul)
#define META_PUBLIC
Definition: mythmetaexp.h:9
void run(const QString &name, Class *object, void(Class::*fn)())
Definition: mconcurrent.h:137