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

(feat): now pytubepp helper can install required packages via install buttons using winget and pip

This commit is contained in:
2024-08-29 13:13:32 +05:30
Unverified
parent 1368f07bfe
commit 6bf52dd27e
9 changed files with 196 additions and 26 deletions

View File

@@ -3,5 +3,5 @@
"description": "A helper app for pytubepp-extention to communicate with pytubepp-cli",
"path": "pytubepp-helper-msghost.exe",
"type": "stdio",
"allowed_origins": ["chrome-extension://adebedkaedobamilbbobbajepnnkkfcg/"]
"allowed_origins": ["chrome-extension://adebedkaedobamilbbobbajepnnkkfcg/", "chrome-extension://mmhhbpdhkogpcieblpdilflfoimajepp"]
}

View File

@@ -83,6 +83,40 @@ fn fetch_video_info(url: String) {
}
}
#[tauri::command]
fn install_program(installer: String ,program: String) {
#[cfg(target_os = "windows")]
{
let command = format!("{} install {}", &installer, &program);
Command::new("cmd")
.args(["/k", command.as_str()])
.spawn()
.unwrap();
}
#[cfg(target_os = "linux")]
{
let command = format!("{} install {}", &installer, &program);
Command::new("gnome-terminal")
.args(["--", command.as_str()])
.spawn()
.unwrap();
}
#[cfg(target_os = "macos")]
{
let command = format!("{} install {}", &installer, &program);
Command::new("osascript")
.arg("-e")
.arg(format!(
"tell app \"Terminal\" to activate do script \"{}\"",
command
))
.spawn()
.unwrap();
}
}
#[tauri::command]
fn download_stream(url: String, stream: String) {
#[cfg(target_os = "windows")]
@@ -173,6 +207,7 @@ async fn main() {
// handle_websocket_message,
send_to_extension,
fetch_video_info,
install_program,
download_stream,
receive_frontend_response
])

View File

@@ -19,13 +19,18 @@
"open": true,
"scope": [
{
"name": "is-pytubepp-installed",
"cmd": "pytubepp",
"name": "is-winget-installed",
"cmd": "winget",
"args": ["--version"]
},
{
"name": "is-pytubefix-installed",
"cmd": "pytubefix",
"name": "is-python-installed",
"cmd": "python",
"args": ["--version"]
},
{
"name": "is-pip-installed",
"cmd": "pip",
"args": ["--version"]
},
{
@@ -34,8 +39,8 @@
"args": ["-version"]
},
{
"name": "is-python-installed",
"cmd": "python",
"name": "is-pytubepp-installed",
"cmd": "pytubepp",
"args": ["--version"]
},
{
@@ -75,7 +80,7 @@
{
"title": "PytubePP Helper",
"width": 500,
"height": 300
"height": 320
}
],
"security": {