1
1
mirror of https://github.com/neosubhamoy/pytubepp-helper.git synced 2026-02-04 11:22:22 +05:30

(feat): added caption support with backwards compatibility

This commit is contained in:
2025-02-07 21:21:32 +05:30
Verified
parent d8a191e408
commit 9c55edeb46
2 changed files with 6 additions and 5 deletions

View File

@@ -255,10 +255,11 @@ fn install_program(icommand: String) {
}
#[tauri::command]
fn download_stream(url: String, stream: String) {
fn download_stream(url: String, stream: String, caption: Option<String>) {
let caption = caption.unwrap_or("none".to_string());
#[cfg(target_os = "windows")]
{
let command = format!("pytubepp \"{}\" -s {}", &url, &stream);
let command = format!("pytubepp \"{}\" -s {} -c {}", &url, &stream, &caption);
Command::new("cmd")
.args(["/k", command.as_str()])
.spawn()
@@ -267,7 +268,7 @@ fn download_stream(url: String, stream: String) {
#[cfg(target_os = "linux")]
{
let command = format!("pytubepp \"{}\" -s {}", &url, &stream);
let command = format!("pytubepp \"{}\" -s {} -c {}", &url, &stream, &caption);
Command::new("gnome-terminal")
.args(["--", "bash", "-c", command.as_str()])
.spawn()
@@ -276,7 +277,7 @@ fn download_stream(url: String, stream: String) {
#[cfg(target_os = "macos")]
{
let command = format!("pytubepp \"{}\" -s {}", &url, &stream);
let command = format!("pytubepp \"{}\" -s {} -c {}", &url, &stream, &caption);
let escaped_command = command.replace("\"", "\\\"");
let applescript = format!(