Go to the documentation of this file.
6 #include <QMutexLocker>
20 #define LOC QString("Metadata Grabber: ")
21 #define kGrabberRefresh 60
36 "metadata/Movie/tmdb3.py" } },
39 "metadata/Television/ttvdb.py" } },
41 "mythgame.MetadataGrabber",
42 "metadata/Game/giantbomb.py" } },
62 QString tmptype =
type.toLower();
86 LOG(VB_GENERAL, LOG_DEBUG,
LOC +
"Clearing grabber cache");
93 QStringList scripts = QDir(path).entryList(QDir::Executable | QDir::Files);
94 if (scripts.count() == 0)
99 for (
const auto& name : qAsConst(scripts))
101 QString cmd = QDir(path).filePath(name);
118 for (
const auto& item : qAsConst(tmpGrabberList))
121 retGrabberList.append(item);
124 return retGrabberList;
154 QString tmptype =
type.toLower();
178 for (
const auto& item : qAsConst(list))
179 if (item.GetPath().endsWith(cmd))
185 QString fullcmd = QString(
"%1%2").arg(
GetShareDir()).arg(cmd);
202 for (
const auto& item : qAsConst(list))
204 if (item.GetCommand() == tag)
213 for (
const auto& item : qAsConst(list))
215 if (item.Accepts(tag))
229 static QRegExp s_retagref(R
"(^([a-zA-Z0-9_\-\.]+\.[a-zA-Z0-9]{1,3})_(.*))");
230 static QRegExp s_retagref2(R
"(^([a-zA-Z0-9_\-\.]+\.[a-zA-Z0-9]{1,3}):(.*))");
231 static QMutex s_reLock;
232 QMutexLocker lock(&s_reLock);
235 if (s_retagref.indexIn(inetref) > -1)
237 tag = s_retagref.cap(1);
239 else if (s_retagref2.indexIn(inetref) > -1)
241 tag = s_retagref2.cap(1);
257 static QRegExp s_retagref(R
"(^([a-zA-Z0-9_\-\.]+\.[a-zA-Z0-9]{1,3})_(.*))");
258 static QRegExp s_retagref2(R
"(^([a-zA-Z0-9_\-\.]+\.[a-zA-Z0-9]{1,3}):(.*))");
259 static QMutex s_reLock;
260 QMutexLocker lock(&s_reLock);
263 if (s_retagref.indexIn(inetref) > -1)
264 return s_retagref.cap(2);
265 if (s_retagref2.indexIn(inetref) > -1)
266 return s_retagref2.cap(2);
272 m_fullcommand(std::move(path))
297 QByteArray result = grabber.
ReadAll();
298 if (result.isEmpty())
303 doc.setContent(result,
true);
304 QDomElement
root =
doc.documentElement();
340 m_name = item.firstChildElement(
"name").text();
341 m_author = item.firstChildElement(
"author").text();
342 m_thumbnail = item.firstChildElement(
"thumbnail").text();
343 m_command = item.firstChildElement(
"command").text();
344 m_description = item.firstChildElement(
"description").text();
345 m_version = item.firstChildElement(
"version").text().toFloat();
346 m_typestring = item.firstChildElement(
"type").text().toLower();
353 QDomElement accepts = item.firstChildElement(
"accepts");
354 if (!accepts.isNull())
356 while (!accepts.isNull())
359 accepts = accepts.nextSiblingElement(
"accepts");
387 LOG(VB_GENERAL, LOG_INFO, QString(
"Running Grabber: %1 %2")
394 QByteArray result = grabber.
ReadAll();
395 if (!result.isEmpty())
398 doc.setContent(result,
true);
399 QDomElement
root =
doc.documentElement();
400 QDomElement item =
root.firstChildElement(
"item");
402 while (!item.isNull())
407 if (!
tmp->GetCollectionref().isEmpty())
410 .
arg(
tmp->GetCollectionref()));
415 item = item.nextSiblingElement(
"item");
432 metadataMap[
"name"] =
m_name;
437 metadataMap[
"version"] = QString::number(
m_version);
476 const QString &
title,
const QString &subtitle,
511 << QString::number(season)
512 << QString::number(episode);
#define GENERIC_EXIT_OK
Exited with no error.
QDomDocument doc("MYTHARCHIVEITEM")
MythLocale * GetLocale(void) const
arg(title).arg(filename).arg(doDelete))
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void Run(time_t timeout=0)
Runs a command inside the /bin/sh shell. Returns immediately.
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
QHash< QString, QString > InfoMap
QString GetCountryCode() const
QString GetShareDir(void)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString GetLanguage(void)
Returns two character ISO-639 language descriptor for UI language.
@ kMSRunShell
run process through shell
@ kMSStdOut
allow access to stdout
QString GetSetting(const QString &key, const QString &defaultval="")
uint Wait(time_t timeout=0)