Added warnings for missing dependencies

This commit is contained in:
Leon Etienne (ubuntu wsl) 2020-09-30 00:13:12 +02:00
parent db707b794b
commit e2338f423c
2 changed files with 38 additions and 0 deletions

View File

@ -31,6 +31,8 @@ std::string DownloadManager::QueueDownload(std::string url, DOWNLOAD_MODE mode)
newDownload.queued_timestamp = time(0); newDownload.queued_timestamp = time(0);
newDownload.download_url = "/download/" + newDownload.tubio_id; newDownload.download_url = "/download/" + newDownload.tubio_id;
WarnIfMissingDependenciesWIN();
if (!IsJsonValid(jsString)) if (!IsJsonValid(jsString))
{ {
newDownload.status = DOWNLOAD_STATUS::FAILED; newDownload.status = DOWNLOAD_STATUS::FAILED;
@ -545,6 +547,37 @@ std::string DownloadManager::CreateNewTubioID()
return newId; return newId;
} }
void DownloadManager::WarnIfMissingDependenciesWIN()
{
#ifdef _WIN
if (!FileSystem::Exists("youtube-dl.exe"))
{
log->cout << log->Warn() << "Dependency youtube-dl.exe missing! Try updating it! (\"request\": \"update_dep_youtubedl\"). "
<< "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)";
log->Flush();
}
if (!FileSystem::Exists("ffmpeg.exe"))
{
log->cout << log->Warn() << "Dependency ffmpeg.exe missing! (Get it here: https://www.gyan.dev/ffmpeg/builds/). "
<< "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)";
log->Flush();
}
if (!FileSystem::Exists("ffplay.exe"))
{
log->cout << log->Warn() << "Dependency ffplay.exe missing! (Get it here: https://www.gyan.dev/ffmpeg/builds/). "
<< "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)";
log->Flush();
}
if (!FileSystem::Exists("ffprobe.exe"))
{
log->cout << log->Warn() << "Dependency ffprobe.exe missing! (Get it here: https://www.gyan.dev/ffmpeg/builds/). "
<< "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)";
log->Flush();
}
#endif
return;
}
std::size_t DownloadManager::GetNumActiveDownloads() std::size_t DownloadManager::GetNumActiveDownloads()
{ {
std::size_t counter = 0; std::size_t counter = 0;

View File

@ -102,6 +102,11 @@ namespace Downloader
static void FetchInformation(std::string url, std::string tubId); static void FetchInformation(std::string url, std::string tubId);
static std::string CreateNewTubioID(); static std::string CreateNewTubioID();
/// <summary>
/// Will check for missing dependencies (windows only) and warn if missing
/// </summary>
static void WarnIfMissingDependenciesWIN();
static std::size_t GetNumActiveDownloads(); static std::size_t GetNumActiveDownloads();
/// <summary> /// <summary>