diff --git a/README.md b/README.md
index dc6090e..7557149 100644
--- a/README.md
+++ b/README.md
@@ -138,3 +138,4 @@ I do NOT endorse illegal downloads in any way, shape, or form. Tubio is a tool t
Tubio is distributed under the GNU General Public License v3.0.
Please read the [license file](https://gitea.leonetienne.de/leonetienne/Tubio/src/branch/master/LICENSE).
+
diff --git a/Tubio.sln b/Tubio.sln
deleted file mode 100644
index 890b2c6..0000000
--- a/Tubio.sln
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30413.136
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tubio", "Tubio\Tubio.vcxproj", "{8AE799C5-CB17-4714-A362-D8B9817A723E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Debug|x64.ActiveCfg = Debug|x64
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Debug|x64.Build.0 = Debug|x64
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Debug|x86.ActiveCfg = Debug|Win32
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Debug|x86.Build.0 = Debug|Win32
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Release|x64.ActiveCfg = Release|x64
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Release|x64.Build.0 = Release|x64
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Release|x86.ActiveCfg = Release|Win32
- {8AE799C5-CB17-4714-A362-D8B9817A723E}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {11C6C438-21D5-40CC-9CDC-FBA3AE6634F3}
- EndGlobalSection
-EndGlobal
diff --git a/Tubio/CMakeLists.txt b/Tubio/CMakeLists.txt
index 080830f..14b4717 100755
--- a/Tubio/CMakeLists.txt
+++ b/Tubio/CMakeLists.txt
@@ -49,3 +49,5 @@ add_executable(Tubio
external_dependencies/leonetienne/stringtools/StringTools.h
)
+target_link_libraries(Tubio pthread)
+
diff --git a/Tubio/DownloadManager.cpp b/Tubio/DownloadManager.cpp
index 6b5678a..bc3de0e 100644
--- a/Tubio/DownloadManager.cpp
+++ b/Tubio/DownloadManager.cpp
@@ -162,7 +162,7 @@ void DownloadManager::DownloadNext()
std::string ytdl_call_video_base =
"yt-dlp --newline --no-call-home --no-playlist --no-part --no-warnings --socket-timeout 5 --limit-rate $$DL_RATE"
" --no-mtime --no-cache-dir -f \"$$QUALITY\" --recode-video mp4 --prefer-ffmpeg"
- " -o \"$$DL_FILE\" \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\"";
+ " -o \"$$DL_FILE\" \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\" 2>&1";
// Fill template
ytdl_call_video_base = Internal::StringHelpers::Replace(ytdl_call_video_base, "$$QUALITY", DownloadQualityToStringParams(entry->quality));
@@ -180,7 +180,7 @@ void DownloadManager::DownloadNext()
std::string ytdl_call_audio_base =
"yt-dlp --newline --no-call-home --no-playlist --no-part --no-warnings --socket-timeout 5 --limit-rate $$DL_RATE"
" --no-mtime --no-cache-dir -f worstvideo+bestaudio --audio-format mp3 --audio-quality 0 --extract-audio -o \"$$DL_FILE\""
- " \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\"";
+ " \"$$DL_URL\" > \"$$DL_PROG_BUF_FILE\" 2>&1";
// Fill template
diff --git a/Tubio/HttpServer.cpp b/Tubio/HttpServer.cpp
index eee915e..8f50c9b 100644
--- a/Tubio/HttpServer.cpp
+++ b/Tubio/HttpServer.cpp
@@ -102,6 +102,10 @@ void HttpServer::EventHandler(mg_connection* pNc, int ev, void* p)
{
ProcessAPIRequest(pNc, ev, p, peer_addr);
}
+ else if (requestedUri.substr(0, 12) == "/downloadlog")
+ {
+ ServeDownloadLog(pNc, ev, p, requestedUri);
+ }
else if (requestedUri.substr(0, 9) == "/download")
{
ServeDownloadeableResource(pNc, ev, p, requestedUri);
@@ -216,6 +220,31 @@ void HttpServer::ServeDownloadeableResource(mg_connection* pNc, int ev, void* p,
return;
}
+void HttpServer::ServeDownloadLog(mg_connection* pNc, int ev, void* p, std::string uri)
+{
+ std::string fileId = uri.substr(13, uri.length() - 13);
+
+ if (Downloader::DownloadManager::DoesTubioIDExist(fileId))
+ {
+ Downloader::DownloadEntry& entry = Downloader::DownloadManager::GetDownloadEntryByTubioID(fileId);
+
+ std::stringstream ss;
+ std::string logFilename = std::string("./dlcache/dlprogbuf/") + fileId + ".buf";
+
+ ss << "Access-Control-Allow-Origin: *\nContent-Type: text/plain; Cache-Control: must-revalidate, post-check=0, pre-check=0";
+ mg_http_serve_file(pNc, (http_message*)p, logFilename.c_str(), mg_mk_str("text/plain"), mg_mk_str(ss.str().c_str()));
+ }
+ else
+ {
+ Json j;
+ std::stringstream ss;
+ j.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::BAD_REQUEST, "Invalid tubio id!"));
+ ServeStringToConnection(pNc, j.Render(), (int)HTTP_STATUS_CODE::BAD_REQUEST);
+ }
+
+ return;
+}
+
bool HttpServer::IsConnectionAllowed(std::string peer_address, std::string& denialReason)
{
// Localhost is always allowed!
diff --git a/Tubio/HttpServer.h b/Tubio/HttpServer.h
index 0f95a43..7ba650f 100644
--- a/Tubio/HttpServer.h
+++ b/Tubio/HttpServer.h
@@ -24,6 +24,7 @@ namespace Rest
bool InitWebServer();
static void ProcessAPIRequest(struct mg_connection* pNc, int ev, void* p, std::string peerAddress);
static void ServeDownloadeableResource(struct mg_connection* pNc, int ev, void* p, std::string uri);
+ static void ServeDownloadLog(struct mg_connection* pNc, int ev, void* p, std::string uri);
static void EventHandler(struct mg_connection* pNc, int ev, void* p);
static void ServeStringToConnection(struct mg_connection* c, std::string str, int httpStatusCode = 200);
diff --git a/Tubio/RestQueryHandler.cpp b/Tubio/RestQueryHandler.cpp
index 65b7cda..e0de386 100644
--- a/Tubio/RestQueryHandler.cpp
+++ b/Tubio/RestQueryHandler.cpp
@@ -115,11 +115,11 @@ bool RestQueryHandler::QueueDownload(const JsonBlock& request, JsonBlock& respon
return false;
}
- log->cout << "Queued video \"" << videoUrl << "\"...";
- log->Flush();
-
std::string tubId = DownloadManager::QueueDownload(videoUrl, mode, quality);
+ log->cout << "Queued video \"" << videoUrl << "\" with id \"" << tubId << "\"...";
+ log->Flush();
+
responseCode = HTTP_STATUS_CODE::OK;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::OK));
responseBody.Set("message") = "Download queued!";
diff --git a/Tubio/Tubio.vcxproj b/Tubio/Tubio.vcxproj
deleted file mode 100644
index c3c0b3d..0000000
--- a/Tubio/Tubio.vcxproj
+++ /dev/null
@@ -1,195 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 16.0
- Win32Proj
- {8ae799c5-cb17-4714-a362-d8b9817a723e}
- Tubio
- 10.0
-
-
-
- Application
- true
- v142
- Unicode
-
-
- Application
- false
- v142
- true
- Unicode
-
-
- Application
- true
- v142
- Unicode
-
-
- Application
- false
- v142
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- false
-
-
- true
-
-
- false
-
-
-
- Level3
- true
- _WIN;JASONPP_RENDER_SORTED;_WIN32;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
- stdcpp17
-
-
- Console
- true
- urlmon.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- true
- true
- true
- _WIN;JASONPP_RENDER_SORTED;_WIN32;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
- stdcpp17
-
-
- Console
- true
- true
- true
- urlmon.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- true
- _WIN;JASONPP_RENDER_SORTED;_WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
- stdcpp17
-
-
- Console
- true
- urlmon.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- true
- true
- true
- _WIN;JASONPP_RENDER_SORTED;_WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- true
- stdcpp17
-
-
- Console
- true
- true
- true
- urlmon.lib;%(AdditionalDependencies)
-
-
-
-
-
-
- TurnOffAllWarnings
- TurnOffAllWarnings
- TurnOffAllWarnings
- TurnOffAllWarnings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tubio/Tubio.vcxproj.filters b/Tubio/Tubio.vcxproj.filters
deleted file mode 100644
index 4ca00f7..0000000
--- a/Tubio/Tubio.vcxproj.filters
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {714ac1f3-3586-412c-9b83-bf00f08d58ab}
-
-
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- Quelldateien
-
-
- _external_dependencies
-
-
- _external_dependencies
-
-
- Quelldateien
-
-
- Quelldateien
-
-
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- _external_dependencies
-
-
- _external_dependencies
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
- Headerdateien
-
-
-
\ No newline at end of file
diff --git a/Tubio/Version.h b/Tubio/Version.h
index 147f94f..057a7fc 100644
--- a/Tubio/Version.h
+++ b/Tubio/Version.h
@@ -1,2 +1,2 @@
#pragma once
-#define TUBIO_SERVER_VERSION (0.65)
+#define TUBIO_SERVER_VERSION (0.66)