Merge remote-tracking branch 'origin/main'

This commit is contained in:
yuriy.p committed 2026-10-18 01:15:29 +06:00
commit 766ed22726
11 files changed
+132 -18

No files matched your search

Generated
+43 -2
View File
@@ -2992,7 +2992,7 @@ dependencies = [
[[package]] [[package]]
name = "musyx" name = "musyx"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"block2 0.6.2", "block2 0.6.2",
"directories", "directories",
@@ -3011,6 +3011,7 @@ dependencies = [
"souvlaki", "souvlaki",
"sys-locale", "sys-locale",
"tokio", "tokio",
"winresource",
"ym-api", "ym-api",
] ]
@@ -4700,6 +4701,15 @@ dependencies = [
"syn 3.0.9", "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]] [[package]]
name = "serde_urlencoded" name = "serde_urlencoded"
version = "0.7.1" version = "0.7.1"
@@ -5361,6 +5371,21 @@ dependencies = [
"tokio", "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]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "1.1.2+spec-1.1.0" version = "1.1.2+spec-1.1.0"
@@ -5391,6 +5416,12 @@ dependencies = [
"winnow", "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]] [[package]]
name = "tower" name = "tower"
version = "0.5.3" version = "0.5.3"
@@ -6505,6 +6536,16 @@ dependencies = [
"memchr", "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]] [[package]]
name = "wit-bindgen" name = "wit-bindgen"
version = "0.57.1" version = "0.57.1"
@@ -6629,7 +6670,7 @@ checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
[[package]] [[package]]
name = "ym-api" name = "ym-api"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
+1 -1
View File
@@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/ym-api", "crates/musyx"] members = ["crates/ym-api", "crates/musyx"]
[workspace.package] [workspace.package]
version = "0.2.0" version = "0.2.1"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
publish = false publish = false
+3
View File
@@ -27,6 +27,9 @@ objc2-foundation = "0.3.2"
objc2-app-kit = "0.3.2" objc2-app-kit = "0.3.2"
block2 = "0.6.2" block2 = "0.6.2"
[build-dependencies]
winresource = "0.1.34"
[dev-dependencies] [dev-dependencies]
iced_test = "0.14" iced_test = "0.14"
tokio = { version = "1", features = ["macros", "rt"] } tokio = { version = "1", features = ["macros", "rt"] }
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+12
View File
@@ -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");
}
}
+11
View File
@@ -138,6 +138,9 @@ pub enum Message {
ClearCoverCache, ClearCoverCache,
CoverCacheCleared(Result<(), String>), CoverCacheCleared(Result<(), String>),
Media(crate::media::Command), Media(crate::media::Command),
/// A window opened; Windows media controls need its handle.
WindowOpened(iced::window::Id),
MediaWindow(u64),
LoadLikedIds, LoadLikedIds,
LikedIdsLoaded(Result<LikedIds, Error>), LikedIdsLoaded(Result<LikedIds, Error>),
LikeTrack(Track, bool), LikeTrack(Track, bool),
@@ -264,6 +267,9 @@ impl App {
let audio = player::engine::subscription().map(|e| Message::Player(player::Msg::Engine(e))); let audio = player::engine::subscription().map(|e| Message::Player(player::Msg::Engine(e)));
let keys = crate::media::subscription().map(Message::Media); let keys = crate::media::subscription().map(Message::Media);
let mut subs = vec![appearance, audio, keys]; 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 { if let Session::SignedOut(sign_in) = &self.session {
subs.push(sign_in.subscription().map(Message::SignIn)); subs.push(sign_in.subscription().map(Message::SignIn));
} }
@@ -521,6 +527,11 @@ impl App {
self.toast(trf("“{}” plays next", &[&track.full_title()])); self.toast(trf("“{}” plays next", &[&track.full_title()]));
return self.update(Message::Player(player::Msg::PlayNext(track))); 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) => { Message::Media(command) => {
use crate::media::Command as C; use crate::media::Command as C;
let status = self.player.status(); let status = self.player.status();
+3
View File
@@ -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 app;
mod covers; mod covers;
mod i18n; mod i18n;
+22 -14
View File
@@ -71,21 +71,16 @@ impl Media {
{ {
*inbox = Some(rx); *inbox = Some(rx);
} }
let controls = MediaControls::new(PlatformConfig { display_name: "Musyx", dbus_name: "musyx", hwnd: None }) // Windows ties the controls to a window, so they wait for `attach_window`.
.and_then(|mut c| { let controls = if cfg!(windows) { None } else { connect(None) };
c.attach(|event| { Self { controls, shown: None }
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 }
} }
/// 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> { pub fn subscription() -> Subscription<Command> {
Subscription::run(commands) Subscription::run(commands)
} }
+1 -1
View File
@@ -1,7 +1,7 @@
# Maintainer: Yuriy Panov <uriy.panov@gmail.com> # Maintainer: Yuriy Panov <uriy.panov@gmail.com>
# Builds the checked-out commit of this repository: run `makepkg -si` in this directory. # Builds the checked-out commit of this repository: run `makepkg -si` in this directory.
pkgname=musyx pkgname=musyx
pkgver=0.2.0 pkgver=0.2.1
pkgrel=1 pkgrel=1
pkgdesc='Desktop player for Yandex Music (unofficial)' pkgdesc='Desktop player for Yandex Music (unofficial)'
arch=('x86_64' 'aarch64') arch=('x86_64' 'aarch64')
@@ -23,6 +23,7 @@
</categories> </categories>
<content_rating type="oars-1.1"/> <content_rating type="oars-1.1"/>
<releases> <releases>
<release version="0.2.1" date="2026-10-18"/>
<release version="0.2.0" date="2026-10-16"/> <release version="0.2.0" date="2026-10-16"/>
</releases> </releases>
</component> </component>
+35
View File
@@ -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())