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_
MetaGrabberScript::GetCommand
QString GetCommand(void) const
Definition: metadatagrabber.h:57
build_compdb.args
args
Definition: build_compdb.py:11
referencecounterlist.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
MetaGrabberScript
Definition: metadatagrabber.h:29
MetaGrabberScript::m_fullcommand
QString m_fullcommand
Definition: metadatagrabber.h:84
GrabberType
GrabberType
Definition: metadatagrabber.h:20
kGrabberTelevision
@ kGrabberTelevision
Definition: metadatagrabber.h:23
GrabberList
QList< MetaGrabberScript > GrabberList
Definition: metadatagrabber.h:18
MetaGrabberScript::GetThumbnail
QString GetThumbnail(void) const
Definition: metadatagrabber.h:63
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
MetaGrabberScript::m_accepts
QStringList m_accepts
Definition: metadatagrabber.h:89
MetaGrabberScript::GetAuthor
QString GetAuthor(void) const
Definition: metadatagrabber.h:62
MetaGrabberScript::IsValid
bool IsValid(void) const
Definition: metadatagrabber.h:55
MetaGrabberScript::m_thumbnail
QString m_thumbnail
Definition: metadatagrabber.h:83
mythmetaexp.h
MetaGrabberScript::Accepts
bool Accepts(const QString &tag) const
Definition: metadatagrabber.h:68
kGrabberMovie
@ kGrabberMovie
Definition: metadatagrabber.h:22
MetadataLookup
Definition: metadatacommon.h:86
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
kGrabberMusic
@ kGrabberMusic
Definition: metadatagrabber.h:24
MetaGrabberScript::m_command
QString m_command
Definition: metadatagrabber.h:85
RefCountedList
General purpose reference counted list.
Definition: referencecounterlist.h:55
MetaGrabberScript::GetDescription
QString GetDescription(void) const
Definition: metadatagrabber.h:66
MetaGrabberScript::m_name
QString m_name
Definition: metadatagrabber.h:81
mythtypes.h
MetaGrabberScript::m_author
QString m_author
Definition: metadatagrabber.h:82
MetaGrabberScript::m_description
QString m_description
Definition: metadatagrabber.h:88
Search
Definition: netgrabbermanager.h:137
MetaGrabberScript::GetPath
QString GetPath(void) const
Definition: metadatagrabber.h:59
MetaGrabberScript::GetName
QString GetName(void) const
Definition: metadatagrabber.h:61
kGrabberInvalid
@ kGrabberInvalid
Definition: metadatagrabber.h:26
kGrabberGame
@ kGrabberGame
Definition: metadatagrabber.h:25
MetaGrabberScript::GetTypeString
QString GetTypeString(void) const
Definition: metadatagrabber.h:65
MetaGrabberScript::GetType
GrabberType GetType(void) const
Definition: metadatagrabber.h:64
MetaGrabberScript::m_typestring
QString m_typestring
Definition: metadatagrabber.h:87
kGrabberAll
@ kGrabberAll
Definition: metadatagrabber.h:21
META_PUBLIC
#define META_PUBLIC
Definition: mythmetaexp.h:9