adding caching xmltv logos

Origin commit data
------------------
Commit: 3955d83961
Author: TangoCash <eric@loxat.de>
Date: 2018-09-20 (Thu, 20 Sep 2018)
This commit is contained in:
TangoCash
2018-09-20 15:11:05 +02:00
committed by vanhofen
parent 12f94927d5
commit 8dd38e9ccc
4 changed files with 27 additions and 2 deletions

View File

@@ -1744,6 +1744,28 @@ std::string downloadUrlToRandomFile(std::string url, std::string directory, unsi
return url;
}
std::string downloadUrlToLogo(std::string url, std::string directory, t_channel_id channel_id)
{
if (channel_id == 0)
return downloadUrlToRandomFile(url,directory);
if (strstr(url.c_str(), "://"))
{
//get channel id as string
char strChnId[16];
snprintf(strChnId, 16, "%llx", channel_id & 0xFFFFFFFFFFFFULL);
strChnId[15] = '\0';
std::string file = directory + "/" + strChnId + url.substr(url.find_last_of("."));
if (file_exists(file))
return file;
if (downloadUrl(url, file))
return file;
}
return url;
}
// curl
static void *myrealloc(void *ptr, size_t size)
{