diff --git a/src/parameterManager.h b/src/parameterManager.h index 1dceb32..969f762 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -26,6 +26,7 @@ #endif #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" +#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" enum Modus { @@ -50,18 +51,18 @@ struct Settings { #if defined (_X86_) || defined (__amd64__) || defined (_M_IX86) // Wenn das Betriebsystem LINUX ist und 64 Bit ist: #if defined (__linux) && ( defined (_LP64) || defined (__LP64__)) - const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-LINx86.txt"); - const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-LINx86"); + const std::string VersionFileName = std::string("Version-LINx86.txt"); + const std::string ProgrammFileName = std::string("S_New4-LINx86"); #else //Wenn das Betriebsystem Windows ist und 64 Bit ist #if defined (_WIN64) - const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-WINx86.txt"); - const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-WINx86.exe"); + const std::string VersionFileName = std::string("Version-WINx86.txt"); + const std::string ProgrammFileName = std::string("S_New4-WINx86.exe"); #else //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 ) - const std::string VersionFileUrl = ""; - const std::string ProgrammFileUrl = ""; + const std::string VersionFileName = ""; + const std::string ProgrammFileName = ""; #endif #endif @@ -69,12 +70,12 @@ struct Settings { #else //Raspberry Pi -> ARMv6 -> 32Bit #if defined(__ARM_ARCH_6__) && defined (__linux) - const std::string VersionFileUrl = UpdaterCloudUrlWithPath + std::string("Version-LIN-ARMv6.txt"); - const std::string ProgrammFileUrl = UpdaterCloudUrlWithPath + std::string("S_New4-LIN-ARMv6"); + const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt"); + const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6"); #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 ) - const std::string VersionFileUrl = ""; - const std::string ProgrammFileUrl = ""; + const std::string VersionFileName = ""; + const std::string ProgrammFileName = ""; #endif #endif @@ -92,7 +93,7 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng,", genaueHoster = "", - version = "4.2.2", + version = "4.3.0", defaultFileVersion="1.8", default_checkPath = "", default_Searchmuster = "S%Staffel%E%Folge%"; diff --git a/src/programManager.cpp b/src/programManager.cpp index bc389e2..dc67995 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -1103,13 +1103,18 @@ int ProgramManager::newsModus(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; return 4; } 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) { // Wenn debug mode print error @@ -1183,9 +1188,13 @@ int ProgramManager::updateModus(Settings *settings) //Download new Version of Program std::cout << " => INFO: Lade neue Version herunter..." << std::endl; - if( pageManager.downLoadToFile(downloadedFilePath, settings->ProgrammFileUrl) != 0) { - std::cout << "\n => Error: Das herunterladen der neuen Version ist fehlgeschlagen." << std::endl; - return 3; + if( pageManager.downLoadToFile(downloadedFilePath, UpdaterCloudUrlWithPath + settings->ProgrammFileName) != 0) { + std::cerr << (" => Warnung: Verwende 2t-Link für Download!") << std::endl; + + 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;