Sources: use standalone yt-dlp releases
This commit is contained in:
1 parent
7975f2b38e
commit
dfbbdaaf01
2 files changed
+28
-6
No files matched your search
@@ -132,9 +132,12 @@ namespace Echoion::Core
|
|||||||
std::unique_ptr<Void::Concurrency::ThreadPool> pool_;
|
std::unique_ptr<Void::Concurrency::ThreadPool> pool_;
|
||||||
|
|
||||||
// yt-dlp download URLs
|
// yt-dlp download URLs
|
||||||
static constexpr std::string_view YTDLP_DOWNLOAD_LINUX =
|
static constexpr std::string_view YTDLP_DOWNLOAD_LINUX_X86_64 =
|
||||||
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/"
|
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/"
|
||||||
"yt-dlp";
|
"yt-dlp_linux";
|
||||||
|
static constexpr std::string_view YTDLP_DOWNLOAD_LINUX_AARCH64 =
|
||||||
|
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/"
|
||||||
|
"yt-dlp_linux_aarch64";
|
||||||
static constexpr std::string_view YTDLP_DOWNLOAD_WINDOWS =
|
static constexpr std::string_view YTDLP_DOWNLOAD_WINDOWS =
|
||||||
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/"
|
"https://github.com/yt-dlp/yt-dlp/releases/latest/download/"
|
||||||
"yt-dlp.exe";
|
"yt-dlp.exe";
|
||||||
|
|||||||
+23
-4
@@ -87,8 +87,12 @@ namespace Echoion::Core
|
|||||||
return std::string(YTDLP_DOWNLOAD_WINDOWS);
|
return std::string(YTDLP_DOWNLOAD_WINDOWS);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
return std::string(YTDLP_DOWNLOAD_MACOS);
|
return std::string(YTDLP_DOWNLOAD_MACOS);
|
||||||
|
#elif defined(__x86_64__) || defined(_M_X64)
|
||||||
|
return std::string(YTDLP_DOWNLOAD_LINUX_X86_64);
|
||||||
|
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||||
|
return std::string(YTDLP_DOWNLOAD_LINUX_AARCH64);
|
||||||
#else
|
#else
|
||||||
return std::string(YTDLP_DOWNLOAD_LINUX);
|
return {};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +331,11 @@ namespace Echoion::Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string downloadUrl = getDownloadUrl();
|
std::string downloadUrl = getDownloadUrl();
|
||||||
|
if (downloadUrl.empty()) {
|
||||||
|
return Api::fail(
|
||||||
|
Api::ErrorCode::ServiceUnavailable,
|
||||||
|
"No standalone yt-dlp release is available for this platform");
|
||||||
|
}
|
||||||
Void::Log::info(
|
Void::Log::info(
|
||||||
"YtDlpManager", "{}",
|
"YtDlpManager", "{}",
|
||||||
std::format("Downloading yt-dlp from: {}", downloadUrl));
|
std::format("Downloading yt-dlp from: {}", downloadUrl));
|
||||||
@@ -445,12 +454,22 @@ namespace Echoion::Core
|
|||||||
if (!probe || probe->exit_code != 0) {
|
if (!probe || probe->exit_code != 0) {
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
std::filesystem::remove(tempPath, ec);
|
std::filesystem::remove(tempPath, ec);
|
||||||
|
std::string details =
|
||||||
|
probe ? std::format("exit code {}", probe->exit_code)
|
||||||
|
: probe.error().message();
|
||||||
|
if (probe) {
|
||||||
|
const auto& output =
|
||||||
|
!probe->err.empty() ? probe->err : probe->out;
|
||||||
|
if (!output.empty()) {
|
||||||
|
constexpr std::size_t maxDiagnosticLength = 1024;
|
||||||
|
details += std::format(
|
||||||
|
"; output: {}", output.substr(0, maxDiagnosticLength));
|
||||||
|
}
|
||||||
|
}
|
||||||
return Api::fail(
|
return Api::fail(
|
||||||
Api::ErrorCode::ServiceUnavailable,
|
Api::ErrorCode::ServiceUnavailable,
|
||||||
std::format("Downloaded yt-dlp failed verification: {}",
|
std::format("Downloaded yt-dlp failed verification: {}",
|
||||||
probe ? std::format("exit code {}",
|
details));
|
||||||
probe->exit_code)
|
|
||||||
: probe.error().message()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_code renameEc;
|
std::error_code renameEc;
|
||||||
|
|||||||
Reference in new issue
Block a user