Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

fix(player): flatpak args; fix(install): sudo fallback

Samir Hossainsf5e6cb5bb127
diff --git a/install.sh b/install.sh
index fdbf487..63a6b11 100755
--- a/install.sh
+++ b/install.sh
@@ -88,8 +88,15 @@ if [ -d "$INSTALL_DIR" ] && [ -w "$INSTALL_DIR" ]; then
install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"
elif command -v sudo >/dev/null 2>&1; then
log_info "Requires sudo privileges to write to $INSTALL_DIR..."
- sudo mkdir -p "$INSTALL_DIR"
- sudo install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"
+ if sudo mkdir -p "$INSTALL_DIR" && sudo install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"; then
+ :
+ else
+ log_warn "Sudo access failed or was cancelled. Falling back to local installation..."
+ INSTALL_DIR="$HOME/.local/bin"
+ APP_PATH="$INSTALL_DIR/$BIN_NAME"
+ mkdir -p "$INSTALL_DIR"
+ install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"
+ fi
else
INSTALL_DIR="$HOME/.local/bin"
APP_PATH="$INSTALL_DIR/$BIN_NAME"
diff --git a/src/tui/player.rs b/src/tui/player.rs
index f051240..9f2f032 100644
--- a/src/tui/player.rs
+++ b/src/tui/player.rs
@@ -145,16 +145,21 @@ fn mpv_command(
command.arg(format!("{prefix}http-header-fields={fields}"));
}
if let Some(subtitle) = subtitle {
- let sub_arg = if executable.starts_with("flatpak run ") {
- format!("@@ {} @@", subtitle)
- } else {
- subtitle.to_string()
- };
-
- if iina {
- command.arg(format!("--mpv-sub-files={sub_arg}"));
+ if executable.starts_with("flatpak run ") {
+ let opt = if iina {
+ "--mpv-sub-files"
+ } else {
+ "--sub-file"
+ };
+ command.arg(opt);
+ command.arg("@@").arg(subtitle).arg("@@");
} else {
- command.arg(format!("--sub-file={sub_arg}"));
+ let opt = if iina {
+ "--mpv-sub-files"
+ } else {
+ "--sub-file"
+ };
+ command.arg(format!("{}={}", opt, subtitle));
}
}
@@ -252,12 +257,11 @@ fn vlc_command(
}
}
if let Some(subtitle) = subtitle {
- let sub_arg = if executable.starts_with("flatpak run ") {
- format!("@@ {} @@", subtitle)
+ if executable.starts_with("flatpak run ") {
+ command.arg("--sub-file").arg("@@").arg(subtitle).arg("@@");
} else {
- subtitle.to_string()
- };
- command.arg(format!("--sub-file={sub_arg}"));
+ command.arg(format!("--sub-file={subtitle}"));
+ }
}
command.arg(url);