本文整理汇总了C++中MetadataLookup::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ MetadataLookup::GetType方法的具体用法?C++ MetadataLookup::GetType怎么用?C++ MetadataLookup::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataLookup
的用法示例。
在下文中一共展示了MetadataLookup::GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void MetadataImageDownload::run()
{
RunProlog();
// Always handle thumbnails first, they're higher priority.
ThumbnailData *thumb;
while ((thumb = moreThumbs()) != NULL)
{
QString sFilename = getDownloadFilename(thumb->title, thumb->url);
bool exists = QFile::exists(sFilename);
if (!exists && !thumb->url.isEmpty())
{
if (!GetMythDownloadManager()->download(thumb->url, sFilename))
{
LOG(VB_GENERAL, LOG_ERR,
QString("MetadataImageDownload: failed to download thumbnail from: %1")
.arg(thumb->url));
delete thumb;
continue;
}
}
// inform parent we have thumbnail ready for it
if (QFile::exists(sFilename) && m_parent)
{
LOG(VB_GENERAL, LOG_DEBUG,
QString("Threaded Image Thumbnail Download: %1")
.arg(sFilename));
thumb->url = sFilename;
QCoreApplication::postEvent(m_parent,
new ThumbnailDLEvent(thumb));
}
else
delete thumb;
}
MetadataLookup *lookup;
while ((lookup = moreDownloads()) != NULL)
{
DownloadMap downloads = lookup->GetDownloads();
DownloadMap downloaded;
for (DownloadMap::iterator i = downloads.begin();
i != downloads.end(); ++i)
{
VideoArtworkType type = i.key();
ArtworkInfo info = i.value();
QString filename = getDownloadFilename( type, lookup,
info.url );
if (lookup->GetHost().isEmpty())
{
QString path = getLocalWritePath(lookup->GetType(), type);
QDir dirPath(path);
if (!dirPath.exists())
if (!dirPath.mkpath(path))
{
LOG(VB_GENERAL, LOG_ERR,
QString("Metadata Image Download: Unable to create "
"path %1, aborting download.").arg(path));
QCoreApplication::postEvent(m_parent,
new ImageDLFailureEvent(lookup));
continue;
}
QString finalfile = path + "/" + filename;
QString oldurl = info.url;
info.url = finalfile;
if (!QFile::exists(finalfile) || lookup->GetAllowOverwrites())
{
QFile dest_file(finalfile);
if (dest_file.exists())
{
QFileInfo fi(finalfile);
GetMythUI()->RemoveFromCacheByFile(fi.fileName());
dest_file.remove();
}
LOG(VB_GENERAL, LOG_INFO,
QString("Metadata Image Download: %1 ->%2")
.arg(oldurl).arg(finalfile));
QByteArray *download = new QByteArray();
GetMythDownloadManager()->download(oldurl, download);
QImage testImage;
bool didLoad = testImage.loadFromData(*download);
if (!didLoad)
{
LOG(VB_GENERAL, LOG_ERR,
QString("Tried to write %1, but it appears to be "
"an HTML redirect (filesize %2).")
.arg(oldurl).arg(download->size()));
delete download;
download = NULL;
QCoreApplication::postEvent(m_parent,
new ImageDLFailureEvent(lookup));
continue;
}
if (dest_file.open(QIODevice::WriteOnly))
//.........这里部分代码省略.........
示例2: run
void MetadataImageDownload::run()
{
// Always handle thumbnails first, they're higher priority.
ThumbnailData *thumb;
while ((thumb = moreThumbs()) != NULL)
{
QString sFilename = getDownloadFilename(thumb->title, thumb->url);
bool exists = QFile::exists(sFilename);
if (!exists && !thumb->url.isEmpty())
GetMythDownloadManager()->download(thumb->url, sFilename);
// inform parent we have thumbnail ready for it
if (QFile::exists(sFilename) && m_parent)
{
VERBOSE(VB_GENERAL|VB_EXTRA,
QString("Threaded Image Thumbnail Download: %1")
.arg(sFilename));
thumb->url = sFilename;
QCoreApplication::postEvent(m_parent,
new ThumbnailDLEvent(thumb));
}
else
delete thumb;
}
MetadataLookup *lookup;
while ((lookup = moreDownloads()) != NULL)
{
DownloadMap downloads = lookup->GetDownloads();
DownloadMap downloaded;
for (DownloadMap::iterator i = downloads.begin();
i != downloads.end(); ++i)
{
ArtworkType type = i.key();
ArtworkInfo info = i.value();
QString filename = getDownloadFilename( type, lookup,
info.url );
if (lookup->GetHost().isEmpty())
{
QString path = getLocalWritePath(lookup->GetType(), type);
QDir dirPath(path);
if (!dirPath.exists())
if (!dirPath.mkpath(path))
{
VERBOSE(VB_GENERAL,
QString("Metadata Image Download: Unable to create "
"path %1, aborting download.").arg(path));
continue;
}
QString finalfile = path + "/" + filename;
QString oldurl = info.url;
info.url = finalfile;
if (!QFile::exists(finalfile) || lookup->GetAllowOverwrites())
{
QFile dest_file(finalfile);
if (dest_file.exists())
{
QFileInfo fi(finalfile);
GetMythUI()->RemoveFromCacheByFile(fi.fileName());
dest_file.remove();
}
VERBOSE(VB_GENERAL,
QString("Metadata Image Download: %1 ->%2")
.arg(oldurl).arg(finalfile));
QByteArray *download = new QByteArray();
GetMythDownloadManager()->download(oldurl, download);
QImage testImage;
bool didLoad = testImage.loadFromData(*download);
if (!didLoad)
{
VERBOSE(VB_IMPORTANT,QString("Tried to write %1, "
"but it appears to be an HTML redirect "
"(filesize %2).")
.arg(oldurl).arg(download->size()));
delete download;
download = NULL;
continue;
}
if (dest_file.open(QIODevice::WriteOnly))
{
off_t size = dest_file.write(*download, download->size());
if (size != download->size())
{
VERBOSE(VB_IMPORTANT,
QString("Image Download: Error Writing Image "
"to file: %1").arg(finalfile));
}
else
downloaded.insert(type, info);
}
delete download;
}
else
downloaded.insert(type, info);
//.........这里部分代码省略.........
示例3: run
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();
}