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

(feat): added support for macOS

This commit is contained in:
2024-12-16 22:37:00 +05:30
Verified
parent 1dc8ef659f
commit c235db28c1
11 changed files with 416 additions and 261 deletions

View File

@@ -67,12 +67,19 @@ fn fetch_video_info(url: String) {
#[cfg(target_os = "macos")]
{
let command = format!("pytubepp \"{}\" -i", &url);
let escaped_command = command.replace("\"", "\\\"");
let applescript = format!(
"tell application \"Terminal\"\n\
do script \"{}\"\n\
activate\n\
end tell",
escaped_command
);
Command::new("osascript")
.arg("-e")
.arg(format!(
"tell app \"Terminal\" to activate do script \"{}\"",
command
))
.arg(applescript)
.spawn()
.unwrap();
}
@@ -101,12 +108,19 @@ fn install_program(icommand: String) {
#[cfg(target_os = "macos")]
{
let command = format!("{}", &icommand);
let escaped_command = command.replace("\"", "\\\"");
let applescript = format!(
"tell application \"Terminal\"\n\
do script \"{}\"\n\
activate\n\
end tell",
escaped_command
);
Command::new("osascript")
.arg("-e")
.arg(format!(
"tell app \"Terminal\" to activate do script \"{}\"",
command
))
.arg(applescript)
.spawn()
.unwrap();
}
@@ -135,12 +149,19 @@ fn download_stream(url: String, stream: String) {
#[cfg(target_os = "macos")]
{
let command = format!("pytubepp \"{}\" -s {}", &url, &stream);
let escaped_command = command.replace("\"", "\\\"");
let applescript = format!(
"tell application \"Terminal\"\n\
do script \"{}\"\n\
activate\n\
end tell",
escaped_command
);
Command::new("osascript")
.arg("-e")
.arg(format!(
"tell app \"Terminal\" to activate do script \"{}\"",
command
))
.arg(applescript)
.spawn()
.unwrap();
}