v4.3.0: add second download url

This commit is contained in:
Markus 2020-08-19 22:10:28 +02:00
parent bcb6283bba
commit 6081a8ede4
2 changed files with 26 additions and 16 deletions

View File

@ -26,6 +26,7 @@
#endif #endif


#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="




enum Modus { enum Modus {
@ -50,18 +51,18 @@ struct Settings {
#if defined (_X86_) || defined (__amd64__) || defined (_M_IX86) #if defined (_X86_) || defined (__amd64__) || defined (_M_IX86)
// Wenn das Betriebsystem LINUX ist und 64 Bit ist: // Wenn das Betriebsystem LINUX ist und 64 Bit ist:
#if defined (__linux) && ( defined (_LP64) || defined (__LP64__)) #if defined (__linux) && ( defined (_LP64) || defined (__LP64__))
const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-LINx86.txt"); const std::string VersionFileName = std::string("Version-LINx86.txt");
const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-LINx86"); const std::string ProgrammFileName = std::string("S_New4-LINx86");
#else #else
//Wenn das Betriebsystem Windows ist und 64 Bit ist //Wenn das Betriebsystem Windows ist und 64 Bit ist
#if defined (_WIN64) #if defined (_WIN64)
const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-WINx86.txt"); const std::string VersionFileName = std::string("Version-WINx86.txt");
const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-WINx86.exe"); const std::string ProgrammFileName = std::string("S_New4-WINx86.exe");
#else #else
//Ungültiges Betriebsystem => Error //Ungültiges Betriebsystem => Error
#error Kein Windows oder Linux 64 Bit System: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux ) #error Kein Windows oder Linux 64 Bit System: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
const std::string VersionFileUrl = ""; const std::string VersionFileName = "";
const std::string ProgrammFileUrl = ""; const std::string ProgrammFileName = "";
#endif #endif
#endif #endif


@ -69,12 +70,12 @@ struct Settings {
#else #else
//Raspberry Pi -> ARMv6 -> 32Bit //Raspberry Pi -> ARMv6 -> 32Bit
#if defined(__ARM_ARCH_6__) && defined (__linux) #if defined(__ARM_ARCH_6__) && defined (__linux)
const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-LIN-ARMv6.txt"); const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt");
const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-LIN-ARMv6"); const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6");
#else #else
#error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux ) #error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
const std::string VersionFileUrl = ""; const std::string VersionFileName = "";
const std::string ProgrammFileUrl = ""; const std::string ProgrammFileName = "";
#endif #endif
#endif #endif


@ -92,7 +93,7 @@ struct Settings {
proxy_ip = "127.0.0.1", proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng,", languages = "GerDub,GerSub,Eng,",
genaueHoster = "", genaueHoster = "",
version = "4.2.2", version = "4.3.0",
defaultFileVersion="1.8", defaultFileVersion="1.8",
default_checkPath = "", default_checkPath = "",
default_Searchmuster = "S%Staffel%E%Folge%"; default_Searchmuster = "S%Staffel%E%Folge%";

View File

@ -1103,13 +1103,18 @@ int ProgramManager::newsModus(Settings *settings)


int ProgramManager::updateModus(Settings *settings) int ProgramManager::updateModus(Settings *settings)
{ {
if(settings->VersionFileUrl == "" || settings->ProgrammFileUrl == "") { if(settings->VersionFileName == "" || settings->ProgrammFileName == "") {
std::cout << " => Error: Kein Download Link verfügbar!" << std::endl; std::cout << " => Error: Kein Download Link verfügbar!" << std::endl;
return 4; return 4;
} }


std::cout << " => INFO: Suche nach der neusten Version..." << std::endl; std::cout << " => INFO: Suche nach der neusten Version..." << std::endl;
std::string html = pageManager.getServerRequest(settings->VersionFileUrl).html; std::string html = pageManager.getServerRequest( UpdaterCloudUrlWithPath + settings->VersionFileName).html;
if( html == "-1" || html == "" || html.find("\n") == std::string::npos) {
std::cerr << (" => Warnung: Verwende 2t-Link für Download!") << std::endl;
html = pageManager.getServerRequest( SecondUpdaterCloudUrlWithPath + settings->VersionFileName).html;
}



if( html == "-1" || html == "" || html.find("\n") == std::string::npos) { if( html == "-1" || html == "" || html.find("\n") == std::string::npos) {
// Wenn debug mode print error // Wenn debug mode print error
@ -1183,9 +1188,13 @@ int ProgramManager::updateModus(Settings *settings)
//Download new Version of Program //Download new Version of Program
std::cout << " => INFO: Lade neue Version herunter..." << std::endl; std::cout << " => INFO: Lade neue Version herunter..." << std::endl;


if( pageManager.downLoadToFile(downloadedFilePath, settings->ProgrammFileUrl) != 0) { if( pageManager.downLoadToFile(downloadedFilePath, UpdaterCloudUrlWithPath + settings->ProgrammFileName) != 0) {
std::cout << "\n => Error: Das herunterladen der neuen Version ist fehlgeschlagen." << std::endl; std::cerr << (" => Warnung: Verwende 2t-Link für Download!") << std::endl;
return 3;
if( pageManager.downLoadToFile(downloadedFilePath, SecondUpdaterCloudUrlWithPath + settings->ProgrammFileName) != 0) {
std::cout << "\n => Error: Das herunterladen der neuen Version ist fehlgeschlagen." << std::endl;
return 3;
}
} std::cout << std::endl; } std::cout << std::endl;