// check whether we need cache the job anyway
bool needsRecaching = false;
CStdString path(CTextureCache::Get().CheckCachedImage(m_url, false, needsRecaching));
- if (!path.IsEmpty() && !needsRecaching)
+ if (!path.empty() && !needsRecaching)
return false;
return CacheTexture();
}
m_details.file = m_cachePath + ".jpg";
if (out_texture)
*out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, additional_info);
- CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p", m_oldHash.IsEmpty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str(), out_texture);
+ CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p", m_oldHash.empty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str(), out_texture);
return true;
}
#endif
- CBaseTexture *texture = LoadImage(image, width, height, additional_info);
+ CBaseTexture *texture = LoadImage(image, width, height, additional_info, true);
if (texture)
{
if (texture->HasAlpha())
else
m_details.file = m_cachePath + ".jpg";
- CLog::Log(LOGDEBUG, "%s image '%s' to '%s':", m_oldHash.IsEmpty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str());
+ CLog::Log(LOGDEBUG, "%s image '%s' to '%s':", m_oldHash.empty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str());
if (CPicture::CacheTexture(texture, width, height, CTextureCache::GetCachedPath(m_details.file)))
{
image = thumbURL.GetHostName();
- CStdString optionString = thumbURL.GetOptions().Mid(1);
- optionString.TrimRight('/'); // in case XBMC adds a slash
+ CStdString optionString = thumbURL.GetOptions().empty() ? "" : thumbURL.GetOptions().substr(1);
+ StringUtils::TrimRight(optionString, "/"); // In case XBMC adds a slash.
std::vector<CStdString> options;
StringUtils::SplitString(optionString, "&", options);
for (std::vector<CStdString>::iterator i = options.begin(); i != options.end(); i++)
{
CStdString option, value;
- int pos = i->Find('=');
- if (pos != -1)
+ size_t pos = i->find('=');
+ if (pos != std::string::npos)
{
- option = i->Left(pos);
- value = i->Mid(pos + 1);
+ option = i->substr(0, pos);
+ value = i->substr(pos + 1);
}
else
{
return image;
}
-CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int width, unsigned int height, const std::string &additional_info)
+CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int width, unsigned int height, const std::string &additional_info, bool requirePixels)
{
if (additional_info == "music")
{ // special case for embedded music images
&& !StringUtils::StartsWithNoCase(file.GetMimeType(), "image/") && !file.GetMimeType().Equals("application/octet-stream")) // ignore non-pictures
return NULL;
- CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, CSettings::Get().GetBool("pictures.useexifrotation"));
+ CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, CSettings::Get().GetBool("pictures.useexifrotation"), requirePixels, file.GetMimeType());
if (!texture)
return NULL;
if (!time)
time = st.st_ctime;
if (time || st.st_size)
- {
- CStdString hash;
- hash.Format("d%"PRId64"s%"PRId64, time, st.st_size);
- return hash;
- }
+ return StringUtils::Format("d%"PRId64"s%"PRId64, time, st.st_size);;
+
}
CLog::Log(LOGDEBUG, "%s - unable to stat url %s", __FUNCTION__, url.c_str());
return "";