本文整理汇总了C++中MetadataLookupList类的典型用法代码示例。如果您正苦于以下问题:C++ MetadataLookupList类的具体用法?C++ MetadataLookupList怎么用?C++ MetadataLookupList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MetadataLookupList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpAllLookups
void dumpAllLookups(RetsMetadata * metadata, MetadataResource * resource)
{
string resourceName = resource->GetResourceID();
MetadataLookupList classes =
metadata->GetAllLookups(resourceName);
MetadataLookupList::iterator i;
for (i = classes.begin(); i != classes.end(); i++)
{
MetadataLookup * lookup = *i;
cout << "Resource name: " << resourceName << " ["
<< resource->GetStandardName() << "]" << endl;
cout << "Lookup name: " << lookup->GetLookupName() << " ("
<< lookup->GetVisibleName() << ")";
if (!lookup->GetMetadataEntryID().empty())
{
cout << " MetadataEntryID: " << lookup->GetMetadataEntryID();
}
cout << endl;
dumpAllLookupTypes(metadata, lookup);
cout << endl;
}
}
示例2: handleVideoUndetermined
MetadataLookupList MetadataDownload::handleVideoUndetermined(
MetadataLookup* lookup)
{
MetadataLookupList list;
QString cmd = GetTelevisionGrabber();
// Can't trust the inetref with so little information.
QStringList args;
args.append(QString("-l")); // Language Flag
args.append(gCoreContext->GetLanguage()); // UI Language
args.append(QString("-N"));
if (!lookup->GetInetref().isEmpty())
{
QString inetref = lookup->GetInetref();
args.append(inetref);
}
else
{
QString title = lookup->GetTitle();
args.append(title);
}
QString subtitle = lookup->GetSubtitle();
args.append(subtitle);
// Try to do a title/subtitle lookup
list = runGrabber(cmd, args, lookup, false);
if (list.count() == 1)
list.at(0)->SetStep(kLookupData);
return list;
}
示例3: grabber
MetadataLookupList MetadataDownload::runGrabber(QString cmd, QStringList args,
MetadataLookup* lookup,
bool passseas)
{
MythSystem grabber(cmd, args, kMSNoRunShell | kMSStdOut | kMSBuffered);
MetadataLookupList list;
LOG(VB_GENERAL, LOG_INFO, QString("Running Grabber: %1 %2")
.arg(cmd).arg(args.join(" ")));
grabber.Run();
grabber.Wait();
QByteArray result = grabber.ReadAll();
if (!result.isEmpty())
{
QDomDocument doc;
doc.setContent(result, true);
QDomElement root = doc.documentElement();
QDomElement item = root.firstChildElement("item");
while (!item.isNull())
{
MetadataLookup *tmp = ParseMetadataItem(item, lookup,
passseas);
list.append(tmp);
item = item.nextSiblingElement("item");
}
}
return list;
}
示例4: handleTelevision
MetadataLookupList MetadataDownload::handleTelevision(MetadataLookup* lookup)
{
MetadataLookupList list;
QString cmd = GetTelevisionGrabber();
QStringList args;
args.append(QString("-l")); // Language Flag
args.append(gCoreContext->GetLanguage()); // UI Language
// If the inetref is populated, even in kLookupSearch mode,
// become a kLookupData grab and use that.
if (lookup->GetStep() == kLookupSearch &&
(!lookup->GetInetref().isEmpty() &&
lookup->GetInetref() != "00000000"))
lookup->SetStep(kLookupData);
if (lookup->GetStep() == kLookupSearch)
{
args.append(QString("-M"));
if (lookup->GetInetref().isEmpty() ||
lookup->GetInetref() == "00000000")
{
QString title = lookup->GetTitle();
args.append(title);
}
else
{
QString inetref = lookup->GetInetref();
args.append(inetref);
}
}
else if (lookup->GetStep() == kLookupData)
{
args.append(QString("-D"));
args.append(lookup->GetInetref());
args.append(QString::number(lookup->GetSeason()));
args.append(QString::number(lookup->GetEpisode()));
}
else if (lookup->GetStep() == kLookupCollection)
{
args.append(QString("-C"));
args.append(lookup->GetCollectionref());
}
list = runGrabber(cmd, args, lookup);
// Collection Fallback
// If the lookup allows generic metadata, and the specific
// season and episode are not available, try for series metadata.
if (list.isEmpty() &&
lookup->GetAllowGeneric() &&
lookup->GetStep() == kLookupData)
{
lookup->SetStep(kLookupCollection);
list = handleTelevision(lookup);
}
return list;
}
示例5: handleRecordingGeneric
MetadataLookupList MetadataDownload::handleRecordingGeneric(
MetadataLookup* lookup)
{
// We only enter this mode if we are pretty darn sure this is a TV show,
// but we're for some reason looking up a generic, or the title didn't
// exactly match in one of the earlier lookups. This is a total
// hail mary to try to get at least *series* level info and art/inetref.
MetadataLookupList list;
QString cmd = GetTelevisionGrabber();
QStringList args;
args.append(QString("-l")); // Language Flag
args.append(gCoreContext->GetLanguage()); // UI Language
args.append(QString("-a"));
args.append(gCoreContext->GetLocale()->GetCountryCode());
args.append("-M");
QString title = lookup->GetTitle();
args.append(title);
LookupType origtype = lookup->GetSubtype();
int origseason = lookup->GetSeason();
int origepisode = lookup->GetEpisode();
lookup->SetSubtype(kProbableGenericTelevision);
if (origseason == 0 && origepisode == 0)
{
lookup->SetSeason(1);
lookup->SetEpisode(1);
}
list = runGrabber(cmd, args, lookup, true);
if (list.count() == 1)
{
lookup->SetInetref(list.at(0)->GetInetref());
lookup->SetCollectionref(list.at(0)->GetCollectionref());
list = handleTelevision(lookup);
}
lookup->SetSeason(origseason);
lookup->SetEpisode(origepisode);
lookup->SetSubtype(origtype);
return list;
}
示例6: CreateMetadataXML
QDomDocument CreateMetadataXML(MetadataLookupList list)
{
QDomDocument doc("MythMetadataXML");
QDomElement root = doc.createElement("metadata");
doc.appendChild(root);
for (MetadataLookupList::const_iterator i = list.begin();
i != list.end(); ++i)
{
CreateMetadataXMLItem(*i, root, doc);
}
return doc;
}
示例7: OnMultiResult
void MetadataFactory::OnMultiResult(MetadataLookupList list)
{
if (!list.size())
return;
QCoreApplication::postEvent(m_parent,
new MetadataFactoryMultiResult(list));
}
示例8: OnMultiResult
void MetadataFactory::OnMultiResult(MetadataLookupList list)
{
if (list.isEmpty())
return;
if (parent())
QCoreApplication::postEvent(parent(),
new MetadataFactoryMultiResult(list));
}
示例9: nearestName
bool MetadataDownload::findBestMatch(MetadataLookupList list,
QString originaltitle)
{
QStringList titles;
// Build a list of all the titles
for (MetadataLookupList::const_iterator i = list.begin();
i != list.end(); ++i)
{
titles.append((*i)->GetTitle());
}
// Apply Levenshtein distance algorithm to determine closest match
QString bestTitle = nearestName(originaltitle, titles);
// If no "best" was chosen, give up.
if (bestTitle.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR,
QString("No adequate match or multiple "
"matches found for %1. Update manually.")
.arg(originaltitle));
return false;
}
LOG(VB_GENERAL, LOG_INFO, QString("Best Title Match For %1: %2")
.arg(originaltitle).arg(bestTitle));
// Grab the one item that matches the besttitle (IMPERFECT)
for (MetadataLookupList::const_iterator i = list.begin();
i != list.end(); ++i)
{
if ((*i)->GetTitle() == bestTitle)
{
MetadataLookup *newlookup = (*i);
newlookup->SetStep(kLookupData);
prependLookup(newlookup);
return true;
}
}
return false;
}
示例10: handleRecordingGeneric
MetadataLookupList MetadataDownload::handleRecordingGeneric(
MetadataLookup* lookup)
{
// We only enter this mode if we are pretty darn sure this is a TV show,
// but we're for some reason looking up a generic, or the title didn't
// exactly match in one of the earlier lookups. This is a total
// hail mary to try to get at least *series* level info and art/inetref.
MetadataLookupList list;
QString def_cmd = QDir::cleanPath(QString("%1/%2")
.arg(GetShareDir())
.arg("metadata/Television/ttvdb.py"));
QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);
QStringList args;
args.append(QString("-l")); // Language Flag
args.append(gCoreContext->GetLanguage()); // UI Language
args.append("-M");
QString title = lookup->GetTitle();
args.append(title);
lookup->SetSubtype(kProbableGenericTelevision);
int origseason = lookup->GetSeason();
int origepisode = lookup->GetEpisode();
if (origseason == 0 && origepisode == 0)
{
lookup->SetSeason(1);
lookup->SetEpisode(1);
}
list = runGrabber(cmd, args, lookup, true);
if (list.count() == 1)
list.at(0)->SetStep(kLookupData);
lookup->SetSeason(origseason);
lookup->SetEpisode(origepisode);
return list;
}
示例11: grabber
// TODO
// using the MetadataLookup object as both argument input, and parsed output,
// is clumsy. break the inputs out into a separate object, and spawn a new
// MetadataLookup object in ParseMetadataItem, rather than requiring an
// existing one to reuse.
MetadataLookupList MetaGrabberScript::RunGrabber(const QStringList &args,
MetadataLookup *lookup, bool passseas)
{
MythSystemLegacy grabber(m_fullcommand, args, kMSStdOut);
MetadataLookupList list;
LOG(VB_GENERAL, LOG_INFO, QString("Running Grabber: %1 %2")
.arg(m_fullcommand).arg(args.join(" ")));
grabber.Run();
if (grabber.Wait() != GENERIC_EXIT_OK)
return list;
QByteArray result = grabber.ReadAll();
if (!result.isEmpty())
{
QDomDocument doc;
doc.setContent(result, true);
QDomElement root = doc.documentElement();
QDomElement item = root.firstChildElement("item");
while (!item.isNull())
{
MetadataLookup *tmp = ParseMetadataItem(item, lookup, passseas);
tmp->SetInetref(QString("%1_%2").arg(m_command)
.arg(tmp->GetInetref()));
if (!tmp->GetCollectionref().isEmpty())
{
tmp->SetCollectionref(QString("%1_%2").arg(m_command)
.arg(tmp->GetCollectionref()));
}
list.append(tmp);
// MetadataLookup is to be owned by the list
tmp->DecrRef();
item = item.nextSiblingElement("item");
}
}
return list;
}
示例12: customEvent
void LookerUpper::customEvent(QEvent *levent)
{
if (levent->type() == MetadataFactoryMultiResult::kEventType)
{
MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent);
if (!mfmr)
return;
MetadataLookupList list = mfmr->results;
if (list.count() > 1)
{
int yearindex = -1;
for (int p = 0; p != list.size(); ++p)
{
ProgramInfo *pginfo = list[p]->GetData().value<ProgramInfo *>();
if (pginfo && !pginfo->GetSeriesID().isEmpty() &&
pginfo->GetSeriesID() == (list[p])->GetTMSref())
{
MetadataLookup *lookup = list[p];
if (lookup->GetSubtype() != kProbableGenericTelevision)
pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode());
pginfo->SaveInetRef(lookup->GetInetref());
m_busyRecList.removeAll(pginfo);
return;
}
else if (pginfo && pginfo->GetYearOfInitialRelease() != 0 &&
(list[p])->GetYear() != 0 &&
pginfo->GetYearOfInitialRelease() == (list[p])->GetYear())
{
if (yearindex != -1)
{
LOG(VB_GENERAL, LOG_INFO, "Multiple results matched on year. No definite "
"match could be found.");
m_busyRecList.removeAll(pginfo);
return;
}
else
{
LOG(VB_GENERAL, LOG_INFO, "Matched from multiple results based on year. ");
yearindex = p;
}
}
}
if (yearindex > -1)
{
MetadataLookup *lookup = list[yearindex];
ProgramInfo *pginfo = lookup->GetData().value<ProgramInfo *>();
if (lookup->GetSubtype() != kProbableGenericTelevision)
pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode());
pginfo->SaveInetRef(lookup->GetInetref());
m_busyRecList.removeAll(pginfo);
return;
}
LOG(VB_GENERAL, LOG_INFO, "Unable to match this title, too many possible matches. "
"You may wish to manually set the season, episode, and "
"inetref in the 'Watch Recordings' screen.");
ProgramInfo *pginfo = list[0]->GetData().value<ProgramInfo *>();
if (pginfo)
{
m_busyRecList.removeAll(pginfo);
}
}
}
else if (levent->type() == MetadataFactorySingleResult::kEventType)
{
MetadataFactorySingleResult *mfsr =
dynamic_cast<MetadataFactorySingleResult*>(levent);
if (!mfsr)
return;
MetadataLookup *lookup = mfsr->result;
if (!lookup)
return;
ProgramInfo *pginfo = lookup->GetData().value<ProgramInfo *>();
// This null check could hang us as this pginfo would then never be
// removed
if (!pginfo)
return;
LOG(VB_GENERAL, LOG_DEBUG, "I found the following data:");
LOG(VB_GENERAL, LOG_DEBUG,
QString(" Input Title: %1").arg(pginfo->GetTitle()));
LOG(VB_GENERAL, LOG_DEBUG,
QString(" Input Sub: %1").arg(pginfo->GetSubtitle()));
LOG(VB_GENERAL, LOG_DEBUG,
QString(" Title: %1").arg(lookup->GetTitle()));
LOG(VB_GENERAL, LOG_DEBUG,
QString(" Subtitle: %1").arg(lookup->GetSubtitle()));
//.........这里部分代码省略.........
示例13: if
void MetadataFactory::customEvent(QEvent *levent)
{
if (levent->type() == MetadataLookupEvent::kEventType)
{
MetadataLookupEvent *lue = (MetadataLookupEvent *)levent;
MetadataLookupList lul = lue->lookupList;
if (lul.isEmpty())
return;
if (m_sync)
{
m_returnList = lul;
}
else if (lul.count() == 1)
{
OnSingleResult(lul.takeFirst());
}
else
{
OnMultiResult(lul);
}
}
else if (levent->type() == MetadataLookupFailure::kEventType)
{
MetadataLookupFailure *luf = (MetadataLookupFailure *)levent;
MetadataLookupList lul = luf->lookupList;
if (lul.isEmpty())
return;
if (m_sync)
{
m_returnList = MetadataLookupList();
m_sync = false;
}
if (lul.size())
{
OnNoResult(lul.takeFirst());
}
}
else if (levent->type() == ImageDLEvent::kEventType)
{
ImageDLEvent *ide = (ImageDLEvent *)levent;
MetadataLookup *lookup = ide->item;
if (!lookup)
return;
if (m_scanning)
OnVideoResult(lookup);
else
OnImageResult(lookup);
}
else if (levent->type() == VideoScanChanges::kEventType)
{
VideoScanChanges *vsc = (VideoScanChanges *)levent;
if (!vsc)
return;
QList<int> additions = vsc->additions;
QList<int> moves = vsc->moved;
QList<int> deletions = vsc->deleted;
if (!m_scanning)
{
LOG(VB_GENERAL, LOG_INFO,
QString("Video Scan Complete: a(%1) m(%2) d(%3)")
.arg(additions.count()).arg(moves.count())
.arg(deletions.count()));
if (m_parent)
QCoreApplication::postEvent(m_parent,
new MetadataFactoryVideoChanges(additions, moves,
deletions));
}
else
{
LOG(VB_GENERAL, LOG_INFO,
QString("Video Scan Complete: a(%1) m(%2) d(%3)")
.arg(additions.count()).arg(moves.count())
.arg(deletions.count()));
VideoMetadataListManager::metadata_list ml;
VideoMetadataListManager::loadAllFromDatabase(ml);
m_mlm->setList(ml);
for (QList<int>::const_iterator it = additions.begin();
it != additions.end(); ++it)
{
VideoMetadata *metadata = m_mlm->byID(*it).get();
if (metadata);
Lookup(metadata, true, true);
}
}
//.........这里部分代码省略.........
示例14: SetCoverArt
void EditMetadataDialog::customEvent(QEvent *levent)
{
if (levent->type() == DialogCompletionEvent::kEventType)
{
DialogCompletionEvent *dce = (DialogCompletionEvent*)(levent);
const QString resultid = dce->GetId();
if (resultid == CEID_COVERARTFILE)
SetCoverArt(dce->GetResultText());
else if (resultid == CEID_BANNERFILE)
SetBanner(dce->GetResultText());
else if (resultid == CEID_FANARTFILE)
SetFanart(dce->GetResultText());
else if (resultid == CEID_SCREENSHOTFILE)
SetScreenshot(dce->GetResultText());
else if (resultid == CEID_TRAILERFILE)
SetTrailer(dce->GetResultText());
else if (resultid == CEID_NEWCATEGORY)
AddCategory(dce->GetResultText());
}
else if (levent->type() == MetadataLookupEvent::kEventType)
{
MetadataLookupEvent *lue = (MetadataLookupEvent *)levent;
MetadataLookupList lul = lue->lookupList;
if (lul.isEmpty())
return;
// There should really only be one result here.
// If not, USER ERROR!
if (lul.count() == 1)
{
OnArtworkSearchDone(lul[0]);
}
else
{
if (m_busyPopup)
{
m_busyPopup->Close();
m_busyPopup = NULL;
}
}
}
else if (levent->type() == MetadataLookupFailure::kEventType)
{
MetadataLookupFailure *luf = (MetadataLookupFailure *)levent;
MetadataLookupList lul = luf->lookupList;
if (m_busyPopup)
{
m_busyPopup->Close();
m_busyPopup = NULL;
}
if (lul.size())
{
MetadataLookup *lookup = lul[0];
LOG(VB_GENERAL, LOG_INFO,
QString("No results found for %1 %2 %3").arg(lookup->GetTitle())
.arg(lookup->GetSeason()).arg(lookup->GetEpisode()));
}
}
else if (levent->type() == ImageDLEvent::kEventType)
{
ImageDLEvent *ide = (ImageDLEvent *)levent;
MetadataLookup *lookup = ide->item;
if (!lookup)
return;
handleDownloadedImages(lookup);
}
else if (levent->type() == ImageDLFailureEvent::kEventType)
{
MythErrorNotification n(tr("Failed to retrieve image"),
tr("Metadata Editor"),
tr("Check logs"));
GetNotificationCenter()->Queue(n);
}
}
示例15: RunProlog
void MetadataDownload::run()
{
RunProlog();
MetadataLookup* lookup;
while ((lookup = moreWork()) != NULL)
{
MetadataLookupList list;
// Go go gadget Metadata Lookup
if (lookup->GetType() == kMetadataVideo)
{
if (lookup->GetSubtype() == kProbableTelevision)
list = handleTelevision(lookup);
else if (lookup->GetSubtype() == kProbableMovie)
list = handleMovie(lookup);
else
list = handleVideoUndetermined(lookup);
if (!list.size() &&
lookup->GetSubtype() == kUnknownVideo)
{
list = handleMovie(lookup);
}
}
else if (lookup->GetType() == kMetadataRecording)
{
if (lookup->GetSubtype() == kProbableTelevision)
{
if (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0)
list = handleTelevision(lookup);
else if (!lookup->GetSubtitle().isEmpty())
list = handleVideoUndetermined(lookup);
if (!list.size())
list = handleRecordingGeneric(lookup);
}
else if (lookup->GetSubtype() == kProbableMovie)
{
list = handleMovie(lookup);
if (lookup->GetInetref().isEmpty())
list.append(handleRecordingGeneric(lookup));
}
else
{
list = handleRecordingGeneric(lookup);
if (lookup->GetInetref().isEmpty())
list.append(handleMovie(lookup));
}
}
else if (lookup->GetType() == kMetadataGame)
list = handleGame(lookup);
// inform parent we have lookup ready for it
if (m_parent && list.count() >= 1)
{
// If there's only one result, don't bother asking
// our parent about it, just add it to the back of
// the queue in kLookupData mode.
if (list.count() == 1 && list.at(0)->GetStep() == kLookupSearch)
{
MetadataLookup *newlookup = list.takeFirst();
newlookup->SetStep(kLookupData);
prependLookup(newlookup);
continue;
}
// If we're in automatic mode, we need to make
// these decisions on our own. Pass to title match.
if (list.at(0)->GetAutomatic() && list.count() > 1)
{
if (!findBestMatch(list, lookup->GetTitle()))
QCoreApplication::postEvent(m_parent,
new MetadataLookupFailure(MetadataLookupList() << lookup));
continue;
}
LOG(VB_GENERAL, LOG_INFO,
QString("Returning Metadata Results: %1 %2 %3")
.arg(lookup->GetTitle()).arg(lookup->GetSeason())
.arg(lookup->GetEpisode()));
QCoreApplication::postEvent(m_parent,
new MetadataLookupEvent(list));
}
else
{
list.append(lookup);
QCoreApplication::postEvent(m_parent,
new MetadataLookupFailure(list));
}
}
RunEpilog();
}