MythTV  master
metadatagrabber.h
Go to the documentation of this file.
1 #ifndef METADATAGRABBER_H_
2 #define METADATAGRABBER_H_
3 
4 #include <QList>
5 #include <QString>
6 #include <QVariant>
7 #include <QStringList>
8 #include <QDomDocument>
9 
10 #include "mythtypes.h"
11 #include "mythmetaexp.h"
12 //#include "metadatacommon.h"
13 #include "referencecounterlist.h"
14 class MetadataLookup;
16 
17 class MetaGrabberScript;
18 using GrabberList = QList<MetaGrabberScript>;
19 
27 };
28 
30 {
31  public:
32  MetaGrabberScript() = default;
33  explicit MetaGrabberScript(const QDomElement &dom);
34  explicit MetaGrabberScript(const QString &path);
35  MetaGrabberScript(QString path, const QDomElement &dom);
36  MetaGrabberScript(const MetaGrabberScript &/*other*/) = default;
37 
38  MetaGrabberScript& operator=(const MetaGrabberScript &other);
39 
40  static GrabberList GetList(bool refresh=false);
41  static GrabberList GetList(const QString &type, bool refresh=false);
42  static GrabberList GetList(GrabberType type,
43  bool refresh=false);
44 
45  static MetaGrabberScript GetGrabber(GrabberType defaultType,
46  const MetadataLookup *lookup = nullptr);
47  static MetaGrabberScript GetType(const QString &type);
48  static MetaGrabberScript GetType(GrabberType type);
49  static MetaGrabberScript FromTag(const QString &tag,
50  bool absolute=false);
51  static MetaGrabberScript FromInetref(const QString &inetref,
52  bool absolute=false);
53  static QString CleanedInetref(const QString &inetref);
54 
55  bool IsValid(void) const { return m_valid; }
56 
57  QString GetCommand(void) const { return m_command; }
58  QString GetRelPath(void) const;
59  QString GetPath(void) const { return m_fullcommand; }
60 
61  QString GetName(void) const { return m_name; }
62  QString GetAuthor(void) const { return m_author; }
63  QString GetThumbnail(void) const { return m_thumbnail; }
64  GrabberType GetType(void) const { return m_type; }
65  QString GetTypeString(void) const { return m_typestring; }
66  QString GetDescription(void) const { return m_description; }
67 
68  bool Accepts(const QString &tag) const { return m_accepts.contains(tag); }
69 
70  void toMap(InfoMap &metadataMap) const;
71 
72  bool Test(void);
73  MetadataLookupList Search(const QString &title, MetadataLookup *lookup, bool passseas=true);
74  MetadataLookupList SearchSubtitle(const QString &title, const QString &subtitle, MetadataLookup *lookup, bool passseas=true);
75  MetadataLookupList SearchSubtitle(const QString &inetref, const QString &title, const QString &subtitle, MetadataLookup *lookup, bool passseas=true);
76  MetadataLookupList LookupData(const QString &inetref, MetadataLookup *lookup, bool passseas=true);
77  MetadataLookupList LookupData(const QString &inetref, int season, int episode, MetadataLookup *lookup, bool passseas=true);
78  MetadataLookupList LookupCollection(const QString &collectionref, MetadataLookup *lookup, bool passseas=true);
79 
80  private:
81  QString m_name;
82  QString m_author;
83  QString m_thumbnail;
84  QString m_fullcommand;
85  QString m_command;
87  QString m_typestring;
88  QString m_description;
89  QStringList m_accepts;
90  float m_version {0.0};
91  bool m_valid {false};
92 
93  void ParseGrabberVersion(const QDomElement &item);
94  MetadataLookupList RunGrabber(const QStringList &args, MetadataLookup *lookup, bool passseas);
95  static void SetDefaultArgs(QStringList &args);
96 };
97 
99 
100 #endif // METADATAGRABBER_H_
QStringList m_accepts
bool Accepts(const QString &tag) const
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
GrabberType
Q_DECLARE_METATYPE(GrabberScript *)
QString GetDescription(void) const
QString GetPath(void) const
bool IsValid(void) const
QString GetAuthor(void) const
#define META_PUBLIC
Definition: mythmetaexp.h:9
QString GetName(void) const
const char * m_name
Definition: ParseText.cpp:328
QString GetTypeString(void) const
QString GetCommand(void) const
QList< MetaGrabberScript > GrabberList
QString GetThumbnail(void) const
GrabberType GetType(void) const