From c55bee4c4a96d9f435b5783a2689dfaabb4f5619 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 9 Sep 2018 13:06:05 +0200 Subject: [PATCH] adding download helping function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f474e60303aacd4f8aa77bb4232fdde71ad32d7a Author: TangoCash Date: 2018-09-09 (Sun, 09 Sep 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 11 +++++++++++ src/system/helpers.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 9fecd4c48..c121a65be 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1733,6 +1733,17 @@ std::string genTmpName(std::string suffix,unsigned int length) return Str; } +std::string dlTmpName(std::string url) +{ + if (strstr(url.c_str(), "://")) + { + std::string tmpname = genTmpName(url.substr(url.find_last_of(".")+1),10); + if (downloadUrl(url,tmpname)) + url = tmpname; + } + return url; +} + // curl static void *myrealloc(void *ptr, size_t size) { diff --git a/src/system/helpers.h b/src/system/helpers.h index b626d50e7..1e05e00e0 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -164,6 +164,7 @@ std::string iso_8859_1_to_utf8(std::string &str); bool utf8_check_is_valid(const std::string &str); std::string genTmpName(std::string suffix,unsigned int length); +std::string dlTmpName(std::string url); // curl struct MemoryStruct {