0.2.1: packages for Arch, apt, Nix and Windows; Windows fixes (finds yt-dlp.exe and ffmpeg.exe, no console windows, opens folders and links)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
3d7fd38e9b
commit
fc04ac7e87
25 changed files with 678 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
|||
/releases/
|
||||
*.AppImage
|
||||
.directory
|
||||
/dist
|
||||
|
|
|
|||
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -111,7 +111,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||
|
||||
[[package]]
|
||||
name = "audiphi"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"dirs",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "audiphi"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
description = "A Material 3 music downloader and quick player for any music service"
|
||||
license = "MIT"
|
||||
|
|
|
|||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 Audiphi contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
27
README.md
27
README.md
|
|
@ -15,13 +15,34 @@ proper tags, cover art and synced lyrics. This is the Rust port of the Python/Py
|
|||
- **Quick player** (libmpv) with a spectrum ring around the cover, wavy seek bar and click-to-seek lyrics.
|
||||
- **Colours** from Caelestia's scheme, your desktop accent, the album art, or a colour you pick.
|
||||
|
||||
## Requirements
|
||||
## Install a release
|
||||
|
||||
`yt-dlp`, `ffmpeg`, `mpv` (libmpv) and, for YouTube, a JavaScript runtime (`deno` recommended).
|
||||
Downloads are on the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi/releases); check them against `SHA256SUMS-<version>`. The Linux builds
|
||||
are made on Arch Linux and need a recent glibc (the version is named in the packages and checked by the installer),
|
||||
so they run on Arch and other up-to-date distributions; on older ones, build from source.
|
||||
|
||||
- **Arch Linux:** `sudo pacman -U Audiphi-<version>-arch-x86_64.pkg.tar.zst` (package `audiphi-bin`; remove it with
|
||||
`sudo pacman -R audiphi-bin`). `packaging/arch/PKGBUILD` builds the same package from the release.
|
||||
- **Debian, Ubuntu and other apt systems:** `sudo apt install ./Audiphi-<version>-amd64.deb`.
|
||||
- **Nix:** `nix profile install git+https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi` (this repo is a flake), or `callPackage ./packaging/nix { }`.
|
||||
- **Any distribution:** unpack `Audiphi-<version>-Linux-x86_64.tar.gz` and run `sh install.sh` inside (your home,
|
||||
`~/.local`, no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also
|
||||
deletes settings and data. `installer.sh` from this repo does the same next to a downloaded tar.gz or AppImage.
|
||||
- **AppImage:** `chmod +x Audiphi-<version>-x86_64.AppImage` and run it. libmpv is bundled in it.
|
||||
- **Windows (x64):** `Audiphi-<version>-Setup.exe` installs for your user only (no admin) with a Start menu entry
|
||||
and an uninstaller; `Audiphi-<version>-Windows-portable.zip` runs from any folder.
|
||||
|
||||
Audiphi needs `yt-dlp` and `ffmpeg` on the system (the packages pull them in) and, for YouTube, a JavaScript
|
||||
runtime (`deno` recommended). On Windows, put `yt-dlp.exe` and `ffmpeg.exe` on `PATH` or next to `audiphi.exe`.
|
||||
|
||||
## Build from source
|
||||
|
||||
You need Rust and `mpv` (libmpv) to build.
|
||||
|
||||
```bash
|
||||
sudo pacman -S yt-dlp ffmpeg mpv deno # Arch
|
||||
./install.sh # builds and installs to ~/.local
|
||||
tools/package.sh # release files in dist/ (Linux and Windows)
|
||||
```
|
||||
|
||||
`audiphi 'https://…'` fetches the link straight away.
|
||||
|
|
@ -42,4 +63,4 @@ pages; `examples/probe.rs` exercises the engine from the command line
|
|||
Setting `AUDIPHI_SHOTS=/dir` (and `AUDIPHI_SHOT_URL=<link>`) makes the app walk its tabs and save screenshots.
|
||||
|
||||
Built on yt-dlp, ffmpeg, mpv, lofty and egui. Tags from Deezer, iTunes and MusicBrainz; lyrics from LRCLIB.
|
||||
Bundled fonts: Material Symbols (Apache 2.0) and Rubik (SIL OFL 1.1), licenses in `assets/fonts/`.
|
||||
Licence: MIT (`LICENSE`). Bundled fonts: Material Symbols (Apache 2.0) and Rubik (SIL OFL 1.1), licenses in `assets/fonts/`.
|
||||
|
|
|
|||
32
build.rs
Normal file
32
build.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
windows_resource();
|
||||
}
|
||||
|
||||
/// Windows: embed the icon and version resource into audiphi.exe (needs mingw's windres; skipped without it).
|
||||
fn windows_resource() {
|
||||
println!("cargo:rerun-if-changed=packaging/audiphi.ico");
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
|
||||
return;
|
||||
}
|
||||
let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||
let ver = std::env::var("CARGO_PKG_VERSION").unwrap();
|
||||
let nums: Vec<&str> = ver.split('.').collect();
|
||||
let comma = format!("{},{},{},0", nums[0], nums.get(1).unwrap_or(&"0"), nums.get(2).unwrap_or(&"0"));
|
||||
let ico = std::fs::canonicalize("packaging/audiphi.ico").unwrap().to_string_lossy().replace('\\', "/");
|
||||
let rc = format!(
|
||||
"1 ICON \"{ico}\"\n\
|
||||
1 VERSIONINFO\nFILEVERSION {comma}\nPRODUCTVERSION {comma}\nBEGIN\n BLOCK \"StringFileInfo\"\n BEGIN\n BLOCK \"040904b0\"\n BEGIN\n\
|
||||
\x20 VALUE \"ProductName\", \"Audiphi\"\n VALUE \"FileDescription\", \"Audiphi music downloader and player\"\n VALUE \"FileVersion\", \"{ver}\"\n VALUE \"ProductVersion\", \"{ver}\"\n VALUE \"OriginalFilename\", \"audiphi.exe\"\n\
|
||||
\x20 END\n END\n BLOCK \"VarFileInfo\"\n BEGIN\n VALUE \"Translation\", 0x0409, 1200\n END\nEND\n"
|
||||
);
|
||||
let rc_path = out.join("audiphi.rc");
|
||||
std::fs::write(&rc_path, rc).unwrap();
|
||||
let obj = out.join("audiphi_res.o");
|
||||
let ok = std::process::Command::new("x86_64-w64-mingw32-windres").arg(&rc_path).arg(&obj).status().map(|s| s.success()).unwrap_or(false);
|
||||
if ok {
|
||||
println!("cargo:rustc-link-arg-bins={}", obj.display());
|
||||
} else {
|
||||
println!("cargo:warning=windres not available: audiphi.exe has no icon/version resource");
|
||||
}
|
||||
}
|
||||
15
docs/releases/0.2.1.md
Normal file
15
docs/releases/0.2.1.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Audiphi 0.2.1
|
||||
|
||||
First packaged release of the Rust Audiphi.
|
||||
|
||||
- **New icon colour:** the icon is honey yellow instead of purple, so it stands apart from the other apps in a dock.
|
||||
- **Packages:** Linux AppImage (libmpv bundled), tar.gz with an installer, Arch package `audiphi-bin`, Debian/Ubuntu
|
||||
`.deb`, a Nix flake, and for Windows a per-user installer (no admin) and a portable zip with libmpv.
|
||||
- Copy and paste work in text fields (clipboard support).
|
||||
- Settings show the installed yt-dlp version.
|
||||
- Faster mouse-wheel scrolling.
|
||||
- Playing a song queues the library as it is currently sorted and filtered.
|
||||
- Windows: yt-dlp and ffmpeg are found as `.exe` (on `PATH` or next to `audiphi.exe`), they no longer flash a
|
||||
console window, and "open folder" and links open in Explorer and the browser.
|
||||
|
||||
Needs `yt-dlp` and `ffmpeg` (the Linux packages pull them in); YouTube also needs a JavaScript runtime such as `deno`.
|
||||
10
flake.nix
Normal file
10
flake.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
description = "Material 3 music downloader and quick player for any music service";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
packages.x86_64-linux.default = pkgs.callPackage ./packaging/nix { };
|
||||
apps.x86_64-linux.default = { type = "app"; program = "${self.packages.x86_64-linux.default}/bin/audiphi"; };
|
||||
};
|
||||
}
|
||||
158
installer.sh
Executable file
158
installer.sh
Executable file
|
|
@ -0,0 +1,158 @@
|
|||
#!/bin/sh
|
||||
# Audiphi installer. Installs from a release tar.gz or AppImage, or removes an install.
|
||||
# installer.sh [--user|--system] [--prefix DIR] [--url URL] [FILE]
|
||||
# installer.sh --uninstall [--purge] [--user|--system] [--prefix DIR]
|
||||
# --user (default): ~/.local, no root. --system: /usr/local, sudo only for the copy.
|
||||
# Without FILE it uses the unpacked release folder it sits in, or Audiphi-*-Linux-x86_64.tar.gz or
|
||||
# Audiphi-*-x86_64.AppImage next to it. SHA256SUMS-<version> beside the file is checked when present.
|
||||
# --purge also deletes settings and data (~/.config/audiphi, ~/.cache/audiphi: settings, library index). DESTDIR=dir stages under dir (no sudo).
|
||||
# Needs glibc 2.35 or newer.
|
||||
set -eu
|
||||
|
||||
app=audiphi main=audiphi need=2.35
|
||||
mode=install scope=user purge=0 prefix= url= file=
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--user) scope=user ;;
|
||||
--system) scope=system ;;
|
||||
--prefix) [ $# -ge 2 ] || { echo "--prefix needs a folder." >&2; exit 2; }; prefix=$2; shift ;;
|
||||
--url) [ $# -ge 2 ] || { echo "--url needs an address." >&2; exit 2; }; url=$2; shift ;;
|
||||
--uninstall) mode=uninstall ;;
|
||||
--purge) purge=1 ;;
|
||||
-h|--help) sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
-*) echo "Unknown option: $1 (see --help)." >&2; exit 2 ;;
|
||||
*) file=$1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
[ "$purge" = 0 ] || [ "$mode" = uninstall ] || { echo "--purge only goes with --uninstall." >&2; exit 2; }
|
||||
if [ -z "$prefix" ]; then
|
||||
if [ "$scope" = system ]; then prefix=/usr/local; else prefix=$HOME/.local; fi
|
||||
fi
|
||||
case $prefix in /*) ;; *) echo "--prefix must be an absolute path." >&2; exit 2 ;; esac
|
||||
prefix=${prefix%/}
|
||||
destdir=${DESTDIR:-}
|
||||
root=$destdir$prefix
|
||||
list=$root/lib/$app/files
|
||||
sudo=
|
||||
if [ -z "$destdir" ] && [ "$(id -u)" != 0 ]; then
|
||||
d=$root; while [ ! -e "$d" ]; do d=$(dirname "$d"); done
|
||||
[ -w "$d" ] || sudo=sudo
|
||||
fi
|
||||
|
||||
refresh() {
|
||||
[ -z "$destdir" ] || return 0
|
||||
command -v update-desktop-database >/dev/null 2>&1 && $sudo update-desktop-database -q "$root/share/applications" 2>/dev/null || true
|
||||
[ -f "$root/share/icons/hicolor/index.theme" ] && command -v gtk-update-icon-cache >/dev/null 2>&1 \
|
||||
&& $sudo gtk-update-icon-cache -q -t -f "$root/share/icons/hicolor" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Removes the files the last install listed, then the folders that became empty.
|
||||
remove_listed() {
|
||||
[ -f "$list" ] || return 0
|
||||
while IFS= read -r f; do
|
||||
[ -n "$f" ] || continue
|
||||
$sudo rm -f "$root/$f"
|
||||
d=$(dirname "$f")
|
||||
while [ "$d" != . ] && $sudo rmdir "$root/$d" 2>/dev/null; do d=$(dirname "$d"); done
|
||||
done < "$list"
|
||||
$sudo rm -f "$list"
|
||||
$sudo rmdir "$root/lib/$app" "$root/lib" 2>/dev/null || true
|
||||
}
|
||||
|
||||
if [ "$mode" = uninstall ]; then
|
||||
if [ ! -f "$list" ]; then
|
||||
echo "Audiphi is not installed in $prefix (no $list)." >&2
|
||||
[ "$purge" = 1 ] || exit 1
|
||||
else
|
||||
remove_listed
|
||||
refresh
|
||||
echo "Audiphi removed from $prefix."
|
||||
fi
|
||||
if [ "$purge" = 1 ]; then
|
||||
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/audiphi"
|
||||
rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/audiphi"
|
||||
echo "Settings and data removed (~/.config/audiphi, ~/.cache/audiphi: settings, library index)."
|
||||
else
|
||||
echo "Settings and data are kept (--purge deletes them)."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# glibc check (AUDIPHI_GLIBC overrides the detected version, for tests)
|
||||
have=${AUDIPHI_GLIBC:-$(getconf GNU_LIBC_VERSION 2>/dev/null | sed 's/^glibc //')}
|
||||
if [ -z "$have" ]; then
|
||||
echo "Audiphi needs glibc $need or newer, and this system does not report a glibc (musl?). Nothing was installed." >&2; exit 1
|
||||
fi
|
||||
if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -n 1)" != "$need" ]; then
|
||||
echo "Audiphi needs glibc $need or newer, and this system has glibc $have. Nothing was installed." >&2; exit 1
|
||||
fi
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT INT TERM
|
||||
|
||||
if [ -n "$url" ]; then
|
||||
file=$tmp/$(basename "${url%%\?*}")
|
||||
if command -v curl >/dev/null 2>&1; then curl -fL -o "$file" -- "$url"
|
||||
elif command -v wget >/dev/null 2>&1; then wget -O "$file" -- "$url"
|
||||
else echo "Neither curl nor wget is installed, so $url cannot be fetched." >&2; exit 1; fi
|
||||
fi
|
||||
src=
|
||||
if [ -z "$file" ]; then
|
||||
if [ -f "$here/bin/$main" ]; then src=$here
|
||||
else
|
||||
for f in "$here"/Audiphi-*-Linux-x86_64.tar.gz "$here"/Audiphi-*-x86_64.AppImage; do
|
||||
[ -f "$f" ] && { file=$f; break; }
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ -z "$src" ]; then
|
||||
[ -n "$file" ] && [ -f "$file" ] || { echo "No Audiphi tar.gz or AppImage was given or found next to the installer." >&2; exit 1; }
|
||||
dir=$(dirname "$file"); name=$(basename "$file")
|
||||
for s in "$dir"/SHA256SUMS-*; do
|
||||
[ -f "$s" ] || continue
|
||||
line=$(grep -F " $name" "$s" | head -n 1 || true)
|
||||
[ -n "$line" ] || continue
|
||||
[ "${line%% *}" = "$(sha256sum "$file" | cut -d' ' -f1)" ] \
|
||||
|| { echo "The checksum of $name does not match $(basename "$s"). Nothing was installed." >&2; exit 1; }
|
||||
echo "Checksum ok."
|
||||
done
|
||||
mkdir "$tmp/x"
|
||||
case $name in
|
||||
*.tar.gz)
|
||||
tar -xzf "$file" -C "$tmp/x"
|
||||
src=$(find "$tmp/x" -maxdepth 1 -mindepth 1 -type d | head -n 1)
|
||||
[ -n "$src" ] && [ -f "$src/bin/$main" ] || { echo "$name has no bin/$main, so it is not a Audiphi release." >&2; exit 1; } ;;
|
||||
*.AppImage)
|
||||
cp "$file" "$tmp/app"; chmod 755 "$tmp/app"
|
||||
(cd "$tmp/x" && "$tmp/app" --appimage-extract >/dev/null 2>&1) || true
|
||||
[ -d "$tmp/x/squashfs-root/usr/share" ] || { echo "Could not read the contents of $name. Nothing was installed." >&2; exit 1; }
|
||||
src=$tmp/src; mkdir -p "$src/bin"
|
||||
mv "$tmp/app" "$src/bin/$main"
|
||||
mv "$tmp/x/squashfs-root/usr/share" "$src/share"
|
||||
[ ! -d "$tmp/x/squashfs-root/usr/lib" ] || mv "$tmp/x/squashfs-root/usr/lib" "$src/lib" ;;
|
||||
*) echo "Unknown file type: $name (need .tar.gz or .AppImage)." >&2; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Stage with launchers pointing at this prefix, then copy and list every file for --uninstall.
|
||||
st=$tmp/stage
|
||||
mkdir -p "$st"
|
||||
for d in bin lib share; do [ ! -d "$src/$d" ] || cp -R "$src/$d" "$st/$d"; done
|
||||
for d in "$st"/share/applications/*.desktop; do
|
||||
[ -f "$d" ] || continue
|
||||
for b in "$st"/bin/*; do
|
||||
b=$(basename "$b")
|
||||
sed -i -e "s#^Exec=$b\( \|\$\)#Exec=$prefix/bin/$b\1#" -e "s#^TryExec=$b\$#TryExec=$prefix/bin/$b#" "$d"
|
||||
done
|
||||
done
|
||||
chmod 755 "$st"/bin/*
|
||||
(cd "$st" && find . \( -type f -o -type l \) | sed 's|^\./||' | sort) > "$tmp/files"
|
||||
mkdir -p "$st/lib/$app"; echo "lib/$app/files" >> "$tmp/files"; cp "$tmp/files" "$st/lib/$app/files"
|
||||
|
||||
remove_listed
|
||||
$sudo mkdir -p "$root"
|
||||
$sudo cp -R "$st/." "$root/"
|
||||
refresh
|
||||
echo "Audiphi installed in $prefix/bin/$main"
|
||||
case ":$PATH:" in *":$prefix/bin:"*) ;; *) echo "Note: $prefix/bin is not on your PATH." ;; esac
|
||||
33
packaging/arch/.SRCINFO
Normal file
33
packaging/arch/.SRCINFO
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
pkgbase = audiphi-bin
|
||||
pkgdesc = Material 3 music downloader and quick player for any music service
|
||||
pkgver = 0.2.1
|
||||
pkgrel = 1
|
||||
url = https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi
|
||||
arch = x86_64
|
||||
license = MIT
|
||||
depends = glibc>=2.35
|
||||
depends = gcc-libs
|
||||
depends = mpv
|
||||
depends = yt-dlp
|
||||
depends = ffmpeg
|
||||
depends = fontconfig
|
||||
depends = libglvnd
|
||||
depends = wayland
|
||||
depends = libxkbcommon
|
||||
depends = libxkbcommon-x11
|
||||
depends = libx11
|
||||
depends = libxcb
|
||||
depends = libxcursor
|
||||
depends = libxi
|
||||
depends = libxrender
|
||||
depends = hicolor-icon-theme
|
||||
optdepends = deno: YouTube downloads (yt-dlp JavaScript challenges)
|
||||
optdepends = xdg-desktop-portal: open and save dialogs
|
||||
provides = audiphi
|
||||
conflicts = audiphi
|
||||
options = !strip
|
||||
options = !debug
|
||||
source = Audiphi-0.2.1-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi/releases/download/v0.2.1/Audiphi-0.2.1-Linux-x86_64.tar.gz
|
||||
sha256sums = 47092173f702e950ff6c3098911f7a931b6a372fe05b0f1d9785c1296b44e815
|
||||
|
||||
pkgname = audiphi-bin
|
||||
30
packaging/arch/PKGBUILD
Normal file
30
packaging/arch/PKGBUILD
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Maintainer: astar76
|
||||
# Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver,
|
||||
# sha256sums and the glibc floor current.
|
||||
pkgname=audiphi-bin
|
||||
pkgver=0.2.1
|
||||
pkgrel=1
|
||||
pkgdesc='Material 3 music downloader and quick player for any music service'
|
||||
arch=('x86_64')
|
||||
url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi'
|
||||
license=('MIT')
|
||||
depends=('glibc>=2.35' 'gcc-libs' 'mpv' 'yt-dlp' 'ffmpeg' 'fontconfig' 'libglvnd' 'wayland' 'libxkbcommon' 'libxkbcommon-x11' 'libx11' 'libxcb' 'libxcursor' 'libxi' 'libxrender' 'hicolor-icon-theme')
|
||||
optdepends=(
|
||||
'deno: YouTube downloads (yt-dlp JavaScript challenges)'
|
||||
'xdg-desktop-portal: open and save dialogs'
|
||||
)
|
||||
provides=('audiphi')
|
||||
conflicts=('audiphi')
|
||||
options=('!strip' '!debug')
|
||||
source=("Audiphi-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Audiphi-$pkgver-Linux-x86_64.tar.gz}")
|
||||
sha256sums=('47092173f702e950ff6c3098911f7a931b6a372fe05b0f1d9785c1296b44e815')
|
||||
|
||||
package() {
|
||||
cd "$srcdir/audiphi-$pkgver"
|
||||
install -d "$pkgdir/usr"
|
||||
for d in bin lib share; do [ ! -d "$d" ] || cp -R "$d" "$pkgdir/usr/"; done
|
||||
if [ -d "$pkgdir/usr/share/licenses/audiphi" ] && [ "$pkgname" != audiphi ]; then
|
||||
mv "$pkgdir/usr/share/licenses/audiphi" "$pkgdir/usr/share/licenses/$pkgname"
|
||||
fi
|
||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
}
|
||||
BIN
packaging/audiphi.ico
Normal file
BIN
packaging/audiphi.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 364 KiB |
51
packaging/audiphi.iss
Normal file
51
packaging/audiphi.iss
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
; Inno Setup script: per-user install (no admin), Start menu entry, uninstaller.
|
||||
; Built by tools/package.sh under wine: iscc /DVersion=<v> /DSrc=<folder with audiphi.exe> /DOut=<output folder> audiphi.iss
|
||||
#ifndef Version
|
||||
#define Version "0.0.0"
|
||||
#endif
|
||||
#ifndef Src
|
||||
#define Src "..\dist\Audiphi"
|
||||
#endif
|
||||
#ifndef Out
|
||||
#define Out "..\dist"
|
||||
#endif
|
||||
|
||||
[Setup]
|
||||
AppId={{CF109E85-B812-43ED-9575-73F404B7BABF}
|
||||
AppName=Audiphi
|
||||
AppVersion={#Version}
|
||||
AppVerName=Audiphi {#Version}
|
||||
AppPublisher=astar76
|
||||
AppPublisherURL=https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi
|
||||
VersionInfoVersion={#Version}
|
||||
VersionInfoProductName=Audiphi
|
||||
VersionInfoDescription=Audiphi Setup
|
||||
DefaultDirName={localappdata}\Programs\Audiphi
|
||||
DisableProgramGroupPage=yes
|
||||
DisableDirPage=auto
|
||||
PrivilegesRequired=lowest
|
||||
ArchitecturesAllowed=x64compatible
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
OutputDir={#Out}
|
||||
OutputBaseFilename=Audiphi-{#Version}-Setup
|
||||
SetupIconFile=audiphi.ico
|
||||
UninstallDisplayIcon={app}\audiphi.exe
|
||||
UninstallDisplayName=Audiphi
|
||||
LicenseFile=..\LICENSE
|
||||
Compression=lzma2/max
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
CloseApplications=yes
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "Create a desktop shortcut"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "{#Src}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
[Icons]
|
||||
Name: "{userprograms}\Audiphi"; Filename: "{app}\audiphi.exe"
|
||||
Name: "{userdesktop}\Audiphi"; Filename: "{app}\audiphi.exe"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\audiphi.exe"; Description: "Launch Audiphi"; Flags: nowait postinstall skipifsilent
|
||||
33
packaging/nix/default.nix
Normal file
33
packaging/nix/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Audiphi for Nix, from the release tar.gz. Written by tools/package.sh (version and hash); edit the header there.
|
||||
# nix build .#default or nix profile install . (from the repo), or callPackage this file.
|
||||
{ lib, stdenv, fetchurl, autoPatchelfHook, makeWrapper, libGL, wayland, libxkbcommon, xorg, fontconfig, dbus, mpv-unwrapped, yt-dlp, ffmpeg }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "audiphi";
|
||||
version = "0.2.1";
|
||||
src = fetchurl {
|
||||
url = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi/releases/download/v${version}/Audiphi-${version}-Linux-x86_64.tar.gz";
|
||||
hash = "sha256-Rwkhc/cC6VD/bDCYkR96kxtqNy/gWw8dl4XBKWtE6BU=";
|
||||
};
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
||||
buildInputs = [ mpv-unwrapped stdenv.cc.cc.lib ];
|
||||
# Loaded with dlopen at run time, so autoPatchelf can't see them.
|
||||
runtimeDependencies = [ libGL wayland libxkbcommon xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr fontconfig dbus ];
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
for d in bin lib share; do [ ! -d $d ] || cp -R $d $out/; done
|
||||
install -Dm644 README.md $out/share/doc/audiphi/README.md
|
||||
runHook postInstall
|
||||
'';
|
||||
postFixup = "wrapProgram $out/bin/audiphi --prefix PATH : ${lib.makeBinPath [ yt-dlp ffmpeg ]}";
|
||||
meta = {
|
||||
description = "Material 3 music downloader and quick player for any music service";
|
||||
homepage = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Audiphi";
|
||||
license = lib.licenses.mit;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "audiphi";
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
|
|
@ -523,10 +523,10 @@ impl App {
|
|||
fn draw_banners(&mut self, ui: &mut egui::Ui) {
|
||||
let mut msgs = vec![];
|
||||
if !self.ffmpeg_ok {
|
||||
msgs.push("ffmpeg wasn't found. Downloads need it to convert audio — install it (e.g. “sudo pacman -S ffmpeg”) or set its location in Settings.");
|
||||
msgs.push(if cfg!(windows) { "ffmpeg wasn't found. Downloads need it to convert audio — put ffmpeg.exe next to audiphi.exe or on PATH, or set its location in Settings." } else { "ffmpeg wasn't found. Downloads need it to convert audio — install it (e.g. “sudo pacman -S ffmpeg”) or set its location in Settings." });
|
||||
}
|
||||
if !self.ytdlp_ok {
|
||||
msgs.push("yt-dlp wasn't found. Install it (e.g. “sudo pacman -S yt-dlp”) so Audiphi can download.");
|
||||
msgs.push(if cfg!(windows) { "yt-dlp wasn't found. Put yt-dlp.exe next to audiphi.exe or on PATH so Audiphi can download." } else { "yt-dlp wasn't found. Install it (e.g. “sudo pacman -S yt-dlp”) so Audiphi can download." });
|
||||
}
|
||||
for m in msgs {
|
||||
let t = self.g.theme.clone();
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ fn encode(ctx: &Ctx, src: &Path, duration: Option<f64>, o: &DownloadOptions, tmp
|
|||
ctx.update(Some(JobState::Converting), Some(&base), true);
|
||||
let ext = format_ext(&o.format).unwrap_or("mp3");
|
||||
let dst = tmp_dir.join(format!("{uid}.out.{ext}"));
|
||||
let mut cmd = Command::new(ffmpeg);
|
||||
let mut cmd = crate::core::paths::command(ffmpeg);
|
||||
cmd.args(["-hide_banner", "-nostdin", "-y", "-loglevel", "error", "-progress", "pipe:1", "-i"]).arg(src).args(encode_args(o)).arg(&dst).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
let mut child = cmd.spawn().map_err(|e| format!("couldn't start ffmpeg: {e}"))?;
|
||||
let stdout = child.stdout.take().unwrap();
|
||||
|
|
|
|||
|
|
@ -19,16 +19,21 @@ pub fn music_dir() -> PathBuf {
|
|||
dirs::audio_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default().join("Music"))
|
||||
}
|
||||
|
||||
/// `name` as a program file name here: `yt-dlp` on Linux, `yt-dlp.exe` on Windows.
|
||||
fn exe(name: &str) -> String {
|
||||
format!("{name}{}", std::env::consts::EXE_SUFFIX)
|
||||
}
|
||||
|
||||
pub fn which(name: &str) -> Option<PathBuf> {
|
||||
let path = std::env::var_os("PATH")?;
|
||||
std::env::split_paths(&path).map(|d| d.join(name)).find(|p| p.is_file())
|
||||
std::env::split_paths(&path).map(|d| d.join(exe(name))).find(|p| p.is_file())
|
||||
}
|
||||
|
||||
pub fn find_ffmpeg(configured: &str) -> Option<String> {
|
||||
if !configured.is_empty() {
|
||||
let mut p = PathBuf::from(shellexpand(configured));
|
||||
if p.is_dir() {
|
||||
p = p.join("ffmpeg");
|
||||
p = p.join(exe("ffmpeg"));
|
||||
}
|
||||
if p.is_file() {
|
||||
return Some(p.to_string_lossy().into_owned());
|
||||
|
|
@ -37,13 +42,13 @@ pub fn find_ffmpeg(configured: &str) -> Option<String> {
|
|||
if let Some(p) = which("ffmpeg") {
|
||||
return Some(p.to_string_lossy().into_owned());
|
||||
}
|
||||
let local = std::env::current_exe().ok()?.parent()?.join("ffmpeg");
|
||||
let local = std::env::current_exe().ok()?.parent()?.join(exe("ffmpeg"));
|
||||
local.is_file().then(|| local.to_string_lossy().into_owned())
|
||||
}
|
||||
|
||||
pub fn find_ytdlp() -> Option<String> {
|
||||
if let Ok(exe) = std::env::current_exe() {
|
||||
if let Some(p) = exe.parent().map(|d| d.join("yt-dlp")).filter(|p| p.is_file()) {
|
||||
if let Ok(me) = std::env::current_exe() {
|
||||
if let Some(p) = me.parent().map(|d| d.join(exe("yt-dlp"))).filter(|p| p.is_file()) {
|
||||
return Some(p.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
|
|
@ -75,3 +80,22 @@ pub const AUDIO_EXTENSIONS: &[&str] = &["mp3", "m4a", "flac", "opus", "ogg", "og
|
|||
pub fn is_audio(p: &Path) -> bool {
|
||||
p.extension().map(|e| AUDIO_EXTENSIONS.contains(&e.to_string_lossy().to_lowercase().as_str())).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Opens a folder, file or web address with the desktop's default handler (Explorer on Windows).
|
||||
pub fn open(target: impl AsRef<std::ffi::OsStr>) {
|
||||
let opener = if cfg!(windows) { "explorer" } else { "xdg-open" };
|
||||
let _ = std::process::Command::new(opener).arg(target).spawn();
|
||||
}
|
||||
|
||||
/// A command for a console tool (yt-dlp, ffmpeg) that opens no console window on Windows.
|
||||
pub fn command(program: impl AsRef<std::ffi::OsStr>) -> std::process::Command {
|
||||
#[allow(unused_mut)]
|
||||
let mut cmd = std::process::Command::new(program);
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
cmd.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub fn binary() -> Res<String> {
|
||||
paths::find_ytdlp().ok_or_else(|| "yt-dlp wasn't found. Install it (e.g. “sudo pacman -S yt-dlp”) and make sure it is on your PATH.".to_string())
|
||||
paths::find_ytdlp().ok_or_else(|| if cfg!(windows) { "yt-dlp wasn't found. Put yt-dlp.exe next to audiphi.exe or on PATH." } else { "yt-dlp wasn't found. Install it (e.g. “sudo pacman -S yt-dlp”) and make sure it is on your PATH." }.to_string())
|
||||
}
|
||||
|
||||
pub fn version() -> Option<String> {
|
||||
let out = Command::new(paths::find_ytdlp()?).arg("--version").output().ok()?;
|
||||
let out = paths::command(paths::find_ytdlp()?).arg("--version").output().ok()?;
|
||||
Some(String::from_utf8_lossy(&out.stdout).trim().to_string())
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ pub struct Outcome {
|
|||
|
||||
/// Run yt-dlp, feeding each stdout line to `on_line` and stderr to the log.
|
||||
pub fn run(args: &[String], cancel: Option<&Arc<AtomicBool>>, log: Log, mut on_line: impl FnMut(&str)) -> Res<Outcome> {
|
||||
let mut cmd = Command::new(binary()?);
|
||||
let mut cmd = paths::command(binary()?);
|
||||
cmd.args(args).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
|
||||
let mut child = cmd.spawn().map_err(|e| format!("couldn't start yt-dlp: {e}"))?;
|
||||
let stdout = child.stdout.take().unwrap();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]
|
||||
use audiphi::app::App;
|
||||
use eframe::egui;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl Spectrum {
|
|||
let (path, ctx) = (path.to_string(), ctx.clone());
|
||||
std::thread::spawn(move || {
|
||||
let ffmpeg = crate::core::paths::find_ffmpeg("").unwrap_or_else(|| "ffmpeg".into());
|
||||
let Ok(mut child) = Command::new(ffmpeg).args(["-v", "error", "-nostdin", "-i", &path, "-vn", "-ac", "1", "-ar", &SR.to_string(), "-f", "f32le", "-"]).stdout(Stdio::piped()).stderr(Stdio::null()).spawn() else { return };
|
||||
let Ok(mut child) = crate::core::paths::command(ffmpeg).args(["-v", "error", "-nostdin", "-i", &path, "-vn", "-ac", "1", "-ar", &SR.to_string(), "-f", "f32le", "-"]).stdout(Stdio::piped()).stderr(Stdio::null()).spawn() else { return };
|
||||
let mut out = child.stdout.take().unwrap();
|
||||
let mut buf = vec![0u8; 1 << 16];
|
||||
let mut carry: Vec<u8> = vec![];
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue