mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 07:22:57 +02:00
helpers.h/cpp: add default timeout parameter with value 1
For flexible usage of timeout in related downloadUrl methods if required.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 7cabce4b80
Author: Thilo Graf <dbt@novatux.de>
Date: 2020-11-16 (Mon, 16 Nov 2020)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1802,18 +1802,18 @@ std::string randomFile(std::string suffix, std::string directory, unsigned int l
|
||||
return directory + "/" + randomString(length) + "." + suffix;
|
||||
}
|
||||
|
||||
std::string downloadUrlToRandomFile(std::string url, std::string directory, unsigned int length)
|
||||
std::string downloadUrlToRandomFile(std::string url, std::string directory, unsigned int length, unsigned int timeout)
|
||||
{
|
||||
if (strstr(url.c_str(), "://"))
|
||||
{
|
||||
std::string file = randomFile(url.substr(url.find_last_of(".") + 1), directory, length);
|
||||
if (downloadUrl(url, file, " ", 1))
|
||||
if (downloadUrl(url, file, " ", timeout))
|
||||
return file;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
std::string downloadUrlToLogo(std::string url, std::string directory, t_channel_id channel_id)
|
||||
std::string downloadUrlToLogo(std::string url, std::string directory, t_channel_id channel_id, unsigned int timeout)
|
||||
{
|
||||
|
||||
if (channel_id == 0)
|
||||
@@ -1829,7 +1829,7 @@ std::string downloadUrlToLogo(std::string url, std::string directory, t_channel_
|
||||
std::string file = directory + "/" + strChnId + url.substr(url.find_last_of("."));
|
||||
if (file_exists(file))
|
||||
return file;
|
||||
if (downloadUrl(url, file, " ", 1))
|
||||
if (downloadUrl(url, file, " ", timeout))
|
||||
return file;
|
||||
}
|
||||
return url;
|
||||
|
Reference in New Issue
Block a user