Renamed youtube-dl queries and logs to yt-dlp

This commit is contained in:
Leonetienne 2022-02-06 14:31:33 +01:00
parent c75ca8ee6f
commit ff95fa8871
7 changed files with 17 additions and 17 deletions

View File

@ -709,7 +709,7 @@ void DownloadManager::WarnIfMissingDependenciesWIN()
#ifdef _WIN #ifdef _WIN
if (!FileSystem::Exists("yt-dlp.exe")) if (!FileSystem::Exists("yt-dlp.exe"))
{ {
log->cout << log->Warn() << "Dependency yt-dlp.exe missing! Try updating it! (\"request\": \"update_dep_youtubedl\"). " log->cout << log->Warn() << "Dependency yt-dlp.exe missing! Try updating it! (\"request\": \"update_dep_YtDlp\"). "
<< "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)"; << "Dependencies HAVE to lie in Tubios working directory! (where the config.json is)";
log->Flush(); log->Flush();
} }

View File

@ -135,10 +135,10 @@ namespace Downloader
static std::vector<DownloadEntry> ParseJsonArrayToEntries(const JasonPP::JsonArray& arr); static std::vector<DownloadEntry> ParseJsonArrayToEntries(const JasonPP::JsonArray& arr);
/// <summary> /// <summary>
/// Will return a youtube-dl quality string based on 'quality' /// Will return a yt-dlp quality string based on 'quality'
/// </summary> /// </summary>
/// <param name="quality">The download quality to get the parameter from</param> /// <param name="quality">The download quality to get the parameter from</param>
/// <returns>The youtube-dl quality parameter</returns> /// <returns>The yt-dlp quality parameter</returns>
static std::string DownloadQualityToStringParams(DOWNLOAD_QUALITY quality); static std::string DownloadQualityToStringParams(DOWNLOAD_QUALITY quality);
/// <summary> /// <summary>

View File

@ -41,7 +41,7 @@ bool RestQueryHandler::ProcessQuery(const std::string clientAdress, const Json&
else if (requestName == "get_os_name") return GetOSName(requestBody, responseBody, responseCode); else if (requestName == "get_os_name") return GetOSName(requestBody, responseBody, responseCode);
else if (requestName == "fetch_session_logs") return FetchSessionLogs(requestBody, responseBody, responseCode); else if (requestName == "fetch_session_logs") return FetchSessionLogs(requestBody, responseBody, responseCode);
else if (requestName == "fetch_alltime_logs") return FetchAlltimeLogs(requestBody, responseBody, responseCode); else if (requestName == "fetch_alltime_logs") return FetchAlltimeLogs(requestBody, responseBody, responseCode);
else if (requestName == "update_dep_youtubedl") return UpdateYoutubeDL(requestBody, responseBody, responseCode); else if (requestName == "update_dep_yt-dlp") return UpdateYtDlp(requestBody, responseBody, responseCode);
else if (requestName == "remove_download_entry") return RemoveDownloadEntry(requestBody, responseBody, responseCode); else if (requestName == "remove_download_entry") return RemoveDownloadEntry(requestBody, responseBody, responseCode);
else if (requestName == "update_config") return UpdateConfig(requestBody, responseBody, responseCode); else if (requestName == "update_config") return UpdateConfig(requestBody, responseBody, responseCode);
else if (requestName == "reset_config_to_default_values") return ResetConfigDefaults(requestBody, responseBody, responseCode); else if (requestName == "reset_config_to_default_values") return ResetConfigDefaults(requestBody, responseBody, responseCode);
@ -370,9 +370,9 @@ bool RestQueryHandler::GetDiskUsage(const JsonBlock& request, JsonBlock& respons
{ {
dependencies += FileSystem::CalculateSize("ffplay.exe"); dependencies += FileSystem::CalculateSize("ffplay.exe");
} }
if (FileSystem::Exists("youtube-dl.exe")) if (FileSystem::Exists("yt-dlp.exe"))
{ {
dependencies += FileSystem::CalculateSize("youtube-dl.exe"); dependencies += FileSystem::CalculateSize("yt-dlp.exe");
} }
diskUsages.Set("dependencies") = dependencies; diskUsages.Set("dependencies") = dependencies;
@ -397,12 +397,12 @@ bool RestQueryHandler::ClearLogs(const JsonBlock& request, JsonBlock& responseBo
return true; return true;
} }
bool RestQueryHandler::UpdateYoutubeDL(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode) bool RestQueryHandler::UpdateYtDlp(const JsonBlock& request, JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode)
{ {
log->cout << "Updating youtube-dl..."; log->cout << "Updating yt-dlp...";
log->Flush(); log->Flush();
std::string result = Updater::UpdateYoutubeDL(); std::string result = Updater::UpdateYtDlp();
if (result == "OK") if (result == "OK")
{ {
log->cout << " => OK!"; log->cout << " => OK!";
@ -410,7 +410,7 @@ bool RestQueryHandler::UpdateYoutubeDL(const JsonBlock& request, JsonBlock& resp
responseCode = HTTP_STATUS_CODE::OK; responseCode = HTTP_STATUS_CODE::OK;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::OK)); responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::OK));
responseBody.Set("message") = "Updated youtube-dl.exe successfully!"; responseBody.Set("message") = "Updated yt-dlp.exe successfully!";
} }
else if (result == "not implemented") else if (result == "not implemented")
{ {
@ -420,7 +420,7 @@ bool RestQueryHandler::UpdateYoutubeDL(const JsonBlock& request, JsonBlock& resp
log->Flush(); log->Flush();
responseCode = HTTP_STATUS_CODE::NOT_IMPLEMENTED; responseCode = HTTP_STATUS_CODE::NOT_IMPLEMENTED;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::NOT_IMPLEMENTED)); responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::NOT_IMPLEMENTED));
responseBody.Set("message") = "On linux you have to update youtube-dl yourself since it is a system-wide package handled by various package managers!"; responseBody.Set("message") = "On linux you have to update yt-dlp yourself since it is a system-wide package handled by various package managers!";
} }
else // Some other error else // Some other error
{ {
@ -429,7 +429,7 @@ bool RestQueryHandler::UpdateYoutubeDL(const JsonBlock& request, JsonBlock& resp
responseCode = HTTP_STATUS_CODE::INTERNAL_SERVER_ERROR; responseCode = HTTP_STATUS_CODE::INTERNAL_SERVER_ERROR;
responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::INTERNAL_SERVER_ERROR)); responseBody.CloneFrom(RestResponseTemplates::GetByCode(HTTP_STATUS_CODE::INTERNAL_SERVER_ERROR));
responseBody.Set("message") = "Unable do update youtube-dl.exe! See urlmon " + result; responseBody.Set("message") = "Unable do update yt-dlp.exe! See urlmon " + result;
} }
return true; return true;

View File

@ -32,7 +32,7 @@ namespace Rest
static bool FetchAlltimeLogs(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool FetchAlltimeLogs(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool FetchSessionLogs(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool FetchSessionLogs(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool GetDiskUsage(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool GetDiskUsage(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool UpdateYoutubeDL(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool UpdateYtDlp(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool RemoveDownloadEntry(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool RemoveDownloadEntry(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool UpdateConfig(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool UpdateConfig(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool ResetConfigDefaults(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode); static bool ResetConfigDefaults(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);

View File

@ -2,7 +2,7 @@
using namespace JasonPP; using namespace JasonPP;
std::string Updater::UpdateYoutubeDL() std::string Updater::UpdateYtDlp()
{ {
#ifdef _WIN #ifdef _WIN
// Fetch rest respone for latest yt-dlp release // Fetch rest respone for latest yt-dlp release

View File

@ -13,8 +13,8 @@ class Updater
{ {
public: public:
/// <summary> /// <summary>
/// Will update youtube-dl.exe on windows only!! Returns error message. On linux, you have to update it yourself, since it is a package of its own! /// Will update yt-dlp.exe on windows only!! Returns error message. On linux, you have to update it yourself, since it is a package of its own!
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
static std::string UpdateYoutubeDL(); static std::string UpdateYtDlp();
}; };

View File

@ -209,7 +209,7 @@ export default {
updateYtdl: function() { updateYtdl: function() {
const that = this; const that = this;
axios.post("/api", { axios.post("/api", {
request: "update_dep_youtubedl", request: "update_dep_yt-dlp",
}).then(function(response){ }).then(function(response){
if (response.data.status === "OK") { if (response.data.status === "OK") {
that.$store.dispatch("logs/update", that); that.$store.dispatch("logs/update", that);