本文整理汇总了C++中CFileCurl::Download方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileCurl::Download方法的具体用法?C++ CFileCurl::Download怎么用?C++ CFileCurl::Download使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileCurl
的用法示例。
在下文中一共展示了CFileCurl::Download方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DownloadThumbnail
bool CGUIDialogSongInfo::DownloadThumbnail(const CStdString &thumbFile)
{
// TODO: Obtain the source...
CStdString source;
CFileCurl http;
http.Download(source, thumbFile);
return true;
}
示例2: CacheTrackThumb
void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd)
{
unsigned int start = CTimeUtils::GetTimeMS();
CSingleLock lock(m_lockCache);
int iNrCachedTracks = m_RadioTrackQueue->size();
CFileCurl http;
for (int i = 0; i < nrInitialTracksToAdd && i < iNrCachedTracks; i++)
{
CFileItemPtr item = (*m_RadioTrackQueue)[i];
if (!item->GetMusicInfoTag()->Loaded())
{
//cache albumthumb, GetThumbnailImage contains the url to cache
if (item->HasThumbnail())
{
CStdString coverUrl = item->GetThumbnailImage();
CStdString crcFile;
CStdString cachedFile;
CStdString thumbFile;
Crc32 crc;
crc.ComputeFromLowerCase(coverUrl);
crcFile.Format("%08x.tbn", (__int32)crc);
URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath, crcFile, cachedFile);
URIUtils::AddFileToFolder(g_settings.GetLastFMThumbFolder(), crcFile, thumbFile);
item->SetThumbnailImage("");
try
{
//download to temp, then make a thumb
if (CFile::Exists(thumbFile) || (http.Download(coverUrl, cachedFile) && CPicture::CreateThumbnail(cachedFile, thumbFile)))
{
if (CFile::Exists(cachedFile))
CFile::Delete(cachedFile);
item->SetThumbnailImage(thumbFile);
}
}
catch(...)
{
CLog::Log(LOGERROR, "LastFmManager: exception while caching %s to %s.", coverUrl.c_str(), thumbFile.c_str());
}
}
if (!item->HasThumbnail())
{
item->SetThumbnailImage("DefaultAlbumCover.png");
}
item->GetMusicInfoTag()->SetLoaded();
}
}
CLog::Log(LOGDEBUG, "%s: Done (time: %i ms)", __FUNCTION__, (int)(CTimeUtils::GetTimeMS() - start));
}