Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dafa40cca8 | ||
|
|
365a28ce67 | ||
|
|
4b1f0bb8a0 | ||
|
|
c496275101 | ||
|
|
118fa3cf11 | ||
|
|
ec64cf7f4b | ||
|
|
093c41435a | ||
|
|
f80de805c2 |
No files matched your search
@@ -1,3 +1,7 @@
|
||||
/target
|
||||
.DS_Store
|
||||
/design/shots
|
||||
/packaging/arch/src
|
||||
/packaging/arch/pkg
|
||||
/packaging/arch/musyx
|
||||
/packaging/arch/*.pkg.tar.*
|
||||
Generated
+43
-2
@@ -2992,7 +2992,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "musyx"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"directories",
|
||||
@@ -3011,6 +3011,7 @@ dependencies = [
|
||||
"souvlaki",
|
||||
"sys-locale",
|
||||
"tokio",
|
||||
"winresource",
|
||||
"ym-api",
|
||||
]
|
||||
|
||||
@@ -4700,6 +4701,15 @@ dependencies = [
|
||||
"syn 3.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
@@ -5361,6 +5371,21 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "1.1.8+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "1.1.2+spec-1.1.0"
|
||||
@@ -5391,6 +5416,12 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.1.3+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.5.3"
|
||||
@@ -6505,6 +6536,16 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winresource"
|
||||
version = "0.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bc6d36480b829272a5bdabf08e6dca8004761c1da7e35efef800540c66221b"
|
||||
dependencies = [
|
||||
"toml",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.57.1"
|
||||
@@ -6629,7 +6670,7 @@ checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
|
||||
|
||||
[[package]]
|
||||
name = "ym-api"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "3"
|
||||
members = ["crates/ym-api", "crates/musyx"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
publish = false
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Yuriy Panov
|
||||
|
||||
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.
|
||||
@@ -42,11 +42,34 @@ This builds a release `Musyx.app` into `target/release/bundle/`, signed with the
|
||||
`MUSYX_SIGN_IDENTITY` to sign with another identity, or to `-` for an ad-hoc signature
|
||||
(each ad-hoc build is a new code identity, so macOS asks again for keychain access).
|
||||
|
||||
## Install on Linux
|
||||
|
||||
```sh
|
||||
tool/bundle-linux.sh # tarball, .deb and AppImage into target/release/bundle/
|
||||
tool/bundle-linux.sh tar deb # only the formats named
|
||||
tool/bundle-linux.sh --install # install into ~/.local (PREFIX picks another prefix)
|
||||
```
|
||||
|
||||
On Arch, `makepkg -si` in `packaging/arch` builds and installs the committed `HEAD`.
|
||||
|
||||
Building needs `pkg-config` and the ALSA and D-Bus development files (`alsa-lib` and `dbus`
|
||||
on Arch, `libasound2-dev` and `libdbus-1-dev` on Debian/Ubuntu). The AppImage also needs
|
||||
[`appimagetool`](https://github.com/AppImage/appimagetool/releases) on `PATH` (or
|
||||
`APPIMAGETOOL`). A binary runs only on a glibc at least as new as the one it was built
|
||||
against, so build release packages on the oldest distro you want to support.
|
||||
|
||||
The desktop entry, metainfo and icons are installed as `it.panov.musyx.desktop`, which is also the
|
||||
window's Wayland app id. The token goes to the Secret Service (GNOME Keyring, KWallet,
|
||||
KeePassXC), and media keys and the desktop's player widget work through MPRIS. The menu bar
|
||||
mini player is macOS-only.
|
||||
|
||||
## Settings
|
||||
|
||||
Settings (streaming quality, appearance, language, volume) are kept in
|
||||
`~/Library/Application Support/Musyx/settings.json`. Covers are cached under
|
||||
`~/Library/Caches/Musyx/covers` and can be cleared from Settings.
|
||||
`~/Library/Application Support/Musyx/settings.json` on macOS and
|
||||
`~/.config/musyx/settings.json` on Linux. Covers are cached under
|
||||
`~/Library/Caches/Musyx/covers` (`~/.cache/musyx/covers` on Linux) and can be cleared from
|
||||
Settings.
|
||||
|
||||
Streaming quality **Lossless** asks Yandex for FLAC (through the signed `/get-file-info`
|
||||
endpoint, decrypting its AES-CTR stream in memory). Yandex decides what to grant by
|
||||
|
||||
@@ -27,6 +27,9 @@ objc2-foundation = "0.3.2"
|
||||
objc2-app-kit = "0.3.2"
|
||||
block2 = "0.6.2"
|
||||
|
||||
[build-dependencies]
|
||||
winresource = "0.1.34"
|
||||
|
||||
[dev-dependencies]
|
||||
iced_test = "0.14"
|
||||
tokio = { version = "1", features = ["macros", "rt"] }
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,12 @@
|
||||
fn main() {
|
||||
// Embed the icon and version info into the Windows executable, so Explorer and the taskbar show them.
|
||||
println!("cargo:rerun-if-changed=assets/icon/musyx.ico");
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
|
||||
let mut res = winresource::WindowsResource::new();
|
||||
res.set_icon("assets/icon/musyx.ico")
|
||||
.set("ProductName", "Musyx")
|
||||
.set("FileDescription", "Musyx")
|
||||
.set("OriginalFilename", "Musyx.exe");
|
||||
res.compile().expect("failed to embed Windows resources");
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,9 @@ pub enum Message {
|
||||
ClearCoverCache,
|
||||
CoverCacheCleared(Result<(), String>),
|
||||
Media(crate::media::Command),
|
||||
/// A window opened; Windows media controls need its handle.
|
||||
WindowOpened(iced::window::Id),
|
||||
MediaWindow(u64),
|
||||
LoadLikedIds,
|
||||
LikedIdsLoaded(Result<LikedIds, Error>),
|
||||
LikeTrack(Track, bool),
|
||||
@@ -264,6 +267,9 @@ impl App {
|
||||
let audio = player::engine::subscription().map(|e| Message::Player(player::Msg::Engine(e)));
|
||||
let keys = crate::media::subscription().map(Message::Media);
|
||||
let mut subs = vec![appearance, audio, keys];
|
||||
if cfg!(windows) {
|
||||
subs.push(iced::window::open_events().map(Message::WindowOpened));
|
||||
}
|
||||
if let Session::SignedOut(sign_in) = &self.session {
|
||||
subs.push(sign_in.subscription().map(Message::SignIn));
|
||||
}
|
||||
@@ -521,6 +527,11 @@ impl App {
|
||||
self.toast(trf("“{}” plays next", &[&track.full_title()]));
|
||||
return self.update(Message::Player(player::Msg::PlayNext(track)));
|
||||
}
|
||||
Message::WindowOpened(id) => return iced::window::raw_id::<Message>(id).map(Message::MediaWindow),
|
||||
Message::MediaWindow(raw_id) => {
|
||||
self.media.attach_window(raw_id);
|
||||
self.media.update(self.player.track(), self.player.status(), self.player.position(), true);
|
||||
}
|
||||
Message::Media(command) => {
|
||||
use crate::media::Command as C;
|
||||
let status = self.player.status();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// No console window behind the app in Windows release builds.
|
||||
#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]
|
||||
|
||||
mod app;
|
||||
mod covers;
|
||||
mod i18n;
|
||||
@@ -18,6 +21,10 @@ use iced::{Size, window};
|
||||
use app::App;
|
||||
use ui::theme;
|
||||
|
||||
/// The Linux application id: the window's Wayland app id / X11 class and the `.desktop` name.
|
||||
#[cfg(target_os = "linux")]
|
||||
const APP_ID: &str = "it.panov.musyx.desktop";
|
||||
|
||||
fn main() -> iced::Result {
|
||||
let app = iced::application(App::new, App::update, App::view)
|
||||
.title(App::title)
|
||||
@@ -28,6 +35,12 @@ fn main() -> iced::Result {
|
||||
size: Size::new(1280.0, 800.0),
|
||||
min_size: Some(Size::new(960.0, 620.0)),
|
||||
icon: window::icon::from_file_data(include_bytes!("../assets/icon/musyx.png"), None).ok(),
|
||||
// Matches the installed `it.panov.musyx.desktop.desktop`, so the shell shows its name and icon.
|
||||
#[cfg(target_os = "linux")]
|
||||
platform_specific: window::settings::PlatformSpecific {
|
||||
application_id: APP_ID.to_owned(),
|
||||
..Default::default()
|
||||
},
|
||||
..window::Settings::default()
|
||||
})
|
||||
.centered();
|
||||
|
||||
+22
-14
@@ -71,21 +71,16 @@ impl Media {
|
||||
{
|
||||
*inbox = Some(rx);
|
||||
}
|
||||
let controls = MediaControls::new(PlatformConfig { display_name: "Musyx", dbus_name: "musyx", hwnd: None })
|
||||
.and_then(|mut c| {
|
||||
c.attach(|event| {
|
||||
if let Some(command) = Command::from_event(event) {
|
||||
send(command);
|
||||
}
|
||||
})?;
|
||||
Ok(c)
|
||||
});
|
||||
match controls {
|
||||
Ok(c) => Self { controls: Some(c), shown: None },
|
||||
Err(e) => {
|
||||
eprintln!("media controls unavailable: {e:?}");
|
||||
Self { controls: None, shown: None }
|
||||
// Windows ties the controls to a window, so they wait for `attach_window`.
|
||||
let controls = if cfg!(windows) { None } else { connect(None) };
|
||||
Self { controls, shown: None }
|
||||
}
|
||||
|
||||
/// Connects the controls to the main window (Windows needs its HWND, from `window::raw_id`).
|
||||
pub fn attach_window(&mut self, raw_id: u64) {
|
||||
if cfg!(windows) && self.controls.is_none() {
|
||||
self.controls = connect(Some(raw_id as *mut std::ffi::c_void));
|
||||
self.shown = None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +120,19 @@ impl Media {
|
||||
}
|
||||
}
|
||||
|
||||
fn connect(hwnd: Option<*mut std::ffi::c_void>) -> Option<MediaControls> {
|
||||
let controls = MediaControls::new(PlatformConfig { display_name: "Musyx", dbus_name: "musyx", hwnd })
|
||||
.and_then(|mut c| {
|
||||
c.attach(|event| {
|
||||
if let Some(command) = Command::from_event(event) {
|
||||
send(command);
|
||||
}
|
||||
})?;
|
||||
Ok(c)
|
||||
});
|
||||
controls.map_err(|e| eprintln!("media controls unavailable: {e:?}")).ok()
|
||||
}
|
||||
|
||||
pub fn subscription() -> Subscription<Command> {
|
||||
Subscription::run(commands)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ impl NowPlaying {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", test))]
|
||||
fn line(&self) -> String {
|
||||
if self.artist.is_empty() { self.title.clone() } else { format!("{} — {}", self.title, self.artist) }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# Maintainer: Yuriy Panov <uriy.panov@gmail.com>
|
||||
# Builds the checked-out commit of this repository: run `makepkg -si` in this directory.
|
||||
pkgname=musyx
|
||||
pkgver=0.2.1
|
||||
pkgrel=1
|
||||
pkgdesc='Desktop player for Yandex Music (unofficial)'
|
||||
arch=('x86_64' 'aarch64')
|
||||
license=('MIT' 'OFL-1.1' 'ISC')
|
||||
depends=('alsa-lib' 'dbus' 'gcc-libs' 'glibc' 'libxkbcommon' 'wayland' 'hicolor-icon-theme')
|
||||
optdepends=('gnome-keyring: keeps the sign-in (any Secret Service provider works)'
|
||||
'vulkan-driver: GPU rendering')
|
||||
makedepends=('cargo' 'git' 'imagemagick')
|
||||
options=('!lto' '!debug')
|
||||
source=("$pkgname::git+file://${startdir%/packaging/arch}")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
app_id=it.panov.musyx.desktop
|
||||
|
||||
pkgver() {
|
||||
cd "$pkgname"
|
||||
sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "$pkgname"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname"
|
||||
export RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target
|
||||
cargo build --frozen --release -p musyx
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$pkgname"
|
||||
export RUSTUP_TOOLCHAIN=stable CARGO_TARGET_DIR=target
|
||||
cargo test --frozen --release --workspace
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname"
|
||||
install -Dm755 target/release/musyx "$pkgdir/usr/bin/musyx"
|
||||
install -Dm644 "packaging/linux/$app_id.desktop" "$pkgdir/usr/share/applications/$app_id.desktop"
|
||||
install -Dm644 "packaging/linux/$app_id.metainfo.xml" "$pkgdir/usr/share/metainfo/$app_id.metainfo.xml"
|
||||
for size in 16 32 48 64 128 256 512; do
|
||||
install -dm755 "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps"
|
||||
magick crates/musyx/assets/icon/musyx.png -resize "${size}x${size}" \
|
||||
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/$app_id.png"
|
||||
done
|
||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -Dm644 crates/musyx/assets/fonts/OFL-*.txt -t "$pkgdir/usr/share/licenses/$pkgname"
|
||||
install -Dm644 crates/musyx/assets/icons/LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE-lucide.txt"
|
||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Musyx
|
||||
GenericName=Music Player
|
||||
GenericName[ru]=Музыкальный проигрыватель
|
||||
Comment=Desktop player for Yandex Music
|
||||
Comment[ru]=Настольный проигрыватель для Яндекс Музыки
|
||||
Exec=musyx
|
||||
Icon=it.panov.musyx.desktop
|
||||
Terminal=false
|
||||
Categories=AudioVideo;Audio;Player;
|
||||
Keywords=music;yandex;player;audio;
|
||||
Keywords[ru]=музыка;яндекс;плеер;аудио;
|
||||
StartupWMClass=it.panov.musyx.desktop
|
||||
SingleMainWindow=true
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>it.panov.musyx.desktop</id>
|
||||
<name>Musyx</name>
|
||||
<summary>Desktop player for Yandex Music</summary>
|
||||
<summary xml:lang="ru">Настольный проигрыватель для Яндекс Музыки</summary>
|
||||
<metadata_license>MIT</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
<developer id="it.panov">
|
||||
<name>Yuriy Panov</name>
|
||||
</developer>
|
||||
<description>
|
||||
<p>
|
||||
An unofficial client for Yandex Music: My Wave, search, your collection, podcasts,
|
||||
lyrics and lossless streaming. Not affiliated with or endorsed by Yandex.
|
||||
</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">it.panov.musyx.desktop.desktop</launchable>
|
||||
<categories>
|
||||
<category>AudioVideo</category>
|
||||
<category>Audio</category>
|
||||
<category>Player</category>
|
||||
</categories>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="0.2.1" date="2026-10-18"/>
|
||||
<release version="0.2.0" date="2026-10-16"/>
|
||||
</releases>
|
||||
</component>
|
||||
Executable
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds Linux release packages into target/release/bundle/.
|
||||
# tool/bundle-linux.sh # tarball, .deb and AppImage
|
||||
# tool/bundle-linux.sh tar deb # only the formats named (tar, deb, appimage)
|
||||
# tool/bundle-linux.sh --install # build, then install into ~/.local
|
||||
# The Arch package lives in packaging/arch (makepkg there).
|
||||
# The AppImage needs appimagetool on PATH, or APPIMAGETOOL pointing at it.
|
||||
# Binaries need the glibc they were built against or newer, so build releases on the
|
||||
# oldest distro you want to support (Ubuntu 22.04 covers most desktops).
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$root"
|
||||
|
||||
formats=()
|
||||
install=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
tar | deb | appimage) formats+=("$arg") ;;
|
||||
--install) install=1 ;;
|
||||
*) echo "unknown argument: $arg" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
if [[ ${#formats[@]} -eq 0 && $install -eq 0 ]]; then
|
||||
formats=(tar deb appimage)
|
||||
fi
|
||||
|
||||
app_id="it.panov.musyx.desktop"
|
||||
version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
|
||||
arch="$(uname -m)"
|
||||
case "$arch" in
|
||||
x86_64) deb_arch=amd64 ;;
|
||||
aarch64) deb_arch=arm64 ;;
|
||||
*) deb_arch="$arch" ;;
|
||||
esac
|
||||
out="target/release/bundle"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
cargo build --release -p musyx
|
||||
|
||||
# The installed layout, rooted at $1 (a prefix such as /usr): binary, desktop entry,
|
||||
# AppStream metadata, hicolor icons and licences.
|
||||
stage() {
|
||||
local dest="$1"
|
||||
install -Dm755 target/release/musyx "$dest/bin/musyx"
|
||||
install -Dm644 "packaging/linux/$app_id.desktop" "$dest/share/applications/$app_id.desktop"
|
||||
install -Dm644 "packaging/linux/$app_id.metainfo.xml" "$dest/share/metainfo/$app_id.metainfo.xml"
|
||||
for size in 16 32 48 64 128 256 512; do
|
||||
mkdir -p "$dest/share/icons/hicolor/${size}x${size}/apps"
|
||||
magick crates/musyx/assets/icon/musyx.png -resize "${size}x${size}" \
|
||||
"$dest/share/icons/hicolor/${size}x${size}/apps/$app_id.png"
|
||||
done
|
||||
local doc="$dest/share/doc/musyx"
|
||||
install -Dm644 LICENSE "$doc/LICENSE"
|
||||
install -Dm644 README.md "$doc/README.md"
|
||||
install -Dm644 crates/musyx/assets/fonts/OFL-*.txt -t "$doc"
|
||||
install -Dm644 crates/musyx/assets/icons/LICENSE.txt "$doc/LICENSE-lucide.txt"
|
||||
}
|
||||
|
||||
mkdir -p "$out"
|
||||
|
||||
if [[ $install -eq 1 ]]; then
|
||||
prefix="${PREFIX:-$HOME/.local}"
|
||||
stage "$prefix"
|
||||
update-desktop-database "$prefix/share/applications" 2>/dev/null || true
|
||||
gtk-update-icon-cache -q -t "$prefix/share/icons/hicolor" 2>/dev/null || true
|
||||
echo "Installed musyx $version into $prefix"
|
||||
fi
|
||||
|
||||
for format in "${formats[@]}"; do
|
||||
case "$format" in
|
||||
tar)
|
||||
# Unpack anywhere and run ./install.sh (to ~/.local, or PREFIX=/usr/local with sudo).
|
||||
name="musyx-$version-linux-$arch"
|
||||
dir="$work/$name"
|
||||
stage "$dir/files"
|
||||
cat > "$dir/install.sh" <<'SH'
|
||||
#!/bin/sh
|
||||
# Installs Musyx into $PREFIX (default ~/.local). Run with PREFIX=/usr/local as root for all users.
|
||||
set -eu
|
||||
prefix="${PREFIX:-$HOME/.local}"
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
mkdir -p "$prefix"
|
||||
cp -R "$here/files/." "$prefix/"
|
||||
update-desktop-database "$prefix/share/applications" 2>/dev/null || true
|
||||
gtk-update-icon-cache -q -t "$prefix/share/icons/hicolor" 2>/dev/null || true
|
||||
echo "Installed Musyx into $prefix"
|
||||
SH
|
||||
chmod 755 "$dir/install.sh"
|
||||
tar -C "$work" -czf "$out/$name.tar.gz" "$name"
|
||||
echo "Built $out/$name.tar.gz"
|
||||
;;
|
||||
|
||||
deb)
|
||||
# Assembled by hand (ar + tar), so dpkg-deb isn't needed on the build machine.
|
||||
pkg="$work/deb"
|
||||
stage "$pkg/usr"
|
||||
installed_kb="$(du -sk "$pkg/usr" | cut -f1)"
|
||||
mkdir -p "$pkg/DEBIAN"
|
||||
cat > "$pkg/DEBIAN/control" <<CONTROL
|
||||
Package: musyx
|
||||
Version: $version
|
||||
Architecture: $deb_arch
|
||||
Maintainer: Yuriy Panov <uriy.panov@gmail.com>
|
||||
Installed-Size: $installed_kb
|
||||
Depends: libc6, libgcc-s1, libasound2t64 | libasound2, libdbus-1-3, libxkbcommon0, libwayland-client0 | libx11-6
|
||||
Recommends: gnome-keyring | kwalletmanager, libvulkan1 | libgl1
|
||||
Section: sound
|
||||
Priority: optional
|
||||
Description: Desktop player for Yandex Music
|
||||
An unofficial client for Yandex Music: My Wave, search, your collection,
|
||||
podcasts, lyrics and lossless streaming. Not affiliated with Yandex.
|
||||
CONTROL
|
||||
(cd "$pkg" && find usr -type f -exec md5sum {} + > DEBIAN/md5sums)
|
||||
echo "2.0" > "$work/debian-binary"
|
||||
tar -C "$pkg/DEBIAN" --owner=0 --group=0 -cJf "$work/control.tar.xz" .
|
||||
tar -C "$pkg" --owner=0 --group=0 --exclude=./DEBIAN -cJf "$work/data.tar.xz" .
|
||||
deb="$out/musyx_${version}_${deb_arch}.deb"
|
||||
rm -f "$deb"
|
||||
(cd "$work" && ar rc "$root/$deb" debian-binary control.tar.xz data.tar.xz)
|
||||
echo "Built $deb"
|
||||
;;
|
||||
|
||||
appimage)
|
||||
tool="${APPIMAGETOOL:-$(command -v appimagetool || true)}"
|
||||
if [[ -z "$tool" ]]; then
|
||||
echo "appimagetool not found: put it on PATH or set APPIMAGETOOL" >&2
|
||||
echo " (https://github.com/AppImage/appimagetool/releases)" >&2
|
||||
exit 1
|
||||
fi
|
||||
appdir="$work/Musyx.AppDir"
|
||||
stage "$appdir/usr"
|
||||
ln -s usr/bin/musyx "$appdir/AppRun"
|
||||
cp "packaging/linux/$app_id.desktop" "$appdir/$app_id.desktop"
|
||||
cp "$appdir/usr/share/icons/hicolor/256x256/apps/$app_id.png" "$appdir/$app_id.png"
|
||||
ln -s "$app_id.png" "$appdir/.DirIcon"
|
||||
image="$out/Musyx-$version-$arch.AppImage"
|
||||
ARCH="$arch" "$tool" --no-appstream "$appdir" "$image" >/dev/null
|
||||
echo "Built $image"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -36,7 +36,7 @@ cat > "$bundle/Contents/Info.plist" <<PLIST
|
||||
<dict>
|
||||
<key>CFBundleName</key><string>Musyx</string>
|
||||
<key>CFBundleDisplayName</key><string>Musyx</string>
|
||||
<key>CFBundleIdentifier</key><string>dev.musyx.desktop</string>
|
||||
<key>CFBundleIdentifier</key><string>it.panov.musyx.desktop</string>
|
||||
<key>CFBundleDevelopmentRegion</key><string>en</string>
|
||||
<key>CFBundleLocalizations</key><array><string>en</string><string>ru</string></array>
|
||||
<key>CFBundleExecutable</key><string>Musyx</string>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Packs the app icon PNG into a multi-size Windows .ico (PNG-compressed entries).
|
||||
# Usage: powershell -File tool/make_ico.ps1 crates/musyx/assets/icon/musyx.png crates/musyx/assets/icon/musyx.ico
|
||||
param([string]$Src, [string]$Dst)
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$sizes = 16, 20, 24, 32, 40, 48, 64, 128, 256
|
||||
$source = [System.Drawing.Image]::FromFile((Resolve-Path $Src))
|
||||
$images = foreach ($s in $sizes) {
|
||||
$bmp = New-Object System.Drawing.Bitmap $s, $s, ([System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
||||
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$g.DrawImage($source, 0, 0, $s, $s)
|
||||
$g.Dispose()
|
||||
$ms = New-Object System.IO.MemoryStream
|
||||
$bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$bmp.Dispose()
|
||||
, $ms.ToArray()
|
||||
}
|
||||
$source.Dispose()
|
||||
|
||||
$out = New-Object System.IO.MemoryStream
|
||||
$w = New-Object System.IO.BinaryWriter $out
|
||||
$w.Write([uint16]0); $w.Write([uint16]1); $w.Write([uint16]$sizes.Count)
|
||||
$offset = 6 + 16 * $sizes.Count
|
||||
for ($i = 0; $i -lt $sizes.Count; $i++) {
|
||||
$dim = if ($sizes[$i] -ge 256) { 0 } else { $sizes[$i] } # 0 means 256
|
||||
$w.Write([byte]$dim); $w.Write([byte]$dim); $w.Write([byte]0); $w.Write([byte]0)
|
||||
$w.Write([uint16]1); $w.Write([uint16]32)
|
||||
$w.Write([uint32]$images[$i].Length); $w.Write([uint32]$offset)
|
||||
$offset += $images[$i].Length
|
||||
}
|
||||
foreach ($img in $images) { $w.Write($img) }
|
||||
$w.Flush()
|
||||
[System.IO.File]::WriteAllBytes((Join-Path (Get-Location) $Dst), $out.ToArray())
|
||||
Reference in new issue
Block a user