jhj
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 23:31:05 -08:00
parent a2ec5ba22b
commit 2542a68479
5 changed files with 117 additions and 2 deletions

View File

@@ -72,5 +72,13 @@ to access your file and view it, you can run either
or if you have mpv installed (the preferred way for video files) or if you have mpv installed (the preferred way for video files)
(Tip: the bootstrap/setup scripts will try to install `mpv` for you if it's not found on PATH. If it isn't available, install `mpv` manually and ensure `mpv` is on your PATH.)
@1 | .pipe @1 | .pipe
# Bandcamp downloading (provider method)
<figure>
<figcaption><🜂🜄|🜁🜃></figcaption>
<pre><code class="language-powershell">search-provider -provider bandcamp "artist:altrusian grace media"
</code></pre>
</figure>

View File

@@ -11,7 +11,7 @@ Medios-Macina is a CLI media manager and toolkit focused on downloading, tagging
## Quick start ⚡ ## Quick start ⚡
`docs/BOOTSTRAP.md` and use `scripts/bootstrap.ps1` (Windows) or `scripts/bootstrap.sh` (Linux/macOS) to create a venv and install the project. Alternatively, simply run the opinionated helper: `python ./scripts/setup.py`. By default (no flags), `setup.py` will auto-detect your platform and run the matching bootstrap script in **non-interactive (quiet)** mode so you don't need to run the platform-specific script yourself. Note: the Deno installer can require interactive input on some systems; if the automated Deno install fails, the script will warn and you can install Deno manually by following `docs/BOOTSTRAP.md`. `docs/BOOTSTRAP.md` and use `scripts/bootstrap.ps1` (Windows) or `scripts/bootstrap.sh` (Linux/macOS) to create a venv and install the project. Alternatively, simply run the opinionated helper: `python ./scripts/setup.py`. By default (no flags), `setup.py` will auto-detect your platform and run the matching bootstrap script in **non-interactive (quiet)** mode so you don't need to run the platform-specific script yourself. The bootstrap scripts also attempt (best-effort) to install `mpv` if it's missing from PATH. Note: the Deno installer can require interactive input on some systems; if the automated Deno install fails, the script will warn and you can install Deno manually by following `docs/BOOTSTRAP.md`.
1. Install Python requirements: 1. Install Python requirements:

View File

@@ -1,6 +1,58 @@
<# <#
.SYNOPSIS .SYNOPSIS
Bootstrap a Python virtualenv and install the project on Windows (PowerShell). Bootstrap a Python virtualenv and install the project on Windows (PowerShell).
function Ensure-Mpv {
# mpv is used by some pipelines; try to ensure it's available on PATH.
try {
$mpvCmd = Get-Command mpv -ErrorAction SilentlyContinue
if ($mpvCmd) {
try {
$v = & mpv --version 2>$null | Select-Object -First 1
if ($v) { Write-Log "mpv found: $v" "INFO" } else { Write-Log "mpv found: $($mpvCmd.Path)" "INFO" }
} catch {
Write-Log "mpv found: $($mpvCmd.Path)" "INFO"
}
return
}
} catch {}
Write-Log "mpv not found on PATH; attempting to install..." "INFO"
try {
if (Get-Command choco -ErrorAction SilentlyContinue) {
& choco install mpv -y --no-progress | Out-Null
} elseif (Get-Command scoop -ErrorAction SilentlyContinue) {
& scoop install mpv | Out-Null
} elseif (Get-Command winget -ErrorAction SilentlyContinue) {
# Best-effort: winget may require a specific id depending on environment.
& winget install --silent --accept-package-agreements --accept-source-agreements mpv | Out-Null
} else {
Write-Log "mpv not found and no supported package manager found (choco/scoop/winget). Install mpv and ensure it's on PATH." "ERROR"
return
}
} catch {
Write-Log "mpv install attempt failed: $_" "ERROR"
return
}
try {
$mpvCmd2 = Get-Command mpv -ErrorAction SilentlyContinue
if ($mpvCmd2) {
try {
$v2 = & mpv --version 2>$null | Select-Object -First 1
if ($v2) { Write-Log "mpv installed: $v2" "INFO" } else { Write-Log "mpv installed: $($mpvCmd2.Path)" "INFO" }
} catch {
Write-Log "mpv installed: $($mpvCmd2.Path)" "INFO"
}
} else {
Write-Log "mpv install attempted but mpv is still not on PATH. Install mpv manually." "ERROR"
}
} catch {}
}
if ($IsWindowsPlatform) {
Ensure-Mpv
}
.DESCRIPTION .DESCRIPTION
Creates a Python virtual environment (default: .venv), upgrades pip, installs the project Creates a Python virtual environment (default: .venv), upgrades pip, installs the project

View File

@@ -476,6 +476,58 @@ else
fi fi
fi fi
# Ensure mpv is available (used by some pipelines). Best-effort install if missing.
install_mpv_if_missing() {
if command -v mpv >/dev/null 2>&1; then
echo "mpv found: $(mpv --version 2>/dev/null | head -n 1 || echo 'mpv')"
return 0
fi
echo "mpv not found on PATH; attempting to install..." >&2
local prefix=""
if [[ $(id -u) -ne 0 ]]; then
if command -v sudo >/dev/null 2>&1; then
prefix="sudo"
else
echo "Warning: mpv is missing and sudo is not available; install mpv manually and ensure it's on PATH." >&2
return 0
fi
fi
# Try a few common package managers.
if command -v apt-get >/dev/null 2>&1; then
$prefix apt-get update -y >/dev/null 2>&1 || $prefix apt-get update || true
$prefix env DEBIAN_FRONTEND=noninteractive apt-get install -y mpv || true
elif command -v apt >/dev/null 2>&1; then
$prefix apt update -y >/dev/null 2>&1 || $prefix apt update || true
$prefix env DEBIAN_FRONTEND=noninteractive apt install -y mpv || true
elif command -v dnf >/dev/null 2>&1; then
$prefix dnf install -y mpv || true
elif command -v yum >/dev/null 2>&1; then
$prefix yum install -y mpv || true
elif command -v pacman >/dev/null 2>&1; then
$prefix pacman -S --noconfirm mpv || true
elif command -v zypper >/dev/null 2>&1; then
$prefix zypper --non-interactive install mpv || true
elif command -v apk >/dev/null 2>&1; then
$prefix apk add --no-interactive mpv || $prefix apk add mpv || true
elif command -v brew >/dev/null 2>&1; then
brew install mpv || true
else
echo "Warning: mpv is missing and no supported package manager was found. Install mpv manually and ensure it's on PATH." >&2
return 0
fi
if command -v mpv >/dev/null 2>&1; then
echo "mpv installed: $(mpv --version 2>/dev/null | head -n 1 || echo 'mpv')"
else
echo "Warning: attempted to install mpv but it is still not on PATH. Install mpv manually." >&2
fi
}
install_mpv_if_missing
if [[ "$DESKTOP" == "true" ]]; then if [[ "$DESKTOP" == "true" ]]; then
echo "Creating desktop launcher..." echo "Creating desktop launcher..."
EXEC_PATH="$VENV_PATH/bin/mm" EXEC_PATH="$VENV_PATH/bin/mm"

View File

@@ -13,6 +13,9 @@ run the platform-specific bootstrap helper (`scripts/bootstrap.ps1` on Windows
or `scripts/bootstrap.sh` on POSIX) in **non-interactive (quiet)** mode so a or `scripts/bootstrap.sh` on POSIX) in **non-interactive (quiet)** mode so a
single `python ./scripts/setup.py` call does the usual bootstrap on your OS. single `python ./scripts/setup.py` call does the usual bootstrap on your OS.
The platform bootstrap scripts also attempt (best-effort) to install `mpv` if
it is not found on your PATH, since some workflows use it.
Usage: Usage:
python ./scripts/setup.py # install deps and playwright browsers (or run platform bootstrap if no args) python ./scripts/setup.py # install deps and playwright browsers (or run platform bootstrap if no args)
python ./scripts/setup.py --skip-deps python ./scripts/setup.py --skip-deps
@@ -409,7 +412,7 @@ python -m medeia_macina.cli_entry @args
bat_text = ( bat_text = (
"@echo off\r\n" "@echo off\r\n"
"set SCRIPT_DIR=%~dp0\r\n" "set SCRIPT_DIR=%~dp0\r\n"
"set PATH=%SCRIPT_DIR%\.venv\Scripts;%PATH%\r\n" "set PATH=%SCRIPT_DIR%\\.venv\\Scripts;%PATH%\r\n"
"if exist \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" -m medeia_macina.cli_entry %*\r\n" "if exist \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" \"%SCRIPT_DIR%\\.venv\\Scripts\\python.exe\" -m medeia_macina.cli_entry %*\r\n"
"if exist \"%SCRIPT_DIR%\\CLI.py\" python \"%SCRIPT_DIR%\\CLI.py\" %*\r\n" "if exist \"%SCRIPT_DIR%\\CLI.py\" python \"%SCRIPT_DIR%\\CLI.py\" %*\r\n"
"python -m medeia_macina.cli_entry %*\r\n" "python -m medeia_macina.cli_entry %*\r\n"