Rewrite Mulberry in Rust (egui + libmpv)
Port of the Python/PyQt6 app: same library database, playlists, hero panel, lyrics, tag editor, MusicBrainz/cover tools, CD ripping, MPRIS and tray. New: right-click 'Set <tag> to "value"' writes the clicked cell's tag into every selected file (with undo). The seek bar now runs off a monotonic position clock so it can't jump back and forth. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
commit
4fef60ba23
52 changed files with 20594 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
target/
|
||||
*.AppImage
|
||||
releases/
|
||||
dist/
|
||||
.directory
|
||||
5311
Cargo.lock
generated
Normal file
5311
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
46
Cargo.toml
Normal file
46
Cargo.toml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
[package]
|
||||
name = "mulberry"
|
||||
version = "2.0.0"
|
||||
edition = "2021"
|
||||
description = "A Material You music player for Linux"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
eframe = { version = "0.37", default-features = false, features = ["glow", "wayland", "x11", "default_fonts", "system_fonts"] }
|
||||
rusqlite = { version = "0.41", features = ["bundled"] }
|
||||
lofty = "0.25"
|
||||
libmpv2 = "6"
|
||||
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "webp", "gif", "bmp"] }
|
||||
ureq = { version = "3", features = ["json"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
rustfft = "6"
|
||||
rand = "0.9"
|
||||
sha1 = "0.10"
|
||||
resvg = { version = "0.45", default-features = false }
|
||||
regex = "1"
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
urlencoding = "2"
|
||||
md5 = "0.8"
|
||||
base64 = "0.22"
|
||||
ksni = { version = "0.3", default-features = false, features = ["async-io", "blocking"] }
|
||||
dirs = "6"
|
||||
rfd = { version = "0.17", default-features = false, features = ["xdg-portal", "pollster"] }
|
||||
zbus = "5"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
lto = "thin"
|
||||
codegen-units = 4
|
||||
strip = true
|
||||
|
||||
[lib]
|
||||
name = "mulberry"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "mulberry"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
egui_kittest = { version = "0.37", features = ["wgpu", "eframe"] }
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2026 Mulberry 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.
|
||||
119
README.md
Normal file
119
README.md
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<div align="center">
|
||||
|
||||
<img src="assets/mulberry.svg" width="112" alt="Mulberry logo">
|
||||
|
||||
# Mulberry
|
||||
|
||||
**A Material You music player for Linux, written in Rust.**
|
||||
Strawberry's library and playlists with an expressive, colour-matched "now playing" panel.
|
||||
|
||||
</div>
|
||||
|
||||
This is the Rust rewrite of the original Python/PyQt6 Mulberry (kept next to this folder as `Mulberry-python`).
|
||||
It keeps the same look, the same library database and the same features, and fixes a few things on the way.
|
||||
|
||||

|
||||
|
||||
## What's new in the Rust version
|
||||
|
||||
- **Set tag from the right-click menu (Strawberry style).** Select several tracks, right-click the **Album**, **Artist**,
|
||||
**Title**, **Album artist**, **Genre**, **Composer**, **Year**, **Track** or **Disc** cell of any of them and pick
|
||||
*Set album to “Disclaimer II”*. The value of the cell you clicked is written into the tags of **all selected files
|
||||
immediately** (FLAC, Ogg/Opus, MP3, M4A, WAV, …), the library and every open playlist update, and a toast with **Undo**
|
||||
restores the old values.
|
||||
- **Seek bar no longer glitches.** The wavy bar used to integrate time itself and then get pulled back and forth by
|
||||
coarse position reports from the player (and by stale reports right after a seek). Now one monotonic clock drives
|
||||
everything: reports only nudge an estimate, the shown position never goes backwards, stale pre-seek reports are
|
||||
ignored, and the wave phase comes from absolute time. The cover is uploaded to the GPU once and drawn as a textured
|
||||
mesh, so nothing is rescaled per frame.
|
||||
- **Light on the CPU.** Idle and paused means no repaints at all. While playing, animations run at the frame-rate cap
|
||||
(Settings › Appearance, default 30 fps); one whole UI frame costs about 1 ms of CPU (`cargo test --release --test bench`).
|
||||
- Single native binary (no Python, no Qt), GPU-drawn with egui, MPRIS + system tray + desktop notifications.
|
||||
|
||||
## Install
|
||||
|
||||
Needs Rust, `libmpv` (the `mpv` package) and, optionally, `ffmpeg`, `cdparanoia`, `yt-dlp` and `parec`.
|
||||
|
||||
```bash
|
||||
./install.sh # builds the release binary, installs ~/.local/bin/mulberry + menu entry + icon
|
||||
./install.sh --uninstall
|
||||
```
|
||||
|
||||
Arch: `sudo pacman -S rust mpv ffmpeg cdparanoia yt-dlp libpulse`
|
||||
|
||||
Your existing library (`~/.local/share/mulberry/library.db`), playlists, covers and lyrics cache are used as they are.
|
||||
Settings are imported once from the old `mulberry.conf` into `~/.config/mulberry/settings.json`.
|
||||
|
||||
## Features
|
||||
|
||||
**Look and feel**
|
||||
- Material 3 colour roles from your system colours (`~/.config/kdeglobals` when present), from the album art, or from a
|
||||
custom seed colour; light/dark follows the system or is forced.
|
||||
- Hero panel: cookie-shaped spinning cover with a radial spectrum (decoded from the track itself and synced to the
|
||||
playback position), wavy seek bar, morphing play button, synced lyrics (click a line to seek), Large / Compact / Hidden
|
||||
layouts and a Focus mode (F11).
|
||||
- Floating bass shape in the bottom-left corner and a block spectrum analyzer in the bottom bar.
|
||||
|
||||
**Library and playback**
|
||||
- SQLite collection with an incremental background scanner; group by album artist, artist, genre, year or album;
|
||||
search with `artist:` `album:` `genre:` `year:>2000` `rating:>3`.
|
||||
- Tabbed playlists with undo/redo, multi-select, drag and drop (also from the library tree and from the file manager),
|
||||
column chooser/reordering/resizing, sorting, filtering, duplicate and missing-file removal, saved/pinned playlists.
|
||||
- Play queue, *Play next*, *Stop after this track*, shuffle and repeat; smart playlists; play counts, skips, 0–5 star ratings.
|
||||
- Import M3U/M3U8/PLS/XSPF/WPL/ASX/CUE, export M3U/M3U8/PLS/XSPF/WPL (single or all playlists).
|
||||
- Gapless playback, crossfade (1–12 s), 10-band equalizer with presets, ReplayGain, output device selection, resume on start.
|
||||
- YouTube, SoundCloud, Bandcamp… links (through `yt-dlp`) and internet radio with now-playing titles.
|
||||
|
||||
**Metadata**
|
||||
- Tag editor for one or many files with cover embedding; MusicBrainz lookup (pick a match or auto-apply the best);
|
||||
cover manager (iTunes, Deezer, Cover Art Archive, Last.fm); synced lyrics from LRCLIB, NetEase, embedded tags or `.lrc` files.
|
||||
- Last.fm scrobbling, now-playing and Love (offline cache); ListenBrainz.
|
||||
|
||||
**Audio CD**: drive detection, TOC, MusicBrainz lookup, playback and ripping (cdparanoia + ffmpeg to FLAC/ALAC/Opus/Vorbis/MP3/WAV).
|
||||
|
||||
**Desktop**: MPRIS2 (media keys, Plasma/shell widgets), tray icon with close-to-tray, notifications with cover art, single instance.
|
||||
|
||||
## Keyboard shortcuts
|
||||
|
||||
| Keys | Action |
|
||||
|---|---|
|
||||
| Space | Play / pause |
|
||||
| Ctrl+← / Ctrl+→ | Previous / next |
|
||||
| Alt+← / Alt+→ | Seek −/+ 10 s |
|
||||
| Ctrl+↑ / Ctrl+↓, Ctrl+M | Volume, mute |
|
||||
| Ctrl+D | Queue / dequeue selected |
|
||||
| Ctrl+J | Jump to the playing track |
|
||||
| Ctrl+F | Filter the playlist |
|
||||
| Ctrl+E | Edit tags |
|
||||
| Ctrl+T / Ctrl+W | New / close playlist |
|
||||
| Ctrl+I / Ctrl+S / Ctrl+Shift+S | Import / export / export all playlists |
|
||||
| Ctrl+Z / Ctrl+Shift+Z | Undo / redo |
|
||||
| Ctrl+L | Love the current track |
|
||||
| Ctrl+O / Ctrl+Shift+O / Ctrl+U | Open files / folder / URL |
|
||||
| F5 / Ctrl+F5 | Update library / full rescan |
|
||||
| F11 | Focus mode |
|
||||
|
||||
## Where your data lives
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Settings | `~/.config/mulberry/settings.json` |
|
||||
| Library, playlists, lyrics cache | `~/.local/share/mulberry/library.db` |
|
||||
| Covers | `~/.local/share/mulberry/covers` |
|
||||
| Thumbnails | `~/.cache/mulberry` |
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
cargo run --release
|
||||
cargo test --test tagwrite --test playback --test dbus # tag round trips, seek-bar clock, MPRIS/tray
|
||||
MULBERRY_SCRATCH=/tmp/mb-scratch cargo test --test shots # offscreen screenshots (needs a scratch copy of the data dirs)
|
||||
```
|
||||
|
||||
The UI tests render offscreen through `egui_kittest` (no window) against a scratch copy of the data directories, and the
|
||||
tag tests only touch freshly generated files.
|
||||
|
||||
Layout: `src/player.rs` (libmpv engine + position clock), `src/library.rs`, `src/playlist.rs`, `src/tags.rs` (lofty),
|
||||
`src/spectrum.rs`, `src/online.rs`, `src/ui/*` (hand-painted Material 3 widgets, hero, playlist view, sidebar, dialogs).
|
||||
|
||||
Icons: Material Symbols (Apache 2.0). Licence: MIT.
|
||||
5
assets/mulberry.svg
Normal file
5
assets/mulberry.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
|
||||
<defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#cdb4ff"/><stop offset="1" stop-color="#f0a6d8"/></linearGradient></defs>
|
||||
<path d="M250.00,128.00 L249.45,132.24 L247.84,136.38 L245.33,140.33 L242.13,144.04 L238.53,147.49 L234.84,150.71 L231.34,153.77 L228.30,156.76 L225.92,159.82 L224.30,163.05 L223.46,166.57 L223.32,170.44 L223.72,174.69 L224.44,179.28 L225.20,184.12 L225.74,189.08 L225.81,193.97 L225.19,198.61 L223.76,202.82 L221.46,206.42 L218.31,209.31 L214.42,211.45 L209.95,212.87 L205.12,213.65 L200.15,213.98 L195.25,214.07 L190.60,214.16 L186.35,214.51 L182.56,215.31 L179.24,216.75 L176.34,218.91 L173.74,221.78 L171.32,225.30 L168.92,229.27 L166.39,233.47 L163.62,237.61 L160.52,241.41 L157.06,244.57 L153.27,246.87 L149.19,248.15 L144.91,248.34 L140.56,247.48 L136.23,245.69 L132.02,243.19 L128.00,240.24 L124.19,237.16 L120.57,234.24 L117.09,231.77 L113.67,229.96 L110.20,228.92 L106.59,228.71 L102.76,229.24 L98.64,230.38 L94.25,231.88 L89.61,233.47 L84.82,234.86 L80.01,235.78 L75.34,235.98 L70.95,235.30 L67.00,233.66 L63.60,231.06 L60.82,227.60 L58.65,223.45 L57.04,218.82 L55.85,213.98 L54.91,209.17 L54.02,204.61 L52.94,200.48 L51.49,196.89 L49.50,193.87 L46.87,191.39 L43.58,189.33 L39.70,187.56 L35.37,185.88 L30.80,184.12 L26.23,182.11 L21.96,179.72 L18.25,176.86 L15.33,173.52 L13.36,169.73 L12.43,165.55 L12.52,161.11 L13.53,156.54 L15.26,151.96 L17.47,147.49 L19.84,143.20 L22.08,139.13 L23.91,135.28 L25.11,131.59 L25.52,128.00 L25.11,124.41 L23.91,120.72 L22.08,116.87 L19.84,112.80 L17.47,108.51 L15.26,104.04 L13.53,99.46 L12.52,94.89 L12.43,90.45 L13.36,86.27 L15.33,82.48 L18.25,79.14 L21.96,76.28 L26.23,73.89 L30.80,71.88 L35.37,70.12 L39.70,68.44 L43.58,66.67 L46.87,64.61 L49.50,62.13 L51.49,59.11 L52.94,55.52 L54.02,51.39 L54.91,46.83 L55.85,42.02 L57.04,37.18 L58.65,32.55 L60.82,28.40 L63.60,24.94 L67.00,22.34 L70.95,20.70 L75.34,20.02 L80.01,20.22 L84.82,21.14 L89.61,22.53 L94.25,24.12 L98.64,25.62 L102.76,26.76 L106.59,27.29 L110.20,27.08 L113.67,26.04 L117.09,24.23 L120.57,21.76 L124.19,18.84 L128.00,15.76 L132.02,12.81 L136.23,10.31 L140.56,8.52 L144.91,7.66 L149.19,7.85 L153.27,9.13 L157.06,11.43 L160.52,14.59 L163.62,18.39 L166.39,22.53 L168.92,26.73 L171.32,30.70 L173.74,34.22 L176.34,37.09 L179.24,39.25 L182.56,40.69 L186.35,41.49 L190.60,41.84 L195.25,41.93 L200.15,42.02 L205.12,42.35 L209.95,43.13 L214.42,44.55 L218.31,46.69 L221.46,49.58 L223.76,53.18 L225.19,57.39 L225.81,62.03 L225.74,66.92 L225.20,71.88 L224.44,76.72 L223.72,81.31 L223.32,85.56 L223.46,89.43 L224.30,92.95 L225.92,96.18 L228.30,99.24 L231.34,102.23 L234.84,105.29 L238.53,108.51 L242.13,111.96 L245.33,115.67 L247.84,119.62 L249.45,123.76 L250.00,128.00Z" fill="url(#g)"/>
|
||||
<g transform="translate(56,200) scale(0.15)"><path fill="#3a2360" d="M286.5-163.5Q243-207 243-270t43.5-106.5Q330-420 393-420q28 0 50.5 8t39.5 22v-420q0-13 8.5-21.5T513-840h174q13 0 21.5 8.5T717-810v75q0 13-8.5 21.5T687-705H543v435q0 63-43.5 106.5T393-120q-63 0-106.5-43.5Z"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3 KiB |
BIN
docs/set-tag-menu.png
Normal file
BIN
docs/set-tag-menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 180 KiB |
85
install.sh
Executable file
85
install.sh
Executable file
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env bash
|
||||
# Mulberry installer for Linux (per-user, no root needed).
|
||||
#
|
||||
# ./install.sh build the release binary from source and install it (or update)
|
||||
# ./install.sh --uninstall remove the app, menu entry and icon (keeps your library/settings)
|
||||
# ./install.sh --purge uninstall AND delete your library, playlists, settings and caches
|
||||
# ./install.sh --help
|
||||
set -euo pipefail
|
||||
|
||||
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
BIN="$HOME/.local/bin"
|
||||
APPS="$DATA_HOME/applications"
|
||||
ICON="$DATA_HOME/icons/hicolor/scalable/apps/mulberry.svg"
|
||||
|
||||
bold() { printf '\033[1m%s\033[0m\n' "$*"; }
|
||||
ok() { printf ' \033[32m✓\033[0m %s\n' "$*"; }
|
||||
warn() { printf ' \033[33m!\033[0m %s\n' "$*"; }
|
||||
die() { printf ' \033[31m✗ %s\033[0m\n' "$*" >&2; exit 1; }
|
||||
|
||||
refresh_menus() {
|
||||
command -v update-desktop-database >/dev/null && update-desktop-database "$APPS" 2>/dev/null || true
|
||||
command -v kbuildsycoca6 >/dev/null && kbuildsycoca6 >/dev/null 2>&1 || true
|
||||
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -q "$DATA_HOME/icons/hicolor" 2>/dev/null || true
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
bold "==> Uninstalling Mulberry"
|
||||
pkill -x mulberry 2>/dev/null || true
|
||||
rm -f "$BIN/mulberry" && ok "removed $BIN/mulberry"
|
||||
rm -f "$APPS/mulberry.desktop" && ok "removed menu entry"
|
||||
rm -f "$ICON" && ok "removed icon"
|
||||
refresh_menus
|
||||
if [[ "${1:-}" == "purge" ]]; then
|
||||
rm -rf "$DATA_HOME/mulberry" "$CONFIG_HOME/mulberry" "$CACHE_HOME/mulberry"
|
||||
ok "deleted library, playlists, settings and caches"
|
||||
else
|
||||
echo " Your library, playlists and settings were kept in:"
|
||||
echo " $DATA_HOME/mulberry and $CONFIG_HOME/mulberry"
|
||||
echo " (run ./install.sh --purge to delete them too)"
|
||||
fi
|
||||
bold "Done."
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
-h|--help) sed -n '2,7p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
--uninstall|uninstall) uninstall; exit 0 ;;
|
||||
--purge|purge) uninstall purge; exit 0 ;;
|
||||
""|--install|install|--update|update) ;;
|
||||
*) die "unknown option: $1 (try --help)" ;;
|
||||
esac
|
||||
|
||||
bold "==> Checking requirements"
|
||||
command -v cargo >/dev/null || die "cargo not found — install Rust (https://rustup.rs, or: sudo pacman -S rust)"
|
||||
ok "$(cargo --version)"
|
||||
ldconfig -p 2>/dev/null | grep -q 'libmpv.so' || die "libmpv not found — Arch: sudo pacman -S mpv · Debian/Ubuntu: sudo apt install libmpv-dev · Fedora: sudo dnf install mpv-libs-devel"
|
||||
ok "libmpv"
|
||||
missing=()
|
||||
command -v ffmpeg >/dev/null || missing+=("ffmpeg — visualizer analysis and CD rip encoding")
|
||||
command -v cdparanoia >/dev/null || missing+=("cdparanoia — CD ripping")
|
||||
command -v yt-dlp >/dev/null || missing+=("yt-dlp — YouTube / SoundCloud / Bandcamp links")
|
||||
command -v parec >/dev/null || missing+=("parec (pulseaudio-utils / pipewire-pulse) — visualizer for radio streams")
|
||||
if ((${#missing[@]})); then
|
||||
warn "Optional tools not found:"
|
||||
for m in "${missing[@]}"; do echo " - $m"; done
|
||||
echo " Arch: sudo pacman -S ffmpeg cdparanoia yt-dlp libpulse"
|
||||
fi
|
||||
|
||||
bold "==> Building (release)"
|
||||
(cd "$SRC" && cargo build --release)
|
||||
ok "built $SRC/target/release/mulberry"
|
||||
|
||||
bold "==> Installing"
|
||||
mkdir -p "$BIN" "$APPS" "$(dirname "$ICON")"
|
||||
if [[ -e "$BIN/mulberry" && ! -L "$BIN/mulberry" ]] && ! cmp -s "$BIN/mulberry" "$SRC/target/release/mulberry" && file "$BIN/mulberry" 2>/dev/null | grep -qiE 'python|script|shell'; then
|
||||
mv "$BIN/mulberry" "$BIN/mulberry.old" && warn "kept your previous launcher as $BIN/mulberry.old"
|
||||
fi
|
||||
install -m755 "$SRC/target/release/mulberry" "$BIN/mulberry" && ok "installed $BIN/mulberry"
|
||||
install -m644 "$SRC/packaging/mulberry.svg" "$ICON" && ok "installed icon"
|
||||
install -m644 "$SRC/packaging/mulberry.desktop" "$APPS/mulberry.desktop" && ok "installed menu entry"
|
||||
refresh_menus
|
||||
case ":$PATH:" in *":$BIN:"*) ;; *) warn "$BIN is not on your PATH" ;; esac
|
||||
bold "Done. Start it from the app menu or with: mulberry"
|
||||
26
packaging/mulberry.desktop
Normal file
26
packaging/mulberry.desktop
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Mulberry
|
||||
GenericName=Music Player
|
||||
Comment=Material You music player
|
||||
Exec=mulberry %U
|
||||
Icon=mulberry
|
||||
Terminal=false
|
||||
Categories=AudioVideo;Audio;Player;
|
||||
MimeType=audio/mpeg;audio/flac;audio/x-flac;audio/ogg;audio/x-vorbis+ogg;audio/opus;audio/mp4;audio/aac;audio/x-m4a;audio/x-wav;audio/x-ms-wma;audio/x-ape;audio/x-wavpack;audio/x-musepack;audio/x-aiff;audio/x-mpegurl;audio/x-scpls;application/xspf+xml;application/x-cue;x-content/audio-cdda;
|
||||
Keywords=music;player;audio;lyrics;lastfm;cd;
|
||||
StartupWMClass=mulberry
|
||||
StartupNotify=true
|
||||
Actions=PlayPause;Next;Previous;
|
||||
|
||||
[Desktop Action PlayPause]
|
||||
Name=Play/Pause
|
||||
Exec=dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.mulberry /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
|
||||
|
||||
[Desktop Action Next]
|
||||
Name=Next track
|
||||
Exec=dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.mulberry /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
|
||||
|
||||
[Desktop Action Previous]
|
||||
Name=Previous track
|
||||
Exec=dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.mulberry /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
|
||||
5
packaging/mulberry.svg
Normal file
5
packaging/mulberry.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
|
||||
<defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#cdb4ff"/><stop offset="1" stop-color="#f0a6d8"/></linearGradient></defs>
|
||||
<path d="M250.00,128.00 L249.45,132.24 L247.84,136.38 L245.33,140.33 L242.13,144.04 L238.53,147.49 L234.84,150.71 L231.34,153.77 L228.30,156.76 L225.92,159.82 L224.30,163.05 L223.46,166.57 L223.32,170.44 L223.72,174.69 L224.44,179.28 L225.20,184.12 L225.74,189.08 L225.81,193.97 L225.19,198.61 L223.76,202.82 L221.46,206.42 L218.31,209.31 L214.42,211.45 L209.95,212.87 L205.12,213.65 L200.15,213.98 L195.25,214.07 L190.60,214.16 L186.35,214.51 L182.56,215.31 L179.24,216.75 L176.34,218.91 L173.74,221.78 L171.32,225.30 L168.92,229.27 L166.39,233.47 L163.62,237.61 L160.52,241.41 L157.06,244.57 L153.27,246.87 L149.19,248.15 L144.91,248.34 L140.56,247.48 L136.23,245.69 L132.02,243.19 L128.00,240.24 L124.19,237.16 L120.57,234.24 L117.09,231.77 L113.67,229.96 L110.20,228.92 L106.59,228.71 L102.76,229.24 L98.64,230.38 L94.25,231.88 L89.61,233.47 L84.82,234.86 L80.01,235.78 L75.34,235.98 L70.95,235.30 L67.00,233.66 L63.60,231.06 L60.82,227.60 L58.65,223.45 L57.04,218.82 L55.85,213.98 L54.91,209.17 L54.02,204.61 L52.94,200.48 L51.49,196.89 L49.50,193.87 L46.87,191.39 L43.58,189.33 L39.70,187.56 L35.37,185.88 L30.80,184.12 L26.23,182.11 L21.96,179.72 L18.25,176.86 L15.33,173.52 L13.36,169.73 L12.43,165.55 L12.52,161.11 L13.53,156.54 L15.26,151.96 L17.47,147.49 L19.84,143.20 L22.08,139.13 L23.91,135.28 L25.11,131.59 L25.52,128.00 L25.11,124.41 L23.91,120.72 L22.08,116.87 L19.84,112.80 L17.47,108.51 L15.26,104.04 L13.53,99.46 L12.52,94.89 L12.43,90.45 L13.36,86.27 L15.33,82.48 L18.25,79.14 L21.96,76.28 L26.23,73.89 L30.80,71.88 L35.37,70.12 L39.70,68.44 L43.58,66.67 L46.87,64.61 L49.50,62.13 L51.49,59.11 L52.94,55.52 L54.02,51.39 L54.91,46.83 L55.85,42.02 L57.04,37.18 L58.65,32.55 L60.82,28.40 L63.60,24.94 L67.00,22.34 L70.95,20.70 L75.34,20.02 L80.01,20.22 L84.82,21.14 L89.61,22.53 L94.25,24.12 L98.64,25.62 L102.76,26.76 L106.59,27.29 L110.20,27.08 L113.67,26.04 L117.09,24.23 L120.57,21.76 L124.19,18.84 L128.00,15.76 L132.02,12.81 L136.23,10.31 L140.56,8.52 L144.91,7.66 L149.19,7.85 L153.27,9.13 L157.06,11.43 L160.52,14.59 L163.62,18.39 L166.39,22.53 L168.92,26.73 L171.32,30.70 L173.74,34.22 L176.34,37.09 L179.24,39.25 L182.56,40.69 L186.35,41.49 L190.60,41.84 L195.25,41.93 L200.15,42.02 L205.12,42.35 L209.95,43.13 L214.42,44.55 L218.31,46.69 L221.46,49.58 L223.76,53.18 L225.19,57.39 L225.81,62.03 L225.74,66.92 L225.20,71.88 L224.44,76.72 L223.72,81.31 L223.32,85.56 L223.46,89.43 L224.30,92.95 L225.92,96.18 L228.30,99.24 L231.34,102.23 L234.84,105.29 L238.53,108.51 L242.13,111.96 L245.33,115.67 L247.84,119.62 L249.45,123.76 L250.00,128.00Z" fill="url(#g)"/>
|
||||
<g transform="translate(56,200) scale(0.15)"><path fill="#3a2360" d="M286.5-163.5Q243-207 243-270t43.5-106.5Q330-420 393-420q28 0 50.5 8t39.5 22v-420q0-13 8.5-21.5T513-840h174q13 0 21.5 8.5T717-810v75q0 13-8.5 21.5T687-705H543v435q0 63-43.5 106.5T393-120q-63 0-106.5-43.5Z"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3 KiB |
1071
src/app.rs
Normal file
1071
src/app.rs
Normal file
File diff suppressed because it is too large
Load diff
94
src/bus.rs
Normal file
94
src/bus.rs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
//! Messages from worker threads to the UI thread.
|
||||
|
||||
use crate::song::Song;
|
||||
use eframe::egui;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
pub enum Msg {
|
||||
ScanProgress { done: usize, total: usize },
|
||||
ScanFinished { added: usize, updated: usize, removed: usize },
|
||||
/// Cover for the playing song, already scaled for the GPU (None = no art).
|
||||
Art { ident: String, art: Option<Box<ArtData>>, path: String },
|
||||
/// Lyrics text and source label ("loading", "error", "none:<label>", … are special sources).
|
||||
Lyrics { token: u64, text: String, source: String },
|
||||
ArtistInfo { artist: String, text: String },
|
||||
Toast(String),
|
||||
/// Track decoded for the visualizer (mono, TRACK_RATE).
|
||||
Decoded { token: u64, samples: Vec<f32>, done: bool },
|
||||
/// Songs gathered from paths/playlist files, ready to be inserted.
|
||||
Added { job: AddJob, songs: Vec<Song> },
|
||||
Resolved { token: u64, result: Result<crate::online::Resolved, String> },
|
||||
/// Tag edit finished on a worker thread.
|
||||
TagsWritten(Box<TagsDone>),
|
||||
Engine(u8, crate::player::EngineEvent),
|
||||
Mpris(MprisCmd),
|
||||
/// A file/folder dialog finished (it runs on its own thread).
|
||||
Picked { purpose: String, paths: Vec<String> },
|
||||
Raise,
|
||||
OpenArgs(Vec<String>),
|
||||
CoverCandidates { token: u64, items: Result<Vec<crate::online::CoverCand>, String> },
|
||||
CoverThumb { token: u64, idx: usize, image: Option<egui::ColorImage> },
|
||||
CoverFull { token: u64, bytes: Result<Vec<u8>, String> },
|
||||
MbResults { token: u64, items: Result<Vec<crate::online::MbRelease>, String> },
|
||||
/// Result of a background job the UI shows as a toast.
|
||||
Done { toast: String },
|
||||
ConnectLastFm(Result<(String, String), String>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AddJob {
|
||||
pub pl: u64,
|
||||
pub row: Option<usize>,
|
||||
pub play: bool,
|
||||
pub replace: bool,
|
||||
}
|
||||
|
||||
pub struct TagsDone {
|
||||
/// (song before the edit, song after the edit, old values of the changed fields)
|
||||
pub ok: Vec<(Song, Song, Vec<(crate::tags::Field, String)>)>,
|
||||
pub errors: Vec<String>,
|
||||
pub label: String,
|
||||
/// True when this was an undo (don't offer another undo).
|
||||
pub is_undo: bool,
|
||||
}
|
||||
|
||||
pub struct ArtData {
|
||||
pub cover: egui::ColorImage,
|
||||
pub blur: egui::ColorImage,
|
||||
pub accent: Option<egui::Color32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum MprisCmd {
|
||||
Play,
|
||||
Pause,
|
||||
PlayPause,
|
||||
Stop,
|
||||
Next,
|
||||
Prev,
|
||||
Seek(f64),
|
||||
SetPos(f64),
|
||||
SetVolume(f64),
|
||||
Raise,
|
||||
ToggleVisible,
|
||||
Quit,
|
||||
SetShuffle(bool),
|
||||
SetLoop(String),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Bus {
|
||||
pub tx: Sender<Msg>,
|
||||
pub ctx: egui::Context,
|
||||
}
|
||||
|
||||
impl Bus {
|
||||
pub fn send(&self, m: Msg) {
|
||||
let _ = self.tx.send(m);
|
||||
self.ctx.request_repaint();
|
||||
}
|
||||
|
||||
pub fn toast(&self, s: impl Into<String>) {
|
||||
self.send(Msg::Toast(s.into()));
|
||||
}
|
||||
}
|
||||
341
src/cd.rs
Normal file
341
src/cd.rs
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
//! Audio CD: drive detection, TOC reading, MusicBrainz disc lookup, playback songs and ripping.
|
||||
|
||||
use crate::online::{self, Res};
|
||||
use crate::song::Song;
|
||||
use crate::tags::{self, Field};
|
||||
use base64::Engine;
|
||||
use regex::Regex;
|
||||
use serde_json::Value;
|
||||
use sha1::{Digest, Sha1};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Toc {
|
||||
pub first: i64,
|
||||
pub last: i64,
|
||||
pub leadout: i64,
|
||||
pub offsets: Vec<i64>,
|
||||
pub discid: String,
|
||||
pub device: String,
|
||||
/// (track number, start seconds, length seconds)
|
||||
pub tracks: Vec<(i64, f64, f64)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Release {
|
||||
pub album: String,
|
||||
pub albumartist: String,
|
||||
pub year: i64,
|
||||
pub mb_albumid: String,
|
||||
pub disc: i64,
|
||||
pub country: String,
|
||||
pub tracks: Vec<(String, String, String)>, // title, artist, mbid
|
||||
}
|
||||
|
||||
pub fn list_drives() -> Vec<String> {
|
||||
let mut v: Vec<String> = (0..8).map(|i| format!("/dev/sr{i}")).filter(|p| Path::new(p).exists()).collect();
|
||||
if v.is_empty() && Path::new("/dev/cdrom").exists() {
|
||||
v.push("/dev/cdrom".into());
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
fn which(name: &str) -> Option<PathBuf> {
|
||||
std::env::var_os("PATH").and_then(|p| std::env::split_paths(&p).map(|d| d.join(name)).find(|c| c.is_file()))
|
||||
}
|
||||
|
||||
pub fn compute_discid(first: i64, last: i64, leadout: i64, offsets: &[i64]) -> String {
|
||||
let mut s = format!("{first:02X}{last:02X}{leadout:08X}");
|
||||
for i in 0..99 {
|
||||
s += &format!("{:08X}", offsets.get(i).copied().unwrap_or(0));
|
||||
}
|
||||
let h = Sha1::digest(s.as_bytes());
|
||||
base64::engine::general_purpose::STANDARD.encode(h).replace('+', ".").replace('/', "_").replace('=', "-")
|
||||
}
|
||||
|
||||
pub fn read_toc(device: &str) -> Res<Toc> {
|
||||
let raw = toc_cdparanoia(device).or_else(|| toc_cdinfo(device)).ok_or("No audio CD found (or no TOC reader available — install cdparanoia).")?;
|
||||
let (first, last, leadout, offsets) = raw;
|
||||
let discid = compute_discid(first, last, leadout, &offsets);
|
||||
let mut offs = offsets.clone();
|
||||
offs.push(leadout);
|
||||
let tracks = (0..offsets.len()).map(|i| (first + i as i64, (offs[i] - offs[0]) as f64 / 75.0, (offs[i + 1] - offs[i]) as f64 / 75.0)).collect();
|
||||
Ok(Toc { first, last, leadout, offsets, discid, device: device.into(), tracks })
|
||||
}
|
||||
|
||||
fn toc_cdparanoia(device: &str) -> Option<(i64, i64, i64, Vec<i64>)> {
|
||||
let exe = which("cdparanoia")?;
|
||||
let out = Command::new(exe).args(["-Q", "-d", device]).stdin(Stdio::null()).output().ok()?;
|
||||
let txt = String::from_utf8_lossy(&out.stderr).to_string() + &String::from_utf8_lossy(&out.stdout);
|
||||
let re = Regex::new(r"(?m)^\s*(\d+)\.\s+(\d+)\s+\[[^\]]+\]\s+(\d+)\s+\[").unwrap();
|
||||
let rows: Vec<(i64, i64, i64)> = re.captures_iter(&txt).map(|c| (c[1].parse().unwrap(), c[2].parse().unwrap(), c[3].parse().unwrap())).collect();
|
||||
if rows.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let offsets = rows.iter().map(|r| r.2 + 150).collect();
|
||||
let leadout = rows.last().unwrap().2 + rows.last().unwrap().1 + 150;
|
||||
Some((rows[0].0, rows.last().unwrap().0, leadout, offsets))
|
||||
}
|
||||
|
||||
fn toc_cdinfo(device: &str) -> Option<(i64, i64, i64, Vec<i64>)> {
|
||||
let exe = which("cd-info")?;
|
||||
let out = Command::new(exe).args(["--no-header", "--no-device-info", "--no-cddb", "-C", device]).stdin(Stdio::null()).output().ok()?;
|
||||
let txt = String::from_utf8_lossy(&out.stdout).to_string();
|
||||
let re = Regex::new(r"(?m)^\s*(\d+):\s+\d+:\d+:\d+\s+(\d+)\s+audio").unwrap();
|
||||
let rows: Vec<(i64, i64)> = re.captures_iter(&txt).map(|c| (c[1].parse().unwrap(), c[2].parse().unwrap())).collect();
|
||||
let lead = Regex::new(r"(?m)^\s*170:\s+\d+:\d+:\d+\s+(\d+)\s+leadout").unwrap().captures(&txt)?;
|
||||
if rows.is_empty() {
|
||||
return None;
|
||||
}
|
||||
Some((rows[0].0, rows.last().unwrap().0, lead[1].parse::<i64>().ok()? + 150, rows.iter().map(|r| r.1 + 150).collect()))
|
||||
}
|
||||
|
||||
fn credit(v: &Value) -> String {
|
||||
v.as_array().map(|a| a.iter().map(|c| format!("{}{}", c["name"].as_str().unwrap_or(""), c["joinphrase"].as_str().unwrap_or(""))).collect()).unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn musicbrainz_lookup(toc: &Toc) -> Vec<Release> {
|
||||
let tocstr = std::iter::once(toc.first).chain(std::iter::once(toc.last)).chain(std::iter::once(toc.leadout)).chain(toc.offsets.iter().copied()).map(|x| x.to_string()).collect::<Vec<_>>().join(" ");
|
||||
let Ok(r) = online::mb_get_pub(&format!("discid/{}", toc.discid), &[("inc", "recordings+artist-credits".into()), ("toc", tocstr)]) else { return vec![] };
|
||||
let rels: Vec<Value> = if let Some(a) = r["releases"].as_array() { a.clone() } else if r["media"].is_array() { vec![r.clone()] } else { vec![] };
|
||||
let mut out = vec![];
|
||||
for rel in rels {
|
||||
let aa = credit(&rel["artist-credit"]);
|
||||
for med in rel["media"].as_array().cloned().unwrap_or_default() {
|
||||
let discids: Vec<String> = med["discs"].as_array().map(|d| d.iter().filter_map(|x| x["id"].as_str().map(String::from)).collect()).unwrap_or_default();
|
||||
let ntr = med["tracks"].as_array().map(|t| t.len()).unwrap_or(0);
|
||||
if !discids.is_empty() && !discids.contains(&toc.discid) && ntr != toc.offsets.len() {
|
||||
continue;
|
||||
}
|
||||
let tracks = med["tracks"]
|
||||
.as_array()
|
||||
.map(|ts| {
|
||||
ts.iter()
|
||||
.map(|t| {
|
||||
let ar = credit(&t["artist-credit"]);
|
||||
(t["title"].as_str().unwrap_or("").to_string(), if ar.is_empty() { aa.clone() } else { ar }, t["recording"]["id"].as_str().unwrap_or("").to_string())
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
out.push(Release {
|
||||
album: rel["title"].as_str().unwrap_or("").into(),
|
||||
albumartist: aa.clone(),
|
||||
year: rel["date"].as_str().unwrap_or("0").chars().take(4).collect::<String>().parse().unwrap_or(0),
|
||||
mb_albumid: rel["id"].as_str().unwrap_or("").into(),
|
||||
disc: med["position"].as_i64().unwrap_or(1),
|
||||
country: rel["country"].as_str().unwrap_or("").into(),
|
||||
tracks,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn songs_for(toc: &Toc, rel: Option<&Release>, art: &str) -> Vec<Song> {
|
||||
toc.tracks
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, (n, start, len))| {
|
||||
let info = rel.and_then(|r| r.tracks.get(i));
|
||||
let mut s = Song::new(format!("cdda://{n}"));
|
||||
s.title = info.map(|t| t.0.clone()).filter(|t| !t.is_empty()).unwrap_or_else(|| format!("Track {n}"));
|
||||
s.artist = info.map(|t| t.1.clone()).unwrap_or_else(|| rel.map(|r| r.albumartist.clone()).unwrap_or_default());
|
||||
s.album = rel.map(|r| r.album.clone()).unwrap_or_else(|| "Audio CD".into());
|
||||
s.albumartist = rel.map(|r| r.albumartist.clone()).unwrap_or_default();
|
||||
s.year = rel.map(|r| r.year).unwrap_or(0);
|
||||
s.track = *n;
|
||||
s.disc = rel.map(|r| r.disc).unwrap_or(0);
|
||||
s.length = *len;
|
||||
s.begin = *start;
|
||||
s.end = start + len;
|
||||
s.cd_track = *n;
|
||||
s.cd_device = toc.device.clone();
|
||||
s.filetype = "CDDA".into();
|
||||
s.samplerate = 44100;
|
||||
s.bitdepth = 16;
|
||||
s.channels = 2;
|
||||
s.bitrate = 1411;
|
||||
s.mb_trackid = info.map(|t| t.2.clone()).unwrap_or_default();
|
||||
s.mb_albumid = rel.map(|r| r.mb_albumid.clone()).unwrap_or_default();
|
||||
s.art = art.into();
|
||||
s
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn eject(device: &str) {
|
||||
if which("eject").is_some() {
|
||||
let _ = Command::new("eject").arg(device).spawn();
|
||||
} else if which("udisksctl").is_some() {
|
||||
let _ = Command::new("udisksctl").args(["eject", "-b", device]).spawn();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ ripping
|
||||
pub struct Format {
|
||||
pub key: &'static str,
|
||||
pub label: &'static str,
|
||||
pub ext: &'static str,
|
||||
}
|
||||
|
||||
pub const FORMATS: &[Format] = &[
|
||||
Format { key: "flac", label: "FLAC (lossless)", ext: "flac" },
|
||||
Format { key: "alac", label: "ALAC (lossless, .m4a)", ext: "m4a" },
|
||||
Format { key: "opus", label: "Opus", ext: "opus" },
|
||||
Format { key: "ogg", label: "Ogg Vorbis", ext: "ogg" },
|
||||
Format { key: "mp3", label: "MP3 (LAME VBR)", ext: "mp3" },
|
||||
Format { key: "wav", label: "WAV (uncompressed)", ext: "wav" },
|
||||
];
|
||||
|
||||
fn enc_args(fmt: &str, q: i64) -> Vec<String> {
|
||||
let s = |x: &str| x.to_string();
|
||||
match fmt {
|
||||
"flac" => vec![s("-c:a"), s("flac"), s("-compression_level"), q.clamp(0, 12).to_string()],
|
||||
"alac" => vec![s("-c:a"), s("alac")],
|
||||
"opus" => vec![s("-c:a"), s("libopus"), s("-b:a"), format!("{}k", [64, 96, 128, 160, 192, 256][q.clamp(0, 5) as usize])],
|
||||
"ogg" => vec![s("-c:a"), s("libvorbis"), s("-q:a"), q.clamp(0, 10).to_string()],
|
||||
"mp3" => vec![s("-c:a"), s("libmp3lame"), s("-q:a"), (9 - q.clamp(0, 9)).max(0).to_string()],
|
||||
_ => vec![s("-c:a"), s("pcm_s16le")],
|
||||
}
|
||||
}
|
||||
|
||||
fn safe(s: &str) -> String {
|
||||
let re = Regex::new(r#"[\\/:*?"<>|\x00-\x1f]"#).unwrap();
|
||||
let r = re.replace_all(s, "_").trim_matches(|c| c == ' ' || c == '.').to_string();
|
||||
if r.is_empty() { "Unknown".into() } else { r }
|
||||
}
|
||||
|
||||
/// Expand `{albumartist}/{album}/{track:02d} - {title}` style patterns.
|
||||
fn expand_pattern(pat: &str, s: &Song) -> String {
|
||||
let re = Regex::new(r"\{(\w+)(?::(\d+)d)?\}").unwrap();
|
||||
re.replace_all(pat, |c: ®ex::Captures| {
|
||||
let v: String = match &c[1] {
|
||||
"title" => safe(&s.title),
|
||||
"artist" => safe(&s.display_artist()),
|
||||
"album" => safe(&s.album),
|
||||
"albumartist" => safe(&if s.effective_albumartist().is_empty() { "Various Artists".into() } else { s.effective_albumartist() }),
|
||||
"year" => s.year.to_string(),
|
||||
"track" => match c.get(2) { Some(w) => format!("{:0width$}", s.track, width = w.as_str().parse().unwrap_or(2)), None => s.track.to_string() },
|
||||
"disc" => s.disc.to_string(),
|
||||
_ => String::new(),
|
||||
};
|
||||
v
|
||||
})
|
||||
.into_owned()
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct RipProgress {
|
||||
pub idx: usize,
|
||||
pub total: usize,
|
||||
pub msg: String,
|
||||
pub done: bool,
|
||||
pub ok: bool,
|
||||
pub ripped: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct Ripper {
|
||||
pub progress: Arc<Mutex<RipProgress>>,
|
||||
pub abort: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
impl Ripper {
|
||||
pub fn start(songs: Vec<Song>, fmt: String, quality: i64, outdir: String, pattern: String, cover: Option<Vec<u8>>, ctx: eframe::egui::Context) -> Ripper {
|
||||
let progress = Arc::new(Mutex::new(RipProgress { total: songs.len(), ..Default::default() }));
|
||||
let abort = Arc::new(AtomicBool::new(false));
|
||||
let (p2, a2) = (progress.clone(), abort.clone());
|
||||
std::thread::spawn(move || {
|
||||
let res = run(&songs, &fmt, quality, &outdir, &pattern, cover.as_deref(), &p2, &a2, &ctx);
|
||||
let mut p = p2.lock().unwrap();
|
||||
p.done = true;
|
||||
match res {
|
||||
Ok(()) => {
|
||||
p.ok = !a2.load(Ordering::Relaxed);
|
||||
p.msg = if a2.load(Ordering::Relaxed) { "Cancelled".into() } else { format!("Ripped {} tracks", songs.len()) };
|
||||
}
|
||||
Err(e) => {
|
||||
p.ok = false;
|
||||
p.msg = e;
|
||||
}
|
||||
}
|
||||
ctx.request_repaint();
|
||||
});
|
||||
Ripper { progress, abort }
|
||||
}
|
||||
|
||||
pub fn cancel(&self) {
|
||||
self.abort.store(true, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
fn run(songs: &[Song], fmt: &str, quality: i64, outdir: &str, pattern: &str, cover: Option<&[u8]>, prog: &Arc<Mutex<RipProgress>>, abort: &AtomicBool, ctx: &eframe::egui::Context) -> Result<(), String> {
|
||||
let ff = which("ffmpeg");
|
||||
let grab = which("cdparanoia").map(|p| (p, "cdparanoia")).or_else(|| which("icedax").or_else(|| which("cdda2wav")).map(|p| (p, "icedax")));
|
||||
let (Some(ff), Some((grab, kind))) = (ff, grab) else { return Err("Ripping needs cdparanoia (or icedax) and ffmpeg.".into()) };
|
||||
let ext = FORMATS.iter().find(|f| f.key == fmt).map(|f| f.ext).unwrap_or("flac");
|
||||
let tmp = std::env::temp_dir().join(format!("mulberry-rip-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&tmp).map_err(|e| e.to_string())?;
|
||||
let result = (|| -> Result<(), String> {
|
||||
for (i, s) in songs.iter().enumerate() {
|
||||
if abort.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
let rel = expand_pattern(pattern, s);
|
||||
let out = Path::new(outdir).join(format!("{rel}.{ext}"));
|
||||
if let Some(p) = out.parent() {
|
||||
std::fs::create_dir_all(p).map_err(|e| e.to_string())?;
|
||||
}
|
||||
{
|
||||
let mut p = prog.lock().unwrap();
|
||||
p.idx = i;
|
||||
p.msg = format!("Reading track {}: {}", s.track, s.title);
|
||||
}
|
||||
ctx.request_repaint();
|
||||
let wav = tmp.join(format!("t{}.wav", s.cd_track));
|
||||
let mut cmd = Command::new(&grab);
|
||||
if kind == "cdparanoia" {
|
||||
cmd.args(["-q", "-d", &s.cd_device, &s.cd_track.to_string()]).arg(&wav);
|
||||
} else {
|
||||
cmd.args(["-D", &s.cd_device, "-t", &s.cd_track.to_string(), "-O", "wav", "-q"]).arg(&wav);
|
||||
}
|
||||
let o = cmd.stdout(Stdio::null()).stderr(Stdio::piped()).output().map_err(|e| e.to_string())?;
|
||||
if abort.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
if !o.status.success() || !wav.exists() {
|
||||
let e = String::from_utf8_lossy(&o.stderr);
|
||||
return Err(format!("Reading track {} failed: {}", s.cd_track, e.chars().rev().take(300).collect::<String>().chars().rev().collect::<String>()));
|
||||
}
|
||||
prog.lock().unwrap().msg = format!("Encoding {}", out.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default());
|
||||
ctx.request_repaint();
|
||||
let o = Command::new(&ff).args(["-y", "-loglevel", "error", "-i"]).arg(&wav).args(enc_args(fmt, quality)).arg(&out).stdout(Stdio::null()).stderr(Stdio::piped()).output().map_err(|e| e.to_string())?;
|
||||
if !o.status.success() {
|
||||
return Err(format!("Encoding failed: {}", String::from_utf8_lossy(&o.stderr)));
|
||||
}
|
||||
if fmt != "wav" {
|
||||
let mut vals = vec![(Field::Title, s.title.clone()), (Field::Artist, s.artist.clone()), (Field::Album, s.album.clone()), (Field::AlbumArtist, s.albumartist.clone()), (Field::Year, s.year.to_string()), (Field::Track, s.track.to_string()), (Field::Disc, s.disc.to_string())];
|
||||
vals.push((Field::MbTrackId, s.mb_trackid.clone()));
|
||||
vals.push((Field::MbAlbumId, s.mb_albumid.clone()));
|
||||
let _ = tags::write_tags(&out.to_string_lossy(), &vals);
|
||||
if let Some(c) = cover {
|
||||
let _ = tags::embed_cover(&out.to_string_lossy(), Some(c));
|
||||
}
|
||||
}
|
||||
if let (Some(c), Some(parent)) = (cover, out.parent()) {
|
||||
if !parent.join("cover.jpg").exists() {
|
||||
let _ = std::fs::write(parent.join("cover.jpg"), c);
|
||||
}
|
||||
}
|
||||
let _ = std::fs::remove_file(&wav);
|
||||
prog.lock().unwrap().ripped.push(out.to_string_lossy().into_owned());
|
||||
}
|
||||
Ok(())
|
||||
})();
|
||||
let _ = std::fs::remove_dir_all(&tmp);
|
||||
result
|
||||
}
|
||||
371
src/config.rs
Normal file
371
src/config.rs
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
//! Paths, settings and small shared helpers.
|
||||
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{LazyLock, RwLock};
|
||||
|
||||
pub const APP_NAME: &str = "Mulberry";
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub const USER_AGENT: &str = concat!("Mulberry/", env!("CARGO_PKG_VERSION"), " ( https://archlinux.tail7c4f5e.ts.net/git/astar76/Mulberry )");
|
||||
|
||||
fn xdg(var: &str, default: &str) -> PathBuf {
|
||||
match std::env::var_os(var) {
|
||||
Some(v) if !v.is_empty() => PathBuf::from(v),
|
||||
_ => dirs::home_dir().unwrap_or_default().join(default),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Paths {
|
||||
pub config: PathBuf,
|
||||
pub data: PathBuf,
|
||||
pub cache: PathBuf,
|
||||
pub covers: PathBuf,
|
||||
pub thumbs: PathBuf,
|
||||
pub db: PathBuf,
|
||||
}
|
||||
|
||||
pub static PATHS: LazyLock<Paths> = LazyLock::new(|| {
|
||||
let config = xdg("XDG_CONFIG_HOME", ".config").join("mulberry");
|
||||
let data = xdg("XDG_DATA_HOME", ".local/share").join("mulberry");
|
||||
let cache = xdg("XDG_CACHE_HOME", ".cache").join("mulberry");
|
||||
let p = Paths {
|
||||
covers: data.join("covers"),
|
||||
thumbs: cache.join("thumbs"),
|
||||
db: data.join("library.db"),
|
||||
config,
|
||||
data,
|
||||
cache,
|
||||
};
|
||||
for d in [&p.config, &p.data, &p.cache, &p.covers, &p.thumbs] {
|
||||
let _ = std::fs::create_dir_all(d);
|
||||
}
|
||||
p
|
||||
});
|
||||
|
||||
pub const AUDIO_EXTS: &[&str] = &[
|
||||
"mp3", "mp2", "mp1", "flac", "ogg", "oga", "opus", "spx", "m4a", "m4b", "mp4", "aac", "alac", "wav", "wave", "aif",
|
||||
"aiff", "aifc", "wma", "asf", "ape", "wv", "mpc", "mp+", "tta", "ofr", "ofs", "tak", "dsf", "dff", "mka", "webm",
|
||||
"ac3", "eac3", "dts", "amr", "au", "snd", "caf", "w64", "rf64", "mod", "xm", "it", "s3m", "mtm", "umx", "669",
|
||||
"med", "okt", "far", "stm", "ult", "psm", "mptm", "spc", "vgm", "vgz", "gym", "nsf", "sid", "mid", "midi", "kar",
|
||||
"3gp", "m4r", "aa", "aax", "voc", "mlp", "thd", "truehd",
|
||||
];
|
||||
pub const PLAYLIST_EXTS: &[&str] = &["m3u", "m3u8", "pls", "xspf", "wpl", "asx", "cue"];
|
||||
|
||||
pub fn ext_of(path: &str) -> String {
|
||||
std::path::Path::new(path).extension().map(|e| e.to_string_lossy().to_lowercase()).unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn is_audio_file(path: &str) -> bool {
|
||||
AUDIO_EXTS.contains(&ext_of(path).as_str())
|
||||
}
|
||||
|
||||
pub fn home() -> PathBuf {
|
||||
dirs::home_dir().unwrap_or_else(|| PathBuf::from("/"))
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ settings
|
||||
fn defaults() -> BTreeMap<&'static str, Value> {
|
||||
let m: Vec<(&str, Value)> = vec![
|
||||
("library/folders", json!([])),
|
||||
("library/scan_on_start", json!(true)),
|
||||
("library/grouping", json!("albumartist_album")),
|
||||
("playback/device", json!("")),
|
||||
("playback/volume", json!(70)),
|
||||
("playback/replaygain", json!("off")),
|
||||
("playback/rg_preamp", json!(0.0)),
|
||||
("playback/gapless", json!(true)),
|
||||
("playback/crossfade", json!(0)),
|
||||
("playback/eq_enabled", json!(false)),
|
||||
("playback/eq_bands", json!(vec![0.0f64; 10])),
|
||||
("playback/eq_preamp", json!(0.0)),
|
||||
("playback/repeat", json!("off")),
|
||||
("playback/shuffle", json!(false)),
|
||||
("playback/resume", json!(true)),
|
||||
("appearance/color_source", json!("kde")),
|
||||
("appearance/mode", json!("kde")),
|
||||
("appearance/custom_color", json!("#9a7fd1")),
|
||||
("appearance/hero", json!("full")),
|
||||
("appearance/playlist_art_bg", json!(true)),
|
||||
("appearance/visualizer", json!(true)),
|
||||
("appearance/analyzer", json!(true)),
|
||||
("appearance/font", json!("")),
|
||||
("appearance/notifications", json!(true)),
|
||||
("appearance/tray", json!(true)),
|
||||
("appearance/floating_shape", json!(true)),
|
||||
("appearance/max_fps", json!(30)),
|
||||
("lastfm/enabled", json!(false)),
|
||||
("lastfm/api_key", json!("")),
|
||||
("lastfm/use_own_key", json!(false)),
|
||||
("lastfm/api_secret", json!("")),
|
||||
("lastfm/session", json!("")),
|
||||
("lastfm/user", json!("")),
|
||||
("listenbrainz/enabled", json!(false)),
|
||||
("listenbrainz/token", json!("")),
|
||||
("online/auto_lyrics", json!(true)),
|
||||
("online/auto_covers", json!(true)),
|
||||
("online/save_covers_to_folder", json!(false)),
|
||||
("online/acoustid_key", json!("")),
|
||||
("lyrics/source", json!("auto")),
|
||||
("lyrics/plain", json!(false)),
|
||||
("ui/sidebar_tab", json!(0)),
|
||||
("ui/sidebar", json!(true)),
|
||||
("ui/sidebar_w", json!(300.0)),
|
||||
("ui/win_w", json!(0.0)),
|
||||
("ui/win_h", json!(0.0)),
|
||||
("export/relative_paths", json!(false)),
|
||||
("cd/device", json!("")),
|
||||
("cd/rip_format", json!("flac")),
|
||||
("cd/rip_quality", json!(5)),
|
||||
("cd/rip_dir", json!(home().join("Music").to_string_lossy())),
|
||||
("cd/rip_pattern", json!("{albumartist}/{album}/{track:02d} - {title}")),
|
||||
];
|
||||
m.into_iter().collect()
|
||||
}
|
||||
|
||||
/// Settings stored as flat `section/key` JSON. On first run the values of the old
|
||||
/// Python app (`mulberry.conf`, a QSettings INI file) are imported.
|
||||
pub struct Settings {
|
||||
values: RwLock<BTreeMap<String, Value>>,
|
||||
defaults: BTreeMap<&'static str, Value>,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
pub static SETTINGS: LazyLock<Settings> = LazyLock::new(Settings::load);
|
||||
|
||||
pub fn settings() -> &'static Settings {
|
||||
&SETTINGS
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
fn load() -> Settings {
|
||||
let path = PATHS.config.join("settings.json");
|
||||
let defaults = defaults();
|
||||
let mut values: BTreeMap<String, Value> = BTreeMap::new();
|
||||
match std::fs::read_to_string(&path) {
|
||||
Ok(txt) => {
|
||||
if let Ok(Value::Object(o)) = serde_json::from_str::<Value>(&txt) {
|
||||
values = o.into_iter().collect();
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
values = import_qsettings(&defaults);
|
||||
}
|
||||
}
|
||||
let s = Settings { values: RwLock::new(values), defaults, path };
|
||||
s.save();
|
||||
s
|
||||
}
|
||||
|
||||
fn save(&self) {
|
||||
let v = self.values.read().unwrap();
|
||||
if let Ok(txt) = serde_json::to_string_pretty(&*v) {
|
||||
let tmp = self.path.with_extension("json.tmp");
|
||||
if std::fs::write(&tmp, txt).is_ok() {
|
||||
let _ = std::fs::rename(&tmp, &self.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn raw(&self, key: &str) -> Value {
|
||||
if let Some(v) = self.values.read().unwrap().get(key) {
|
||||
return v.clone();
|
||||
}
|
||||
self.defaults.get(key).cloned().unwrap_or(Value::Null)
|
||||
}
|
||||
|
||||
pub fn set(&self, key: &str, value: impl Into<Value>) {
|
||||
self.values.write().unwrap().insert(key.to_string(), value.into());
|
||||
self.save();
|
||||
}
|
||||
|
||||
pub fn get_bool(&self, key: &str) -> bool {
|
||||
match self.raw(key) {
|
||||
Value::Bool(b) => b,
|
||||
Value::String(s) => matches!(s.as_str(), "1" | "true" | "yes"),
|
||||
Value::Number(n) => n.as_i64().unwrap_or(0) != 0,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
pub fn get_i64(&self, key: &str) -> i64 {
|
||||
match self.raw(key) {
|
||||
Value::Number(n) => n.as_i64().or_else(|| n.as_f64().map(|f| f as i64)).unwrap_or(0),
|
||||
Value::String(s) => s.parse().unwrap_or(0),
|
||||
Value::Bool(b) => b as i64,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
pub fn get_f64(&self, key: &str) -> f64 {
|
||||
match self.raw(key) {
|
||||
Value::Number(n) => n.as_f64().unwrap_or(0.0),
|
||||
Value::String(s) => s.parse().unwrap_or(0.0),
|
||||
_ => 0.0,
|
||||
}
|
||||
}
|
||||
pub fn get_str(&self, key: &str) -> String {
|
||||
match self.raw(key) {
|
||||
Value::String(s) => s,
|
||||
Value::Null => String::new(),
|
||||
v => v.to_string(),
|
||||
}
|
||||
}
|
||||
pub fn get_list(&self, key: &str) -> Vec<String> {
|
||||
match self.raw(key) {
|
||||
Value::Array(a) => a.into_iter().filter_map(|v| v.as_str().map(String::from)).collect(),
|
||||
Value::String(s) if !s.is_empty() => vec![s],
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
pub fn get_f64_list(&self, key: &str) -> Vec<f64> {
|
||||
match self.raw(key) {
|
||||
Value::Array(a) => a.into_iter().map(|v| v.as_f64().unwrap_or(0.0)).collect(),
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ legacy import
|
||||
fn import_qsettings(defaults: &BTreeMap<&'static str, Value>) -> BTreeMap<String, Value> {
|
||||
let mut out = BTreeMap::new();
|
||||
let Ok(txt) = std::fs::read_to_string(PATHS.config.join("mulberry.conf")) else {
|
||||
return out;
|
||||
};
|
||||
let mut section = String::from("General");
|
||||
for line in txt.lines() {
|
||||
let line = line.trim_end();
|
||||
if let Some(s) = line.strip_prefix('[').and_then(|l| l.strip_suffix(']')) {
|
||||
section = s.to_string();
|
||||
continue;
|
||||
}
|
||||
let Some((k, v)) = line.split_once('=') else { continue };
|
||||
let key = if section == "General" { k.to_string() } else { format!("{section}/{k}") };
|
||||
let Some(def) = defaults.get(key.as_str()) else { continue };
|
||||
let val = match def {
|
||||
Value::Bool(_) => json!(matches!(v, "true" | "1")),
|
||||
Value::Number(n) if n.is_f64() => json!(v.parse::<f64>().unwrap_or(0.0)),
|
||||
Value::Number(_) => json!(v.parse::<i64>().unwrap_or(0)),
|
||||
Value::Array(_) if key == "library/folders" => json!(decode_string_list(v)),
|
||||
Value::Array(_) => json!(v.split(',').filter_map(|x| x.trim().parse::<f64>().ok()).collect::<Vec<_>>()),
|
||||
_ => json!(v.trim_matches('"')),
|
||||
};
|
||||
out.insert(key, val);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Decode a QSettings `@Variant(...)` QStringList (UTF-16BE strings) or a plain comma list.
|
||||
fn decode_string_list(v: &str) -> Vec<String> {
|
||||
if !v.starts_with("@Variant(") {
|
||||
return v.split(',').map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect();
|
||||
}
|
||||
let inner = &v["@Variant(".len()..v.len().saturating_sub(1)];
|
||||
let b = inner.as_bytes();
|
||||
let mut raw: Vec<u8> = Vec::new();
|
||||
let mut i = 0;
|
||||
while i < b.len() {
|
||||
if b[i] == b'\\' && i + 1 < b.len() {
|
||||
i += 1;
|
||||
match b[i] {
|
||||
b'0' => {
|
||||
raw.push(0);
|
||||
i += 1;
|
||||
}
|
||||
b'x' => {
|
||||
let mut n = 0u32;
|
||||
let mut cnt = 0;
|
||||
i += 1;
|
||||
while i < b.len() && cnt < 2 && (b[i] as char).is_ascii_hexdigit() {
|
||||
n = n * 16 + (b[i] as char).to_digit(16).unwrap();
|
||||
i += 1;
|
||||
cnt += 1;
|
||||
}
|
||||
raw.push(n as u8);
|
||||
}
|
||||
b'n' => {
|
||||
raw.push(b'\n');
|
||||
i += 1;
|
||||
}
|
||||
b't' => {
|
||||
raw.push(b'\t');
|
||||
i += 1;
|
||||
}
|
||||
b'\\' => {
|
||||
raw.push(b'\\');
|
||||
i += 1;
|
||||
}
|
||||
c => {
|
||||
raw.push(c);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
raw.push(b[i]);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
let mut out = vec![];
|
||||
let mut p = 0;
|
||||
parse_variant(&raw, &mut p, &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
fn be32(raw: &[u8], p: usize) -> Option<usize> {
|
||||
raw.get(p..p + 4).map(|b| u32::from_be_bytes(b.try_into().unwrap()) as usize)
|
||||
}
|
||||
|
||||
/// Collect the strings of a serialized QVariant (QString, QStringList or QVariantList of those).
|
||||
fn parse_variant(raw: &[u8], p: &mut usize, out: &mut Vec<String>) {
|
||||
let Some(ty) = be32(raw, *p) else { return };
|
||||
*p += 5; // type id + isNull byte
|
||||
match ty {
|
||||
10 => {
|
||||
let Some(len) = be32(raw, *p) else { return };
|
||||
*p += 4;
|
||||
if len != 0xFFFF_FFFF && *p + len <= raw.len() {
|
||||
let units: Vec<u16> = raw[*p..*p + len].chunks(2).map(|c| u16::from_be_bytes([c[0], *c.get(1).unwrap_or(&0)])).collect();
|
||||
out.push(String::from_utf16_lossy(&units));
|
||||
*p += len;
|
||||
}
|
||||
}
|
||||
11 => {
|
||||
let Some(count) = be32(raw, *p) else { return };
|
||||
*p += 4;
|
||||
for _ in 0..count {
|
||||
let Some(len) = be32(raw, *p) else { return };
|
||||
*p += 4;
|
||||
if len == 0xFFFF_FFFF || *p + len > raw.len() {
|
||||
return;
|
||||
}
|
||||
let units: Vec<u16> = raw[*p..*p + len].chunks(2).map(|c| u16::from_be_bytes([c[0], *c.get(1).unwrap_or(&0)])).collect();
|
||||
out.push(String::from_utf16_lossy(&units));
|
||||
*p += len;
|
||||
}
|
||||
}
|
||||
9 => {
|
||||
let Some(count) = be32(raw, *p) else { return };
|
||||
*p += 4;
|
||||
for _ in 0..count {
|
||||
parse_variant(raw, p, out);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fmt_time(sec: f64) -> String {
|
||||
fmt_time_h(sec, false)
|
||||
}
|
||||
|
||||
pub fn fmt_time_h(sec: f64, force_hours: bool) -> String {
|
||||
if !(sec >= 0.0) {
|
||||
return "--:--".into();
|
||||
}
|
||||
let s = sec as i64;
|
||||
let (h, rem) = (s / 3600, s % 3600);
|
||||
let (m, s) = (rem / 60, rem % 60);
|
||||
if h > 0 || force_hours {
|
||||
format!("{h}:{m:02}:{s:02}")
|
||||
} else {
|
||||
format!("{m}:{s:02}")
|
||||
}
|
||||
}
|
||||
92
src/icondata.rs
Normal file
92
src/icondata.rs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
//! Material Symbols Rounded (Apache 2.0) path data, viewBox 0 -960 960 960.
|
||||
|
||||
pub const ICONS: &[(&str, &str)] = &[
|
||||
("add", "M450-450H230q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h220v-220q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v220h220q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H510v220q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-220Z"),
|
||||
("album", "M480-316q70 0 120-47.5T650-480q0-71-49.5-120.5T480-650q-69 0-116.5 50T316-480q0 69 47.5 116.5T480-316Zm-28.5-135.5Q440-463 440-480t11.5-28.5Q463-520 480-520t28.5 11.5Q520-497 520-480t-11.5 28.5Q497-440 480-440t-28.5-11.5ZM480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-156t86-127Q252-817 325-848.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Zm0-60q142 0 241-99.5T820-480q0-142-99-241t-241-99q-141 0-240.5 99T140-480q0 141 99.5 240.5T480-140Zm0-340Z"),
|
||||
("album_fill", "M480-316q70 0 120-47.5T650-480q0-71-49.5-120.5T480-650q-69 0-116.5 50T316-480q0 69 47.5 116.5T480-316Zm-28.5-135.5Q440-463 440-480t11.5-28.5Q463-520 480-520t28.5 11.5Q520-497 520-480t-11.5 28.5Q497-440 480-440t-28.5-11.5ZM480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-156t86-127Q252-817 325-848.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Z"),
|
||||
("arrow_back", "m274-450 227 227q9 9 9 21t-9 21q-9 9-21 9t-21-9L181-459q-5-5-7-10t-2-11q0-6 2-11t7-10l278-278q9-9 21-9t21 9q9 9 9 21t-9 21L274-510h496q13 0 21.5 8.5T800-480q0 13-8.5 21.5T770-450H274Z"),
|
||||
("art_track", "M100-200q-24 0-42-18t-18-42v-440q0-24 18-42t42-18h440q24 0 42 18t18 42v440q0 24-18 42t-42 18H100Zm0-60h440v-440H100v440Zm196-120-48-66q-5-6-12-6t-12 6l-50 65q-6 8-1.32 16t13.32 8h265q8.5 0 12.75-8t-.75-16l-70-93q-5-6-12-6t-12 6l-73 94Zm412.5 171.37Q700-217.25 700-230v-500q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v500q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Zm160 0Q860-217.25 860-230v-500q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v500q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63ZM100-260v-440 440Z"),
|
||||
("artist", "M616-189q-29-29-29-76t29-76q29-29 76-29 17 0 31 4t25 12v-176q0-12.75 8.63-21.38Q765.25-560 778-560h72q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-53v235q0 47-29 76t-76 29q-47 0-76-29Zm-506 29q-12.75 0-21.37-8.63Q80-177.25 80-190v-64q0-32 17-61.5t51-44.5q75-33 133.39-46.5Q339.78-420 400-420q35 0 68.5 4.5T537-402q16 5 21 15.38t3 21.5Q559-354 550-347q-9 7-22 3-29-8-61.21-12-32.22-4-66.79-4-58 0-109 11t-119 43q-16 8-24 22.5t-8 29.5v34h372q15 0 22.5 9.32t7.5 20.5q0 11.18-7.75 20.68T511-160H110Zm182-363q-42-42-42-108t42-108q42-42 108-42t108 42q42 42 42 108t-42 108q-42 42-108 42t-108-42Zm172.5-43.5Q490-592 490-631t-25.5-64.5Q439-721 400-721t-64.5 25.5Q310-670 310-631t25.5 64.5Q361-541 400-541t64.5-25.5ZM400-631Zm0 411Z"),
|
||||
("auto_awesome", "M550-590q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h100v-160q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v160h100q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H550Zm108.5 461.37Q650-137.25 650-150v-350q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v350q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Zm-400 0Q250-137.25 250-150v-150H150q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h260q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H310v150q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Zm0-300Q250-437.25 250-450v-360q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v360q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Z"),
|
||||
("check", "m378-332 363-363q9-9 21.5-9t21.5 9q9 9 9 21.5t-9 21.5L399-267q-9 9-21 9t-21-9L175-449q-9-9-8.5-21.5T176-492q9-9 21.5-9t21.5 9l159 160Z"),
|
||||
("chevron_left", "m406-481 177 177q9 9 8.5 21t-9.5 21q-9 9-21.5 9t-21.5-9L341-460q-5-5-7-10t-2-11q0-6 2-11t7-10l199-199q9-9 21.5-9t21.5 9q9 9 9 21.5t-9 21.5L406-481Z"),
|
||||
("chevron_right", "M530-481 353-658q-9-9-8.5-21t9.5-21q9-9 21.5-9t21.5 9l198 198q5 5 7 10t2 11q0 6-2 11t-7 10L396-261q-9 9-21 8.5t-21-9.5q-9-9-9-21.5t9-21.5l176-176Z"),
|
||||
("clear_all", "M150-280q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h500q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm80-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h500q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H230Zm80-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h500q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H310Z"),
|
||||
("close", "M480-438 270-228q-9 9-21 9t-21-9q-9-9-9-21t9-21l210-210-210-210q-9-9-9-21t9-21q9-9 21-9t21 9l210 210 210-210q9-9 21-9t21 9q9 9 9 21t-9 21L522-480l210 210q9 9 9 21t-9 21q-9 9-21 9t-21-9L480-438Z"),
|
||||
("close_fullscreen", "M420-378 143-101q-9 9-21 9t-21-9q-9-9-9-21t9-21l277-277H190q-13 0-21.5-8.5T160-450q0-13 8.5-21.5T190-480h260q13 0 21.5 8.5T480-450v260q0 13-8.5 21.5T450-160q-13 0-21.5-8.5T420-190v-188Zm162-162h188q13 0 21.5 8.5T800-510q0 13-8.5 21.5T770-480H510q-13 0-21.5-8.5T480-510v-260q0-13 8.5-21.5T510-800q13 0 21.5 8.5T540-770v188l277-277q9-9 21-9t21 9q9 9 9 21t-9 21L582-540Z"),
|
||||
("cloud_download", "M451-448v-289q-86 11-135 75.5T267-522h-19q-61 0-104.5 43T100-371q0 65 45 108t106 43h500q45 0 77-32t32-77q0-45-32-77t-77-32h-63v-84q0-68-33-117.5T570-718v-65q81 29 129.5 101T748-522v24q72-2 122 46t50 123q0 69-50 119t-119 50H251q-88 0-149.5-61.5T40-371q0-79 50.5-137.5T217-579q15-84 82-148.5T451-792q24 0 42 13.5t18 36.5v294l62-62q9-9 21-9t21 9q9 9 9 21.5t-9 21.5L502-353q-9 9-21 9t-21-9L346-467q-9-9-8.5-21.5T347-510q9-9 21.5-9t21.5 9l61 62Zm29-59Z"),
|
||||
("content_copy", "M300-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H300Zm0-60h440v-560H300v560ZM180-80q-24 0-42-18t-18-42v-590q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v590h470q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32Q662.75-80 650-80H180Zm120-180v-560 560Z"),
|
||||
("dark", "M480-120q-150 0-255-105T120-480q0-135 79.5-229T408-830q20-5 34-1t22 15q8 10 7.5 25t-8.5 35q-9 23-14 47t-5 49q0 90 63 153t153 63q25 0 48.5-4.5T754-461q22-8 38-7t26 9q10 8 13 23t-2 36q-27 121-121 200.5T480-120Zm0-60q109 0 190-67.5T771-406q-25 11-53.5 16.5T660-384q-115 0-195.5-80.5T384-660q0-24 5-51.5t18-62.5q-98 27-162.5 109.5T180-480q0 125 87.5 212.5T480-180Zm-4-297Z"),
|
||||
("delete", "M261-120q-24.75 0-42.37-17.63Q201-155.25 201-180v-570h-11q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h158q0-13 8.63-21.5 8.62-8.5 21.37-8.5h204q12.75 0 21.38 8.62Q612-822.75 612-810h158q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-11v570q0 24.75-17.62 42.37Q723.75-120 699-120H261Zm438-630H261v570h438v-570ZM418.5-274.63q8.5-8.62 8.5-21.37v-339q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v339q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63 12.82 0 21.32-8.63Zm166 0q8.5-8.62 8.5-21.37v-339q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v339q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63 12.82 0 21.32-8.63ZM261-750v570-570Z"),
|
||||
("download", "M469-327q-5-2-10-7L308-485q-9-9.27-8.5-21.64.5-12.36 9.11-21.36 9.39-9 21.89-9t21.5 9l98 99v-341q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v341l99-99q8.8-9 20.9-8.5 12.1.5 21.49 9.5 8.61 9 8.61 21.5t-9 21.5L501-334q-5 5-10.13 7-5.14 2-11 2-5.87 0-10.87-2ZM220-160q-24 0-42-18t-18-42v-113q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v113h520v-113q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v113q0 24-18 42t-42 18H220Z"),
|
||||
("drag_indicator", "M349.91-160q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Zm260 0q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Zm-260-250q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Zm260 0q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Zm-260-250q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Zm260 0q-28.91 0-49.41-20.59-20.5-20.59-20.5-49.5t20.59-49.41q20.59-20.5 49.5-20.5t49.41 20.59q20.5 20.59 20.5 49.5t-20.59 49.41q-20.59 20.5-49.5 20.5Z"),
|
||||
("edit", "M180-180h44l472-471-44-44-472 471v44Zm-30 60q-13 0-21.5-8.5T120-150v-73q0-12 5-23.5t13-19.5l557-556q8-8 19-12.5t23-4.5q11 0 22 4.5t20 12.5l44 44q9 9 13 20t4 22q0 11-4.5 22.5T823-694L266-138q-8 8-19.5 13t-23.5 5h-73Zm629-617-41-41 41 41Zm-105 64-22-22 44 44-22-22Z"),
|
||||
("eject", "M230-260h500q13 0 21.5 8.5T760-230q0 13-8.5 21.5T730-200H230q-13 0-21.5-8.5T200-230q0-13 8.5-21.5T230-260Zm10-139 215-323q5-7 11-10.5t14-3.5q8 0 14 3.5t11 10.5l215 323q10 15 1.5 31T695-352H265q-18 0-26.5-16t1.5-31Zm241-13Zm-162 0h322L480-650 319-412Z"),
|
||||
("equalizer", "M180.5-180.56Q160-201.13 160-230v-180q0-28.88 20.59-49.44t49.5-20.56q28.91 0 49.41 20.56Q300-438.88 300-410v180q0 28.87-20.59 49.44Q258.82-160 229.91-160t-49.41-20.56ZM479.91-160q-28.91 0-49.41-20.56Q410-201.13 410-230v-500q0-28.88 20.59-49.44t49.5-20.56q28.91 0 49.41 20.56Q550-758.88 550-730v500q0 28.87-20.59 49.44Q508.82-160 479.91-160Zm200.59-20.56Q660-201.13 660-230v-300q0-28.88 20.59-49.44t49.5-20.56q28.91 0 49.41 20.56Q800-558.88 800-530v300q0 28.87-20.59 49.44Q758.82-160 729.91-160t-49.41-20.56Z"),
|
||||
("expand_less", "M480-554 304-378q-9 9-21 8.5t-21-9.5q-9-9-9-21.5t9-21.5l197-197q9-9 21-9t21 9l198 198q9 9 9 21t-9 21q-9 9-21.5 9t-21.5-9L480-554Z"),
|
||||
("expand_more", "M469-358q-5-2-10-7L261-563q-9-9-8.5-21.5T262-606q9-9 21.5-9t21.5 9l175 176 176-176q9-9 21-8.5t21 9.5q9 9 9 21.5t-9 21.5L501-365q-5 5-10 7t-11 2q-6 0-11-2Z"),
|
||||
("favorite", "M458.19-144Q447-148 439-156l-53-49Q262-320 171-424.5T80-643q0-90.15 60.5-150.58Q201-854 290-854q51 0 101 24.5t89 80.5q44-56 91-80.5t99-24.5q89 0 149.5 60.42Q880-733.15 880-643q0 114-91 218.5T574-205l-53 49q-8.25 8.38-19.12 12.19Q491-140 480.19-140q-10.8 0-22-4ZM454-683q-27-49-71-80t-93-31q-66 0-108 42.5t-42 108.93q0 57.57 38.88 121.22 38.88 63.66 93 123.5Q326-338 384-286.5q58 51.5 96 86.5 38-34 96-86t112-112.5q54-60.5 93-124.19T820-643q0-66-42.5-108.5T670-794q-50 0-93.5 30.5T504-683q-5 8-11 11.5t-14 3.5q-8 0-14.5-3.5T454-683Zm26 186Z"),
|
||||
("favorite_fill", "M458-144q-11-4-19-12l-53-49Q262-320 171-424.5T80-643q0-90 60.5-150.5T290-854q51 0 101 24.5t89 80.5q44-56 91-80.5t99-24.5q89 0 149.5 60.5T880-643q0 114-91 218.5T574-205l-53 49q-8 8-19 12t-22 4q-11 0-22-4Z"),
|
||||
("fiber_manual_record", "M478-478ZM281.5-281.5Q200-363 200-480t81.5-198.5Q363-760 480-760t198.5 81.5Q760-597 760-480t-81.5 198.5Q597-200 480-200t-198.5-81.5ZM636-324q64-64 64-156t-64-156q-64-64-156-64t-156 64q-64 64-64 156t64 156q64 64 156 64t156-64Z"),
|
||||
("file_open", "M220-80q-24 0-42-18t-18-42v-680q0-24 18-42t42-18h315q12.44 0 23.72 5T578-862l204 204q8 8 13 19.28 5 11.28 5 23.72v215q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-200H550q-12.75 0-21.37-8.63Q520-617.25 520-630v-190H220v680h380q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32Q612.75-80 600-80H220Zm530-127v95q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Q690-99.25 690-112v-168q0-12.75 8.63-21.38Q707.25-310 720-310h168q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-96l107 107q9 9 9 21.16t-8.61 21Q890-92 877.53-92q-12.46 0-21.53-9L750-207Zm-530 67v-680 680Z"),
|
||||
("filter_list", "M430-240q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h100q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H430ZM270-450q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H270ZM150-660q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("fingerprint", "M481-779q108 0 203.5 46T843-601q3 5 2.5 8t-3.5 6q-3 3-7.5 3t-8.5-5q-59-82-150.5-126T481-759q-103 0-193 44.5T138-589q-4 5-7.5 6t-7.5-1q-4-2-4-6.5t2-8.5q62-86 157-133t203-47Zm0 96q136 0 233.5 90T812-371q0 46-34 78t-82 32q-49 0-84-32t-35-78q0-39-28.5-65T481-462q-39 0-68 26t-29 65q0 104 63 173.5T604-100q6 2 7.5 5t.5 7q-1 5-4 7t-8 0q-103-26-169.5-103T364-371q0-47 34.5-79t82.5-32q48 0 82.5 32t34.5 79q0 38 29.5 64t68.5 26q38 0 66.5-26t28.5-64q0-123-91.5-206T481-660q-127 0-218.5 83T171-371q0 24 5.5 62.5T200-221q2 5 0 7.5t-5 4.5q-4 2-8.5 1t-6.5-6q-13-38-20.5-77.5T152-371q0-129 98-220.5T481-683Zm0-197q65 0 127.5 16T728-819q5 2 5.5 6t-1.5 7q-2 3-5.5 5t-8.5 0q-55-27-115-42.5T481-859q-62 0-121 14.5T247-801q-5 2-7.5.5T235-805q-2-2-2-6t3-6q57-31 119.5-47T481-880Zm0 298q92 0 158.5 61T706-371q0 5-2.5 7.5T696-361q-5 0-8-2.5t-3-7.5q0-81-60.5-136T481-562q-83 0-142.5 55T279-371q0 85 29.5 145T396-106q4 4 3.5 7.5T396-92q-2 2-6.5 3.5T381-92q-58-60-90.5-126T258-371q0-89 65.5-150T481-582Zm-1 200q5 0 7.5 3t2.5 8q0 81 59.5 133.5T687-185q8 0 19-1t24-3q5-1 8 1.5t4 5.5q1 4-.5 7t-6.5 4q-18 5-31.5 5.5t-16.5.5q-88 0-152.5-58.5T470-371q0-5 2.5-8t7.5-3Z"),
|
||||
("folder", "M140-160q-24 0-42-18.5T80-220v-520q0-23 18-41.5t42-18.5h256q12.44 0 23.72 5t19.37 13.09L481-740h339q23 0 41.5 18.5T880-680v460q0 23-18.5 41.5T820-160H140Zm0-60h680v-460H456l-60-60H140v520Zm0 0v-520 520Z"),
|
||||
("folder_open", "M140-160q-23 0-41.5-18.5T80-220v-520q0-23 18.5-41.5T140-800h256q12.44 0 23.72 5t19.37 13.09L481-740h369q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H455l-60-60H140v520l90-355q5-20 21.83-32.5Q268.65-620 289-620h574q29 0 47.5 23t10.5 52l-88 339q-6 24-22 35t-41 11H140Zm63-60h572l84-340H287l-84 340Zm-63-353v-167 167Zm63 353 84-340-84 340Z"),
|
||||
("graphic_eq", "M285-270v-420q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v420q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37Zm165 160v-740q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v740q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Q450-97.25 450-110ZM120-430v-100q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v100q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37Zm495 160v-420q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v420q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37Zm165-160v-100q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v100q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37Z"),
|
||||
("history", "M477-120q-142 0-243.5-95.5T121-451q-1-12 7.5-21t21.5-9q12 0 20.5 8.5T181-451q11 115 95 193t201 78q127 0 215-89t88-216q0-124-89-209.5T477-780q-68 0-127.5 31T246-667h75q13 0 21.5 8.5T351-637q0 13-8.5 21.5T321-607H172q-13 0-21.5-8.5T142-637v-148q0-13 8.5-21.5T172-815q13 0 21.5 8.5T202-785v76q52-61 123.5-96T477-840q75 0 141 28t115.5 76.5Q783-687 811.5-622T840-482q0 75-28.5 141t-78 115Q684-177 618-148.5T477-120Zm34-374 115 113q9 9 9 21.5t-9 21.5q-9 9-21 9t-21-9L460-460q-5-5-7-10.5t-2-11.5v-171q0-13 8.5-21.5T481-683q13 0 21.5 8.5T511-653v159Z"),
|
||||
("image", "M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0 0v-600 600Zm86-97h429q8.5 0 12.75-8t-.75-16L590-457q-5-6-12-6t-12 6L446-302l-81-111q-5-6-12-6t-12 6l-86 112q-6 8-1.75 16t12.75 8Z"),
|
||||
("info", "M504.5-288.63q8.5-8.62 8.5-21.37v-180q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v180q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63 12.82 0 21.32-8.63Zm-1-314.57q9.5-9.2 9.5-22.8 0-14.45-9.48-24.22-9.48-9.78-23.5-9.78t-23.52 9.78Q447-640.45 447-626q0 13.6 9.48 22.8 9.48 9.2 23.5 9.2t23.52-9.2ZM480.27-80q-82.74 0-155.5-31.5Q252-143 197.5-197.5t-86-127.34Q80-397.68 80-480.5t31.5-155.66Q143-709 197.5-763t127.34-85.5Q397.68-880 480.5-880t155.66 31.5Q709-817 763-763t85.5 127Q880-563 880-480.27q0 82.74-31.5 155.5Q817-252 763-197.68q-54 54.31-127 86Q563-80 480.27-80Zm.23-60Q622-140 721-239.5t99-241Q820-622 721.19-721T480-820q-141 0-240.5 98.81T140-480q0 141 99.5 240.5t241 99.5Zm-.5-340Z"),
|
||||
("label", "M140-160q-24.75 0-42.37-17.63Q80-195.25 80-220v-520q0-24.75 17.63-42.38Q115.25-800 140-800h471q14.25 0 27 6.37 12.75 6.38 21 17.63l195 260q12 15.68 12 35.84Q866-460 854-444L660-184q-8.25 11.25-21 17.62-12.75 6.38-27 6.38H140Zm0-60h471l195-260-195-260H140v520Zm333-260Z"),
|
||||
("library_add", "M561.5-386.63q8.5-8.62 8.5-21.37v-102h102q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H570v-102q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v102H408q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5h102v102q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63 12.82 0 21.32-8.63ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-590q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v590h590q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32Q742.75-80 730-80H140Zm120-740v560-560Z"),
|
||||
("library_music", "M486-333q41 0 70-28.42T585-431v-252h86q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5h-96q-12.75 0-21.37 8.62Q545-725.75 545-713v207q-11-9-26.32-14T486-525q-39.06 0-66.03 27.37-26.97 27.36-26.97 67Q393-391 419.97-362q26.97 29 66.03 29ZM260-200q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h560q24 0 42 18t18 42v560q0 24-18 42t-42 18H260Zm0-60h560v-560H260v560ZM140-80q-24 0-42-18t-18-42v-590q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v590h590q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32Q742.75-80 730-80H140Zm120-740v560-560Z"),
|
||||
("light", "M579-380.76q41-40.77 41-99Q620-538 579.24-579q-40.77-41-99-41Q422-620 381-579.24q-41 40.77-41 99Q340-422 380.76-381q40.77 41 99 41Q538-340 579-380.76ZM338.5-338.5Q280-397 280-480t58.5-141.5Q397-680 480-680t141.5 58.5Q680-563 680-480t-58.5 141.5Q563-280 480-280t-141.5-58.5ZM70-450q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32Q57.25-510 70-510h100q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H70Zm720 0q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h100q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H790ZM458.5-768.63Q450-777.25 450-790v-100q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v100q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Zm0 720Q450-57.25 450-70v-100q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v100q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63ZM240-678l-57-56q-9-9-8.63-21.6.37-12.61 8.53-21.5 8.89-8.9 21.5-8.9 12.6 0 21.6 9l56 57q8 9 8 21t-8 20.5q-8 8.5-20.5 8.5t-21.5-8Zm494 495-56-57q-8-9-8-21.38 0-12.37 8.5-20.62 8.5-9 20.5-9t21 9l57 56q9 9 8.63 21.6-.37 12.61-8.53 21.5-8.89 8.9-21.5 8.9-12.6 0-21.6-9Zm-56-495q-9-9-9-21t9-21l56-57q9-9 21.6-8.63 12.61.37 21.5 8.53 8.9 8.89 8.9 21.5 0 12.6-9 21.6l-57 56q-8 8-20.36 8-12.37 0-21.64-8ZM182.9-182.9q-8.9-8.89-8.9-21.5 0-12.6 9-21.6l57-56q8.8-9 20.9-9 12.1 0 20.71 9 9.39 9 9.39 21t-9 21l-56 57q-9 9-21.6 8.63-12.61-.37-21.5-8.53ZM480-480Z"),
|
||||
("link", "M280-280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H280q-58.33 0-99.17 40.76-40.83 40.77-40.83 99Q140-422 180.83-381q40.84 41 99.17 41h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H280Zm75-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h250q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H355Zm185 170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140q58.33 0 99.17-40.76 40.83-40.77 40.83-99Q820-538 779.17-579q-40.84-41-99.17-41H540q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H540Z"),
|
||||
("lists", "M399-160q-36 0-61-25.58t-25-61.5Q313-283 338-308t61-25h395q36 0 61 25t25 60.92q0 35.92-25 61.5T794-160H399Zm1-233q-35.89 0-61.44-25.58Q313-444.16 313-480.08t25.56-61.42Q364.11-567 400-567h393q35.89 0 61.44 25.58Q880-515.84 880-479.92t-25.56 61.42Q828.89-393 793-393H400Zm-1-234q-36 0-61-25.58t-25-61.5Q313-750 338-775t61-25h395q36 0 61 25t25 60.92q0 35.92-25 61.5T794-627H399Zm-293.42-25.58Q80-678.16 80-714.08T105.58-775q25.58-25 61.5-25T228-775q25 25 25 60.92t-25 61.5Q203-627 167.08-627t-61.5-25.58ZM166.92-393q-35.92 0-61.42-25.58T80-480.08q0-35.92 25.58-61.42t61.5-25.5q35.92 0 61.42 25.58t25.5 61.5q0 35.92-25.58 61.42t-61.5 25.5Zm.16 233q-35.92 0-61.5-25.58T80-247.08Q80-283 105.58-308t61.5-25Q203-333 228-308t25 60.92q0 35.92-25 61.5T167.08-160Z"),
|
||||
("lyrics", "M270-410h100q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H270q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5Zm489.88-80Q714-490 682-522.12q-32-32.12-32-78T682.06-678q32.06-32 77.86-32 10.08 0 22.58 3 12.5 3 27.5 8v-191q0-12.75 8.63-21.38Q827.25-920 840-920h90q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-60v260q0 45.83-32.12 77.92-32.12 32.08-78 32.08ZM270-530h220q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H270q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5Zm0-120h220q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H270q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5Zm350 410H240L131-131q-5 5-10.5 7t-10.83 2Q99-122 89.5-130q-9.5-8-9.5-22v-668q0-24.75 17.63-42.38Q115.25-880 140-880h480q24.75 0 42.38 17.62Q680-844.75 680-820v59q-17 9-32.36 21-15.35 12-27.64 27v-107H140v596l74-76h406v-187q12.29 15 27.64 27Q663-448 680-439v139q0 24.75-17.62 42.37Q644.75-240 620-240Zm-480-60v-520 520Z"),
|
||||
("menu", "M150-240q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-210q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-210q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("mic", "M408-453.92q-29-30.91-29-75.08v-251q0-41.67 29.44-70.83Q437.88-880 479.94-880t71.56 29.17Q581-821.67 581-780v251q0 44.17-29 75.08Q523-423 480-423t-72-30.92ZM480-651Zm-30 501v-106q-96-11-166.5-77.5T202-498q-2-12.85 6.59-21.93 8.6-9.07 21.5-9.07 12.91 0 21.41 9t10.5 22q12 81 74.71 132.5Q399.42-314 479.65-314q81.35 0 143.85-51.5T698-498q2-13 10.68-22 8.67-9 21.5-9 12.82 0 21.32 9.07 8.5 9.08 6.5 21.93-11 97-81 164t-167 78v106q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37Zm59.5-346.5Q521-510 521-529v-251q0-17-11.79-28.5T480-820q-17.42 0-29.21 11.5T439-780v251q0 19 11.5 32.5T480-483q18 0 29.5-13.5Z"),
|
||||
("more_vert", "M479.86-160Q460-160 446-174.14t-14-34Q432-228 446.14-242t34-14Q500-256 514-241.86t14 34Q528-188 513.86-174t-34 14Zm0-272Q460-432 446-446.14t-14-34Q432-500 446.14-514t34-14Q500-528 514-513.86t14 34Q528-460 513.86-446t-34 14Zm0-272Q460-704 446-718.14t-14-34Q432-772 446.14-786t34-14Q500-800 514-785.86t14 34Q528-732 513.86-718t-34 14Z"),
|
||||
("music_note", "M286.5-163.5Q243-207 243-270t43.5-106.5Q330-420 393-420q28 0 50.5 8t39.5 22v-420q0-13 8.5-21.5T513-840h174q13 0 21.5 8.5T717-810v75q0 13-8.5 21.5T687-705H543v435q0 63-43.5 106.5T393-120q-63 0-106.5-43.5Z"),
|
||||
("my_location", "M450-72v-45q-137-14-228-105T117-450H72q-13 0-21.5-8.5T42-480q0-13 8.5-21.5T72-510h45q14-137 105-228t228-105v-45q0-13 8.5-21.5T480-918q13 0 21.5 8.5T510-888v45q137 14 228 105t105 228h45q13 0 21.5 8.5T918-480q0 13-8.5 21.5T888-450h-45q-14 137-105 228T510-117v45q0 13-8.5 21.5T480-42q-13 0-21.5-8.5T450-72Zm244.5-193.5Q784-355 784-480t-89.5-214.5Q605-784 480-784t-214.5 89.5Q176-605 176-480t89.5 214.5Q355-176 480-176t214.5-89.5Zm-321-108Q330-417 330-480t43.5-106.5Q417-630 480-630t106.5 43.5Q630-543 630-480t-43.5 106.5Q543-330 480-330t-106.5-43.5ZM544-416q26-26 26-64t-26-64q-26-26-64-26t-64 26q-26 26-26 64t26 64q26 26 64 26t64-26Zm-64-64Z"),
|
||||
("open_in_full", "M150-120q-12.75 0-21.37-8.63Q120-137.25 120-150v-240q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v168l558-558H570q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h240q12.75 0 21.38 8.62Q840-822.75 840-810v240q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-168L222-180h168q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("palette", "M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-85 32-158t87.5-127q55.5-54 130-84.5T489-880q79 0 150 26.5T763.5-780q53.5 47 85 111.5T880-527q0 108-63 170.5T650-294h-75q-18 0-31 14t-13 31q0 27 14.5 46t14.5 44q0 38-21 58.5T480-80Zm0-400Zm-198 11q15-15 15-35t-15-35q-15-15-35-15t-35 15q-15 15-15 35t15 35q15 15 35 15t35-15Zm126-170q15-15 15-35t-15-35q-15-15-35-15t-35 15q-15 15-15 35t15 35q15 15 35 15t35-15Zm214 0q15-15 15-35t-15-35q-15-15-35-15t-35 15q-15 15-15 35t15 35q15 15 35 15t35-15Zm131 170q15-15 15-35t-15-35q-15-15-35-15t-35 15q-15 15-15 35t15 35q15 15 35 15t35-15ZM480-140q11 0 15.5-4.5T500-159q0-14-14.5-26T471-238q0-46 30-81t76-35h73q76 0 123-44.5T820-527q0-132-100-212.5T489-820q-146 0-247.5 98.5T140-480q0 141 99.5 240.5T480-140Z"),
|
||||
("pause_fill", "M615-200q-24.75 0-42.37-17.63Q555-235.25 555-260v-440q0-24.75 17.63-42.38Q590.25-760 615-760h55q24.75 0 42.38 17.62Q730-724.75 730-700v440q0 24.75-17.62 42.37Q694.75-200 670-200h-55Zm-325 0q-24.75 0-42.37-17.63Q230-235.25 230-260v-440q0-24.75 17.63-42.38Q265.25-760 290-760h55q24.75 0 42.38 17.62Q405-724.75 405-700v440q0 24.75-17.62 42.37Q369.75-200 345-200h-55Z"),
|
||||
("person", "M372-523q-42-42-42-108t42-108q42-42 108-42t108 42q42 42 42 108t-42 108q-42 42-108 42t-108-42ZM160-220v-34q0-38 19-65t49-41q67-30 128.5-45T480-420q62 0 123 15.5T731-360q31 14 50 41t19 65v34q0 25-17.5 42.5T740-160H220q-25 0-42.5-17.5T160-220Zm60 0h520v-34q0-16-9.5-30.5T707-306q-64-31-117-42.5T480-360q-57 0-111 11.5T252-306q-14 7-23 21.5t-9 30.5v34Zm324.5-346.5Q570-592 570-631t-25.5-64.5Q519-721 480-721t-64.5 25.5Q390-670 390-631t25.5 64.5Q441-541 480-541t64.5-25.5ZM480-631Zm0 411Z"),
|
||||
("play_arrow", "M320-258v-450q0-14 9-22t21-8q4 0 8 1t8 3l354 226q7 5 10.5 11t3.5 14q0 8-3.5 14T720-458L366-232q-4 2-8 3t-8 1q-12 0-21-8t-9-22Zm60-225Zm0 171 269-171-269-171v342Z"),
|
||||
("play_arrow_fill", "M320-258v-450q0-14 9-22t21-8q4 0 8 1t8 3l354 226q7 5 10.5 11t3.5 14q0 8-3.5 14T720-458L366-232q-4 2-8 3t-8 1q-12 0-21-8t-9-22Z"),
|
||||
("playlist_add", "M150-330q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h240q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h410q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h410q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm508.5 491.37Q650-177.25 650-190v-140H510q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140v-140q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v140h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H710v140q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63Z"),
|
||||
("playlist_play", "M150-330q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h246q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h413q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h413q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm536 522q-4 3-8 3.5t-8-1.5q-4-2-6-5.6-2-3.6-2-8.4v-262q0-4.8 2-8.4 2-3.6 6-5.6 4-2 8-1.5t8 3.5l178 131q3.33 2 4.67 5 1.33 3 1.33 7t-1.33 7q-1.34 3-4.67 5L686-138Z"),
|
||||
("podcasts", "M450-110v-296q-22-9-36-29t-14-45q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 25-14 45t-36 29v296q0 13-8.5 21.5T480-80q-13 0-21.5-8.5T450-110ZM226-212q-9 9-22.5 9T182-213q-48-54-75-121.5T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 78-27 145.5T778-213q-8 10-21.5 10.5T734-211q-9-9-8-22t10-23q40-45 62-102t22-122q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 65 22 122t62 102q9 10 10 22.5t-8 21.5Zm113-113q-9 9-22 9t-21-10q-26-32-41-70.5T240-480q0-100 70-170t170-70q100 0 170 70t70 170q0 45-15 83.5T664-326q-8 10-20.5 10.5T622-324q-9-9-9-22t8-23q18-23 28.5-51t10.5-60q0-75-52.5-127.5T480-660q-75 0-127.5 52.5T300-480q0 32 10.5 60t28.5 51q8 10 8.5 22.5T339-325Z"),
|
||||
("queue_music", "M642.94-160q-47.94 0-81.44-33.56t-33.5-81.5q0-47.94 32.67-81.44Q593.33-390 640-390q15.97 0 30.48 3Q685-384 698-377v-308q0-14.88 10.35-24.94T734-720h111q14.88 0 24.94 10.29t10.06 25.5Q880-669 869.94-659T845-649h-87v375q0 47.5-33.56 80.75T642.94-160ZM150-320q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h246q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h413q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h413q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("queue_play_next", "M868-230 768-330q-10-9.96-10-22.98t9.97-23.02q9.96-10 23-10Q804-386 814-376l126 125q9 9 9 21t-9 21L814-83q-9.96 10-22.98 10T768-83.18q-10-10.19-10-23.5Q758-120 768-130l100-100ZM360-120q-12.75 0-21.37-8.63Q330-137.25 330-150v-50H140q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v267q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-267H140v520h516q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-26v50q0 12.75-8.62 21.37Q612.75-120 600-120H360Zm89-379v100q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63 12.82 0 21.32-8.63 8.5-8.62 8.5-21.37v-100h100q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H509v-100q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v100H349q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5h100ZM140-260v-520 520Z"),
|
||||
("radio", "M140-80q-24 0-42-18t-18-42v-511q0-22 15-38.5t35-24.5l471-190q10.59-5 20.79-.5Q632-900 636-889t-.18 21.12Q631.64-857.75 621-854L286-720h534q24 0 42 18t18 42v520q0 24-18 42t-42 18H140Zm0-60h680v-310H140v310Zm248-91.18q28-28.19 28-69Q416-341 387.82-369q-28.19-28-69-28Q278-397 250-368.82q-28 28.19-28 69Q222-259 250.18-231q28.19 28 69 28Q360-203 388-231.18ZM140-510h520v-30.18q0-12.82 8.68-21.32 8.67-8.5 21.5-8.5 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v30h100v-150H140v150Zm0 370v-310 310Z"),
|
||||
("redo", "M686-584H391q-70 0-120.5 46.5T220-422q0 69 50.5 115.5T391-260h280q13 0 21.5 8.5T701-230q0 13-8.5 21.5T671-200H392q-95 0-163.5-64T160-422q0-94 68.5-158T392-644h294l-93-93q-9-9-9-21t9-21q9-9 21-9t21 9l144 144q5 5 7 10t2 11q0 6-2 11t-7 10L635-449q-9 9-21 9t-21-9q-9-9-9-21t9-21l93-93Z"),
|
||||
("refresh", "M480-160q-133 0-226.5-93.5T160-480q0-133 93.5-226.5T480-800q85 0 149 34.5T740-671v-99q0-13 8.5-21.5T770-800q13 0 21.5 8.5T800-770v194q0 13-8.5 21.5T770-546H576q-13 0-21.5-8.5T546-576q0-13 8.5-21.5T576-606h138q-38-60-97-97t-137-37q-109 0-184.5 75.5T220-480q0 109 75.5 184.5T480-220q75 0 140-39.5T717-366q5-11 16.5-16.5t22.5-.5q12 5 16 16.5t-1 23.5q-39 84-117.5 133.5T480-160Z"),
|
||||
("repeat", "m236-210 65 65q9 9 8.5 21t-8.75 21.12q-9 9.12-21.37 9.5Q267-93 258-102L141-219q-5-5-7-10.13-2-5.14-2-11 0-5.87 2-10.87 2-5 7-10l117-117q9.07-9 21.53-8.5Q292-386 301-377q8.25 9 8.63 21 .37 12-8.63 21l-65 65h464v-130q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v130q0 24.75-17.62 42.37Q724.75-210 700-210H236Zm488-480H260v130q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-130q0-24.75 17.63-42.38Q235.25-750 260-750h464l-65-65q-9-9-8.5-21t8.75-21.12q9-9.12 21.38-9.5Q693-867 702-858l117 117q5 5 7 10.13 2 5.14 2 11 0 5.87-2 10.87-2 5-7 10L702-582q-9.07 9-21.53 8.5Q668-574 659-583q-8.25-9-8.62-21-.38-12 8.62-21l65-65Z"),
|
||||
("repeat_one", "M466-551h-32q-10.4 0-17.2-7.12-6.8-7.11-6.8-18 0-10.88 7.08-17.38 7.09-6.5 17.92-6.5h50q12.75 0 21.38 8.62Q515-582.75 515-570v184q0 10.4-6.5 17.2-6.5 6.8-17.38 6.8-10.89 0-18-7.08Q466-376.17 466-387v-164ZM236-210l65 65q9 9 8.5 21t-8.75 21.12q-9 9.12-21.37 9.5Q267-93 258-102L141-219q-5-5-7-10.13-2-5.14-2-11 0-5.87 2-10.87 2-5 7-10l117-117q9.07-9 21.53-8.5Q292-386 301-377q8.25 9 8.63 21 .37 12-8.63 21l-65 65h464v-130q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v130q0 24.75-17.62 42.37Q724.75-210 700-210H236Zm488-480H260v130q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-130q0-24.75 17.63-42.38Q235.25-750 260-750h464l-65-65q-9-9-8.5-21t8.75-21.12q9-9.12 21.38-9.5Q693-867 702-858l117 117q5 5 7 10.13 2 5.14 2 11 0 5.87-2 10.87-2 5-7 10L702-582q-9.07 9-21.53 8.5Q668-574 659-583q-8.25-9-8.62-21-.38-12 8.62-21l65-65Z"),
|
||||
("save", "M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h478q12.44 0 23.72 5T701-822l121 121q8 8 13 19.28 5 11.28 5 23.72v478q0 24-18 42t-42 18H180Zm600-536L656-780H180v600h600v-476ZM553.5-275.26q30.5-30.27 30.5-73.5 0-43.24-30.26-73.74-30.27-30.5-73.5-30.5-43.24 0-73.74 30.26-30.5 30.27-30.5 73.5 0 43.24 30.26 73.74 30.27 30.5 73.5 30.5 43.24 0 73.74-30.26ZM263-584h298q12.75 0 21.38-8.63Q591-601.25 591-614v-83q0-12.75-8.62-21.38Q573.75-727 561-727H263q-12.75 0-21.37 8.62Q233-709.75 233-697v83q0 12.75 8.63 21.37Q250.25-584 263-584Zm-83-72v476-600 124Z"),
|
||||
("scrobble", "m450-478-62 62q-9 9-21.1 9-12.1 0-20.9-9-9-9-9-21.5t9-21.5l113-114q9-9 21-9t21 9l114 114q9 9 9 21t-9 21q-9 9-21.5 9t-21.5-9l-62-61v258h241q45 0 77-32t32-77q0-45-32-77t-77-32h-63v-84q0-89-60.5-153T478-739q-89 0-150 64t-61 153h-19q-62 0-105 43.5T100-371q0 62 43.93 106.5T250-220h110q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H250q-86 0-148-62T40-370q0-78 49.5-137.5T217-579q20-97 94-158.5T482-799q113 0 189.5 81.5T748-522v24q72-2 122 46.5T920-329q0 69-50 119t-119 50H510q-24 0-42-18t-18-42v-258Zm30 28Z"),
|
||||
("search", "M378-329q-108.16 0-183.08-75Q120-479 120-585t75-181q75-75 181.5-75t181 75Q632-691 632-584.85 632-542 618-502q-14 40-42 75l242 240q9 8.56 9 21.78T818-143q-9 9-22.22 9-13.22 0-21.78-9L533-384q-30 26-69.96 40.5Q423.08-329 378-329Zm-1-60q81.25 0 138.13-57.5Q572-504 572-585t-56.87-138.5Q458.25-781 377-781q-82.08 0-139.54 57.5Q180-666 180-585t57.46 138.5Q294.92-389 377-389Z"),
|
||||
("settings", "M421-80q-14 0-25-9t-13-23l-15-94q-19-7-40-19t-37-25l-86 40q-14 6-28 1.5T155-226L97-330q-8-13-4.5-27t15.5-23l80-59q-2-9-2.5-20.5T185-480q0-9 .5-20.5T188-521l-80-59q-12-9-15.5-23t4.5-27l58-104q8-13 22-17.5t28 1.5l86 40q16-13 37-25t40-18l15-95q2-14 13-23t25-9h118q14 0 25 9t13 23l15 94q19 7 40.5 18.5T669-710l86-40q14-6 27.5-1.5T804-734l59 104q8 13 4.5 27.5T852-580l-80 57q2 10 2.5 21.5t.5 21.5q0 10-.5 21t-2.5 21l80 58q12 8 15.5 22.5T863-330l-58 104q-8 13-22 17.5t-28-1.5l-86-40q-16 13-36.5 25.5T592-206l-15 94q-2 14-13 23t-25 9H421Zm15-60h88l14-112q33-8 62.5-25t53.5-41l106 46 40-72-94-69q4-17 6.5-33.5T715-480q0-17-2-33.5t-7-33.5l94-69-40-72-106 46q-23-26-52-43.5T538-708l-14-112h-88l-14 112q-34 7-63.5 24T306-642l-106-46-40 72 94 69q-4 17-6.5 33.5T245-480q0 17 2.5 33.5T254-413l-94 69 40 72 106-46q24 24 53.5 41t62.5 25l14 112Zm44-210q54 0 92-38t38-92q0-54-38-92t-92-38q-54 0-92 38t-38 92q0 54 38 92t92 38Zm0-130Z"),
|
||||
("shuffle", "M606-160q-13 0-21.5-8.5T576-190q0-13 8.5-21.5T606-220h90L543-372q-9-9-9-21t9-21q9-9 21.5-9.5T586-415l154 153v-91q0-13 8.5-21.5T770-383q13 0 21.5 8.5T800-353v163q0 13-8.5 21.5T770-160H606Zm-436-10q-9-9-9-21t9-21l528-528h-92q-13 0-21.5-8.5T576-770q0-13 8.5-21.5T606-800h164q13 0 21.5 8.5T800-770v163q0 13-8.5 21.5T770-577q-13 0-21.5-8.5T740-607v-90L212-169q-9 9-21 8.5t-21-9.5Zm-1-579q-9-9-9-21.5t9-21.5q9-9 21-9t21 9l205 205q9 9 9.5 21t-8.5 21q-9 9-21.5 9t-21.5-9L169-749Z"),
|
||||
("skip_next", "M680-270v-420q0-13 8.5-21.5T710-720q13 0 21.5 8.5T740-690v420q0 13-8.5 21.5T710-240q-13 0-21.5-8.5T680-270Zm-460-27v-366q0-14 9-22t21-8q5 0 9 1.5t8 4.5l263 182q7 5 10 11.5t3 13.5q0 7-3 13.5T530-455L267-273q-4 3-8 4.5t-9 1.5q-12 0-21-8t-9-22Zm60-183Zm0 125 181-125-181-125v250Z"),
|
||||
("skip_next_fill", "M680-270v-420q0-13 8.5-21.5T710-720q13 0 21.5 8.5T740-690v420q0 13-8.5 21.5T710-240q-13 0-21.5-8.5T680-270Zm-460-27v-366q0-14 9-22t21-8q5 0 9 1.5t8 4.5l263 182q7 5 10 11.5t3 13.5q0 7-3 13.5T530-455L267-273q-4 3-8 4.5t-9 1.5q-12 0-21-8t-9-22Z"),
|
||||
("skip_previous_fill", "M220-270v-420q0-13 8.5-21.5T250-720q13 0 21.5 8.5T280-690v420q0 13-8.5 21.5T250-240q-13 0-21.5-8.5T220-270Zm473-3L430-455q-7-5-10-11.5t-3-13.5q0-7 3-13.5t10-11.5l263-182q4-3 8-4.5t9-1.5q12 0 21 8t9 22v366q0 14-9 22t-21 8q-5 0-9-1.5t-8-4.5Z"),
|
||||
("sort", "M150-240q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h180q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-210q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-210q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("star", "m323-245 157-94 157 95-42-178 138-120-182-16-71-168-71 167-182 16 138 120-42 178Zm157-24L294-157q-8 5-17 4.5t-16-5.5q-7-5-10.5-13t-1.5-18l49-212-164-143q-8-7-9.5-15.5t.5-16.5q2-8 9-13.5t17-6.5l217-19 84-200q4-9 12-13.5t16-4.5q8 0 16 4.5t12 13.5l84 200 217 19q10 1 17 6.5t9 13.5q2 8 .5 16.5T826-544L662-401l49 212q2 10-1.5 18T699-158q-7 5-16 5.5t-17-4.5L480-269Zm0-206Z"),
|
||||
("star_fill", "M480-269 294-157q-8 5-17 4.5t-16-5.5q-7-5-10.5-13t-1.5-18l49-212-164-143q-8-7-9.5-15.5t.5-16.5q2-8 9-13.5t17-6.5l217-19 84-200q4-9 12-13.5t16-4.5q8 0 16 4.5t12 13.5l84 200 217 19q10 1 17 6.5t9 13.5q2 8 .5 16.5T826-544L662-401l49 212q2 10-1.5 18T699-158q-7 5-16 5.5t-17-4.5L480-269Z"),
|
||||
("stop_circle", "M360-330h240q12.75 0 21.38-8.63Q630-347.25 630-360v-240q0-12.75-8.62-21.38Q612.75-630 600-630H360q-12.75 0-21.37 8.62Q330-612.75 330-600v240q0 12.75 8.63 21.37Q347.25-330 360-330ZM480.27-80q-82.74 0-155.5-31.5Q252-143 197.5-197.5t-86-127.34Q80-397.68 80-480.5t31.5-155.66Q143-709 197.5-763t127.34-85.5Q397.68-880 480.5-880t155.66 31.5Q709-817 763-763t85.5 127Q880-563 880-480.27q0 82.74-31.5 155.5Q817-252 763-197.68q-54 54.31-127 86Q563-80 480.27-80Zm.23-60Q622-140 721-239.5t99-241Q820-622 721.19-721T480-820q-141 0-240.5 98.81T140-480q0 141 99.5 240.5t241 99.5Zm-.5-340Z"),
|
||||
("stop_fill", "M240-300v-360q0-24.75 17.63-42.38Q275.25-720 300-720h360q24.75 0 42.38 17.62Q720-684.75 720-660v360q0 24.75-17.62 42.37Q684.75-240 660-240H300q-24.75 0-42.37-17.63Q240-275.25 240-300Z"),
|
||||
("sync", "M220-477q0 63 23.5 109.5T307-287l30 21v-94q0-13 8.5-21.5T367-390q13 0 21.5 8.5T397-360v170q0 13-8.5 21.5T367-160H197q-13 0-21.5-8.5T167-190q0-13 8.5-21.5T197-220h100l-15-12q-64-51-93-111t-29-134q0-94 49.5-171.5T342-766q11-5 21 0t14 16q5 11 0 22.5T361-710q-64 34-102.5 96.5T220-477Zm520-6q0-48-23.5-97.5T655-668l-29-26v94q0 13-8.5 21.5T596-570q-13 0-21.5-8.5T566-600v-170q0-13 8.5-21.5T596-800h170q13 0 21.5 8.5T796-770q0 13-8.5 21.5T766-740H665l15 14q60 56 90 120t30 123q0 93-48 169.5T623-195q-11 6-22.5 1.5T584-210q-5-11 0-22.5t16-17.5q65-33 102.5-96T740-483Z"),
|
||||
("text_snippet", "M180-180h600v-375L555-780H180v600Zm0 60q-24.75 0-42.37-17.63Q120-155.25 120-180v-600q0-24.75 17.63-42.38Q155.25-840 180-840h375q12.44 0 23.72 5T598-822l224 224q8 8 13 19.28 5 11.28 5 23.72v375q0 24.75-17.62 42.37Q804.75-120 780-120H180Zm129-171h342q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H309q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5Zm0-159h342q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H309q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5Zm0-159h216q12.75 0 21.38-8.68 8.62-8.67 8.62-21.5 0-12.82-8.62-21.32-8.63-8.5-21.38-8.5H309q-12.75 0-21.37 8.68-8.63 8.67-8.63 21.5 0 12.82 8.63 21.32 8.62 8.5 21.37 8.5ZM180-180v-600 600Z"),
|
||||
("travel_explore", "M80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q137 0 241.5 80T863-595q4 13-2 24.5T842-556q-12 3-22-4.5T806-580q-22-74-74-131.5T607-799v18q0 35-24 61t-59 26h-87v87q0 17-13.5 28T393-568h-83v88h80q13 0 21.5 8.5T420-450v95h-67L149-559q-5 20-7 39.5t-2 39.5q0 128 82.5 223.5T431-144q12 2 19.5 11.5T458-111q0 13-9 21t-22 6q-148-20-247.5-131.5T80-480Zm749 351L716-241q-21 15-45.5 23t-50.5 8q-71 0-120.5-49.5T450-380q0-71 49.5-120.5T620-550q71 0 120.5 49.5T790-380q0 26-8.5 50.5T759-283l112 112q9 9 9.5 21t-8.5 21q-9 9-21.5 9t-21.5-9ZM698-302q32-32 32-78t-32-78q-32-32-78-32t-78 32q-32 32-32 78t32 78q32 32 78 32t78-32Z"),
|
||||
("trending_up", "M102-252q-9-9-9-21.5t9-21.5l228-227q16.93-17 41.97-17Q397-539 414-522l125 125 241-241h-97q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h167q12.75 0 21.38 8.62Q880-680.75 880-668v167q0 12-8.27 21t-20.5 9Q839-471 830-480t-9-21v-93L580-354q-16.93 17-41.97 17Q513-337 496-354L371-478 145-252q-9 9-21.5 9t-21.5-9Z"),
|
||||
("tune", "M435.5-128.63Q427-137.25 427-150v-165q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v53h323q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H487v52q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63ZM150-202q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h187q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm165.5-174.63Q307-385.25 307-398v-52H150q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h157v-54q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v166q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63ZM457-450q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h353q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H457Zm144.5-173.63Q593-632.25 593-645v-165q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v52h157q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H653v53q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63ZM150-698q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h353q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z"),
|
||||
("undo", "M289-200q-13 0-21.5-8.5T259-230q0-13 8.5-21.5T289-260h280q70 0 120.5-46.5T740-422q0-69-50.5-115.5T569-584H274l93 93q9 9 9 21t-9 21q-9 9-21 9t-21-9L181-593q-5-5-7-10t-2-11q0-6 2-11t7-10l144-144q9-9 21-9t21 9q9 9 9 21t-9 21l-93 93h294q95 0 163.5 64T800-422q0 94-68.5 158T568-200H289Z"),
|
||||
("upload", "M220-160q-24 0-42-18t-18-42v-113q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v113h520v-113q0-12.75 8.68-21.38 8.67-8.62 21.5-8.62 12.82 0 21.32 8.62 8.5 8.63 8.5 21.38v113q0 24-18 42t-42 18H220Zm230-524-99 99q-8.8 9-20.9 8.5-12.1-.5-21.49-9.5-8.61-9-8.61-21.5t9-21.5l150-150q5-5 10.13-7 5.14-2 11-2 5.87 0 10.87 2 5 2 10 7l151 151q9 9 9 21t-8.61 21q-9.39 9-21.89 9t-21.5-9l-99-98v341q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-341Z"),
|
||||
("visibility", "M600.5-379.62q49.5-49.62 49.5-120.5T600.38-620.5Q550.76-670 479.88-670T359.5-620.38Q310-570.76 310-499.88t49.62 120.38q49.62 49.5 120.5 49.5t120.38-49.62Zm-200-41.12q-32.5-32.73-32.5-79.5 0-46.76 32.74-79.26 32.73-32.5 79.5-32.5 46.76 0 79.26 32.74 32.5 32.73 32.5 79.5 0 46.76-32.74 79.26-32.73 32.5-79.5 32.5-46.76 0-79.26-32.74ZM234.5-276Q124-352 57-470q-4-7.13-6-14.65-2-7.52-2-15.43 0-7.92 2-15.38 2-7.47 6-14.54 67-118 177.5-194T480-800q135 0 245.5 76T903-530q4 7.12 6 14.65 2 7.52 2 15.43 0 7.92-2 15.38-2 7.47-6 14.54-67 118-177.5 194T480-200q-135 0-245.5-76ZM480-500Zm222.5 174.5Q804-391 857-500q-53-109-154.33-174.5Q601.34-740 480.17-740T257.5-674.5Q156-609 102-500q54 109 155.33 174.5Q358.66-260 479.83-260t222.67-65.5Z"),
|
||||
("volume_down", "M360-360H230q-13 0-21.5-8.5T200-390v-180q0-13 8.5-21.5T230-600h130l149-149q14-14 32.5-6.5T560-728v496q0 20-18.5 27.5T509-211L360-360Zm380-120q0 52-26 94t-73 64q-8 4-14.5-1t-6.5-13v-289q0-8 6.5-13t14.5-1q47 22 73 65t26 94ZM500-648 387-540H260v120h127l113 109v-337ZM378-480Z"),
|
||||
("volume_off", "M681-188q-17 12-35.5 22T607-148q-12 5-24.5 0T565-165q-5-11 .5-22t17.5-16q15-5 28.5-12t26.5-17L473-397v165q0 20-18.5 27.5T422-211L273-360H143q-13 0-21.5-8.5T113-390v-180q0-13 8.5-21.5T143-600h126L70-799q-9-9-8.5-21.5T71-842q9-9 21.5-9t21.5 9l721 721q9 9 9 21.5T835-78q-9 9-22 9t-22-9L681-188Zm92-293q0-93-52.5-168.5T583-759q-12-5-17-16t0-22q5-12 17.5-16.5t25.5.5q101 41 162.5 130.5T833-481q0 38-7.5 75T802-334q-8 17-19.5 20.5T760-315q-11-5-16.5-14.5t.5-20.5q15-30 22-63t7-68ZM576-628q38 23 57.5 63.5T653-480v15q0 7-2 15-2 10-11 13t-17-5l-61-61q-5-5-7-10t-2-11v-91q0-9 7.5-13.5t15.5.5Zm-196-57q-5-5-5-11t5-11l42-42q14-14 32.5-6.5T473-728v100q0 10-9.5 13.5T447-618l-67-67Zm33 379v-150l-84-84H173v120h126l114 114Zm-42-192Z"),
|
||||
("volume_up", "M780-481q0-94-52.5-169T590-759q-12-5-17-16t0-22q5-12 17.5-16.5t25.5.5q101 41 162.5 131T840-481q0 111-61.5 201T616-149q-13 5-25.5.5T573-165q-5-11 0-22t17-16q85-34 137.5-109T780-481ZM280-360H150q-13 0-21.5-8.5T120-390v-180q0-13 8.5-21.5T150-600h130l149-149q14-14 32.5-6.5T480-728v496q0 20-18.5 27.5T429-211L280-360Zm380-120q0 52-26 94t-73 64q-8 4-14.5-1t-6.5-13v-289q0-8 6.5-13t14.5-1q47 22 73 65t26 94ZM420-648 307-540H180v120h127l113 109v-337ZM298-480Z"),
|
||||
];
|
||||
35
src/instance.rs
Normal file
35
src/instance.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//! Single instance: opening files from the file manager hands them to the running player.
|
||||
|
||||
use crate::bus::{Bus, Msg};
|
||||
use std::io::{Read, Write};
|
||||
use std::os::unix::net::{UnixListener, UnixStream};
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn sock_path() -> PathBuf {
|
||||
let dir = std::env::var_os("XDG_RUNTIME_DIR").map(PathBuf::from).unwrap_or_else(std::env::temp_dir);
|
||||
dir.join("mulberry.sock")
|
||||
}
|
||||
|
||||
/// If another instance is running, pass it our arguments and return true.
|
||||
pub fn forward(args: &[String]) -> bool {
|
||||
let Ok(mut s) = UnixStream::connect(sock_path()) else { return false };
|
||||
let msg = if args.is_empty() { "\u{1}raise".to_string() } else { args.join("\n") };
|
||||
s.write_all(msg.as_bytes()).is_ok()
|
||||
}
|
||||
|
||||
pub fn serve(bus: Bus) {
|
||||
let path = sock_path();
|
||||
let _ = std::fs::remove_file(&path);
|
||||
let Ok(l) = UnixListener::bind(&path) else { return };
|
||||
std::thread::spawn(move || {
|
||||
for mut conn in l.incoming().flatten() {
|
||||
let mut buf = String::new();
|
||||
let _ = conn.read_to_string(&mut buf);
|
||||
if buf == "\u{1}raise" {
|
||||
bus.send(Msg::Raise);
|
||||
} else {
|
||||
bus.send(Msg::OpenArgs(buf.lines().map(String::from).filter(|l| !l.is_empty()).collect()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
28
src/lib.rs
Normal file
28
src/lib.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
pub mod app;
|
||||
pub mod bus;
|
||||
pub mod cd;
|
||||
pub mod config;
|
||||
pub mod icondata;
|
||||
pub mod instance;
|
||||
pub mod library;
|
||||
pub mod mpris;
|
||||
pub mod nowplaying;
|
||||
pub mod online;
|
||||
pub mod player;
|
||||
pub mod playlist;
|
||||
pub mod playlistio;
|
||||
pub mod scrobble;
|
||||
pub mod song;
|
||||
pub mod spectrum;
|
||||
pub mod tags;
|
||||
pub mod theme;
|
||||
pub mod tray;
|
||||
pub mod ui;
|
||||
pub mod util;
|
||||
|
||||
|
||||
pub fn fonts_setup(ctx: &eframe::egui::Context) {
|
||||
// a missing glyph (rare script, odd symbol in a tag) must never take the player down
|
||||
ctx.set_missing_glyph_policy(eframe::epaint::text::MissingGlyphPolicy::Tofu);
|
||||
ui::fonts::install(ctx, &config::settings().get_str("appearance/font"));
|
||||
}
|
||||
618
src/library.rs
Normal file
618
src/library.rs
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
//! SQLite-backed music collection with an incremental background scanner.
|
||||
//! The schema is the same as the Python version's, so an existing library.db keeps working.
|
||||
|
||||
use crate::bus::{Bus, Msg};
|
||||
use crate::config::{ext_of, settings, AUDIO_EXTS, PATHS};
|
||||
use crate::song::Song;
|
||||
use crate::tags;
|
||||
use rusqlite::types::Value;
|
||||
use rusqlite::{params_from_iter, Connection, Row};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub const SONG_COLS: &[&str] = &[
|
||||
"url", "title", "artist", "album", "albumartist", "genre", "composer", "comment", "year", "track", "disc", "length",
|
||||
"bitrate", "samplerate", "bitdepth", "channels", "filetype", "filesize", "mtime", "art", "playcount", "skipcount",
|
||||
"lastplayed", "rating", "added", "rg_track", "rg_album", "mb_trackid", "mb_albumid",
|
||||
];
|
||||
|
||||
const SCHEMA: &str = "
|
||||
CREATE TABLE IF NOT EXISTS songs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
url TEXT UNIQUE NOT NULL, title TEXT, artist TEXT, album TEXT, albumartist TEXT,
|
||||
genre TEXT, composer TEXT, comment TEXT, year INTEGER, track INTEGER, disc INTEGER,
|
||||
length REAL, bitrate INTEGER, samplerate INTEGER, bitdepth INTEGER, channels INTEGER,
|
||||
filetype TEXT, filesize INTEGER, mtime REAL, art TEXT, playcount INTEGER DEFAULT 0,
|
||||
skipcount INTEGER DEFAULT 0, lastplayed INTEGER DEFAULT 0, rating INTEGER DEFAULT 0,
|
||||
added INTEGER, rg_track REAL, rg_album REAL, mb_trackid TEXT, mb_albumid TEXT,
|
||||
unavailable INTEGER DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_songs_aa ON songs(albumartist, album);
|
||||
CREATE INDEX IF NOT EXISTS idx_songs_artist ON songs(artist);
|
||||
CREATE INDEX IF NOT EXISTS idx_songs_genre ON songs(genre);
|
||||
CREATE TABLE IF NOT EXISTS playlists (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, ui_order INTEGER DEFAULT 0,
|
||||
is_open INTEGER DEFAULT 1, favorite INTEGER DEFAULT 0, current INTEGER DEFAULT -1,
|
||||
items TEXT DEFAULT '[]'
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS lyrics (key TEXT PRIMARY KEY, text TEXT, source TEXT, fetched INTEGER);
|
||||
CREATE TABLE IF NOT EXISTS radio (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, url TEXT, ui_order INTEGER DEFAULT 0);
|
||||
CREATE TABLE IF NOT EXISTS kv (k TEXT PRIMARY KEY, v TEXT);
|
||||
";
|
||||
|
||||
pub const DEFAULT_RADIO: &[(&str, &str)] = &[
|
||||
("SomaFM · Groove Salad", "https://ice1.somafm.com/groovesalad-128-mp3"),
|
||||
("SomaFM · Drone Zone", "https://ice1.somafm.com/dronezone-128-mp3"),
|
||||
("SomaFM · Indie Pop Rocks", "https://ice1.somafm.com/indiepop-128-mp3"),
|
||||
("SomaFM · Metal Detector", "https://ice1.somafm.com/metal-128-mp3"),
|
||||
("Radio Paradise · Main Mix", "https://stream.radioparadise.com/aac-320"),
|
||||
("Radio Paradise · Rock Mix", "https://stream.radioparadise.com/rock-320"),
|
||||
("KEXP 90.3 Seattle", "https://kexp.streamguys1.com/kexp160.aac"),
|
||||
];
|
||||
|
||||
pub fn connect() -> Connection {
|
||||
let con = Connection::open(&PATHS.db).expect("open library.db");
|
||||
let _ = con.busy_timeout(std::time::Duration::from_secs(30));
|
||||
let _ = con.execute_batch("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL; PRAGMA temp_store=MEMORY;");
|
||||
con
|
||||
}
|
||||
|
||||
fn s(row: &Row, i: usize) -> String {
|
||||
row.get::<_, Option<String>>(i).ok().flatten().unwrap_or_default()
|
||||
}
|
||||
fn n(row: &Row, i: usize) -> i64 {
|
||||
row.get::<_, Option<i64>>(i).ok().flatten().unwrap_or(0)
|
||||
}
|
||||
fn f(row: &Row, i: usize) -> f64 {
|
||||
row.get::<_, Option<f64>>(i).ok().flatten().unwrap_or(0.0)
|
||||
}
|
||||
|
||||
/// `SELECT *`-style row (id first, then SONG_COLS) to a Song.
|
||||
pub fn row_to_song(r: &Row) -> Song {
|
||||
let mut x = Song::new("");
|
||||
x.id = n(r, 0);
|
||||
x.url = s(r, 1);
|
||||
x.title = s(r, 2);
|
||||
x.artist = s(r, 3);
|
||||
x.album = s(r, 4);
|
||||
x.albumartist = s(r, 5);
|
||||
x.genre = s(r, 6);
|
||||
x.composer = s(r, 7);
|
||||
x.comment = s(r, 8);
|
||||
x.year = n(r, 9);
|
||||
x.track = n(r, 10);
|
||||
x.disc = n(r, 11);
|
||||
x.length = f(r, 12);
|
||||
x.bitrate = n(r, 13);
|
||||
x.samplerate = n(r, 14);
|
||||
x.bitdepth = n(r, 15);
|
||||
x.channels = n(r, 16);
|
||||
x.filetype = s(r, 17);
|
||||
x.filesize = n(r, 18);
|
||||
x.mtime = f(r, 19);
|
||||
x.art = s(r, 20);
|
||||
x.playcount = n(r, 21);
|
||||
x.skipcount = n(r, 22);
|
||||
x.lastplayed = n(r, 23);
|
||||
x.rating = n(r, 24);
|
||||
x.added = n(r, 25);
|
||||
x.rg_track = r.get::<_, Option<f64>>(26).ok().flatten();
|
||||
x.rg_album = r.get::<_, Option<f64>>(27).ok().flatten();
|
||||
x.mb_trackid = s(r, 28);
|
||||
x.mb_albumid = s(r, 29);
|
||||
x
|
||||
}
|
||||
|
||||
fn select_cols() -> String {
|
||||
format!("id, {}", SONG_COLS.join(", "))
|
||||
}
|
||||
|
||||
pub fn song_values(x: &Song) -> Vec<Value> {
|
||||
let t = |v: &str| Value::Text(v.to_string());
|
||||
let opt = |v: Option<f64>| v.map(Value::Real).unwrap_or(Value::Null);
|
||||
vec![
|
||||
t(&x.url), t(&x.title), t(&x.artist), t(&x.album), t(&x.albumartist), t(&x.genre), t(&x.composer),
|
||||
t(&x.comment), Value::Integer(x.year), Value::Integer(x.track), Value::Integer(x.disc), Value::Real(x.length),
|
||||
Value::Integer(x.bitrate), Value::Integer(x.samplerate), Value::Integer(x.bitdepth), Value::Integer(x.channels),
|
||||
t(&x.filetype), Value::Integer(x.filesize), Value::Real(x.mtime), t(&x.art), Value::Integer(x.playcount),
|
||||
Value::Integer(x.skipcount), Value::Integer(x.lastplayed), Value::Integer(x.rating), Value::Integer(x.added),
|
||||
opt(x.rg_track), opt(x.rg_album), t(&x.mb_trackid), t(&x.mb_albumid),
|
||||
]
|
||||
}
|
||||
|
||||
pub struct PlaylistRow {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
pub is_open: bool,
|
||||
pub favorite: bool,
|
||||
pub current: i64,
|
||||
pub items: String,
|
||||
}
|
||||
|
||||
pub struct Library {
|
||||
con: Mutex<Connection>,
|
||||
scanning: Arc<AtomicBool>,
|
||||
abort: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
impl Library {
|
||||
pub fn new() -> Library {
|
||||
let con = connect();
|
||||
con.execute_batch(SCHEMA).expect("create schema");
|
||||
let lib = Library { con: Mutex::new(con), scanning: Arc::new(AtomicBool::new(false)), abort: Arc::new(AtomicBool::new(false)) };
|
||||
let empty = lib.con().query_row("SELECT 1 FROM radio LIMIT 1", [], |_| Ok(())).is_err();
|
||||
if empty && lib.kv("radio_seeded").is_none() {
|
||||
let c = lib.con();
|
||||
for (i, (name, url)) in DEFAULT_RADIO.iter().enumerate() {
|
||||
let _ = c.execute("INSERT INTO radio(name,url,ui_order) VALUES (?,?,?)", rusqlite::params![name, url, i as i64]);
|
||||
}
|
||||
drop(c);
|
||||
lib.set_kv("radio_seeded", "1");
|
||||
}
|
||||
lib
|
||||
}
|
||||
|
||||
fn con(&self) -> std::sync::MutexGuard<'_, Connection> {
|
||||
self.con.lock().unwrap()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ kv
|
||||
pub fn kv(&self, k: &str) -> Option<String> {
|
||||
self.con().query_row("SELECT v FROM kv WHERE k=?", [k], |r| r.get(0)).ok()
|
||||
}
|
||||
|
||||
pub fn set_kv(&self, k: &str, v: &str) {
|
||||
let _ = self.con().execute("INSERT OR REPLACE INTO kv(k,v) VALUES (?,?)", [k, v]);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ queries
|
||||
pub fn count(&self) -> (i64, f64) {
|
||||
self.con()
|
||||
.query_row("SELECT COUNT(*), COALESCE(SUM(length),0) FROM songs WHERE unavailable=0", [], |r| Ok((r.get(0)?, r.get(1)?)))
|
||||
.unwrap_or((0, 0.0))
|
||||
}
|
||||
|
||||
pub fn query_rows<T>(&self, sql: &str, args: &[Value], map: impl FnMut(&Row) -> rusqlite::Result<T>) -> Vec<T> {
|
||||
let con = self.con();
|
||||
let Ok(mut st) = con.prepare(sql) else { return vec![] };
|
||||
let Ok(rows) = st.query_map(params_from_iter(args.iter()), map) else { return vec![] };
|
||||
rows.filter_map(|r| r.ok()).collect()
|
||||
}
|
||||
|
||||
pub fn songs_where(&self, where_: &str, args: &[Value], order: &str) -> Vec<Song> {
|
||||
let sql = format!("SELECT {} FROM songs WHERE unavailable=0 AND ({}) ORDER BY {}", select_cols(), where_, order);
|
||||
self.query_rows(&sql, args, |r| Ok(row_to_song(r)))
|
||||
}
|
||||
|
||||
pub const DEFAULT_ORDER: &'static str =
|
||||
"albumartist COLLATE NOCASE, album COLLATE NOCASE, disc, track, title";
|
||||
|
||||
pub fn songs_by_ids(&self, ids: &[i64]) -> HashMap<i64, Song> {
|
||||
let mut out = HashMap::new();
|
||||
for chunk in ids.chunks(900) {
|
||||
let q = vec!["?"; chunk.len()].join(",");
|
||||
let sql = format!("SELECT {} FROM songs WHERE id IN ({})", select_cols(), q);
|
||||
let args: Vec<Value> = chunk.iter().map(|i| Value::Integer(*i)).collect();
|
||||
for s in self.query_rows(&sql, &args, |r| Ok(row_to_song(r))) {
|
||||
out.insert(s.id, s);
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn songs_by_urls(&self, urls: &[String]) -> HashMap<String, Song> {
|
||||
let mut out = HashMap::new();
|
||||
for chunk in urls.chunks(500) {
|
||||
let q = vec!["?"; chunk.len()].join(",");
|
||||
let sql = format!("SELECT {} FROM songs WHERE url IN ({})", select_cols(), q);
|
||||
let args: Vec<Value> = chunk.iter().map(|u| Value::Text(u.clone())).collect();
|
||||
for s in self.query_rows(&sql, &args, |r| Ok(row_to_song(r))) {
|
||||
out.insert(s.url.clone(), s);
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn song_by_url(&self, url: &str) -> Option<Song> {
|
||||
self.songs_by_urls(&[url.to_string()]).remove(url)
|
||||
}
|
||||
|
||||
/// WHERE clause for a search string. Supports field:value tokens.
|
||||
pub fn filter_clause(text: &str) -> (String, Vec<Value>) {
|
||||
let text = text.trim();
|
||||
if text.is_empty() {
|
||||
return ("1".into(), vec![]);
|
||||
}
|
||||
let map: HashMap<&str, &str> = [
|
||||
("artist", "artist"), ("album", "album"), ("title", "title"), ("genre", "genre"), ("year", "year"),
|
||||
("albumartist", "albumartist"), ("composer", "composer"), ("type", "filetype"), ("rating", "rating"),
|
||||
]
|
||||
.into_iter()
|
||||
.collect();
|
||||
let (mut clauses, mut args) = (vec![], vec![]);
|
||||
for tok in text.split_whitespace() {
|
||||
if let Some((fld, v)) = tok.split_once(':') {
|
||||
if let (Some(col), false) = (map.get(fld.to_lowercase().as_str()), v.is_empty()) {
|
||||
if *col == "year" || *col == "rating" {
|
||||
let op = if v.starts_with('>') { ">=" } else if v.starts_with('<') { "<=" } else { "=" };
|
||||
clauses.push(format!("{col} {op} ?"));
|
||||
args.push(Value::Integer(v.trim_start_matches(['<', '>', '=']).parse().unwrap_or(0)));
|
||||
} else {
|
||||
clauses.push(format!("{col} LIKE ?"));
|
||||
args.push(Value::Text(format!("%{v}%")));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
clauses.push("(title LIKE ? OR artist LIKE ? OR album LIKE ? OR albumartist LIKE ? OR genre LIKE ? OR composer LIKE ?)".into());
|
||||
for _ in 0..6 {
|
||||
args.push(Value::Text(format!("%{tok}%")));
|
||||
}
|
||||
}
|
||||
(clauses.join(" AND "), args)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ updates
|
||||
pub fn update_fields(&self, id: i64, vals: &[(&str, Value)]) {
|
||||
if id < 0 || vals.is_empty() {
|
||||
return;
|
||||
}
|
||||
let cols = vals.iter().map(|(k, _)| format!("{k}=?")).collect::<Vec<_>>().join(", ");
|
||||
let mut args: Vec<Value> = vals.iter().map(|(_, v)| v.clone()).collect();
|
||||
args.push(Value::Integer(id));
|
||||
let _ = self.con().execute(&format!("UPDATE songs SET {cols} WHERE id=?"), params_from_iter(args.iter()));
|
||||
}
|
||||
|
||||
pub fn mark_played(&self, song: &mut Song) {
|
||||
if song.id < 0 {
|
||||
return;
|
||||
}
|
||||
let now = now_secs();
|
||||
let _ = self.con().execute("UPDATE songs SET playcount=playcount+1, lastplayed=? WHERE id=?", [now, song.id]);
|
||||
song.playcount += 1;
|
||||
song.lastplayed = now;
|
||||
}
|
||||
|
||||
pub fn mark_skipped(&self, song: &mut Song) {
|
||||
if song.id < 0 {
|
||||
return;
|
||||
}
|
||||
let _ = self.con().execute("UPDATE songs SET skipcount=skipcount+1 WHERE id=?", [song.id]);
|
||||
song.skipcount += 1;
|
||||
}
|
||||
|
||||
pub fn set_rating(&self, song: &mut Song, rating: i64) {
|
||||
song.rating = rating;
|
||||
self.update_fields(song.id, &[("rating", Value::Integer(rating))]);
|
||||
}
|
||||
|
||||
/// Persist a song whose tags changed (after writing them to the file).
|
||||
pub fn store_tags(&self, s: &Song) {
|
||||
if s.id < 0 {
|
||||
return;
|
||||
}
|
||||
let cols = ["title", "artist", "album", "albumartist", "genre", "composer", "comment", "year", "track", "disc", "mb_trackid", "mb_albumid", "length", "bitrate", "samplerate", "bitdepth", "channels", "filetype", "filesize", "mtime", "rg_track", "rg_album"];
|
||||
let all = song_values(s);
|
||||
let vals: Vec<(&str, Value)> = cols
|
||||
.iter()
|
||||
.map(|c| (*c, all[SONG_COLS.iter().position(|x| x == c).unwrap()].clone()))
|
||||
.collect();
|
||||
self.update_fields(s.id, &vals);
|
||||
}
|
||||
|
||||
/// Re-read tags for one file after editing and persist. Keeps counters and art.
|
||||
pub fn reread(&self, path: &str, old: &Song) -> Option<Song> {
|
||||
let mut s = tags::read_song(path)?;
|
||||
s.id = old.id;
|
||||
s.playcount = old.playcount;
|
||||
s.skipcount = old.skipcount;
|
||||
s.lastplayed = old.lastplayed;
|
||||
s.rating = old.rating;
|
||||
s.added = old.added;
|
||||
s.art = old.art.clone();
|
||||
s.begin = old.begin;
|
||||
s.end = old.end;
|
||||
self.store_tags(&s);
|
||||
Some(s)
|
||||
}
|
||||
|
||||
pub fn set_album_art(&self, artist: &str, album: &str, art_path: &str) {
|
||||
let _ = self.con().execute(
|
||||
"UPDATE songs SET art=? WHERE (albumartist=? OR (albumartist='' AND artist=?)) AND album=?",
|
||||
[art_path, artist, artist, album],
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ lyrics cache
|
||||
pub fn get_lyrics(&self, key: &str) -> Option<(String, String)> {
|
||||
self.con()
|
||||
.query_row("SELECT text, source FROM lyrics WHERE key=?", [key], |r| {
|
||||
Ok((r.get::<_, Option<String>>(0)?.unwrap_or_default(), r.get::<_, Option<String>>(1)?.unwrap_or_default()))
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
||||
pub fn put_lyrics(&self, key: &str, text: &str, source: &str) {
|
||||
let _ = self.con().execute(
|
||||
"INSERT OR REPLACE INTO lyrics(key,text,source,fetched) VALUES (?,?,?,?)",
|
||||
rusqlite::params![key, text, source, now_secs()],
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ playlists
|
||||
pub fn load_playlists(&self) -> Vec<PlaylistRow> {
|
||||
self.query_rows("SELECT id,name,is_open,favorite,current,items FROM playlists ORDER BY ui_order, id", &[], |r| {
|
||||
Ok(PlaylistRow {
|
||||
id: r.get(0)?,
|
||||
name: r.get::<_, Option<String>>(1)?.unwrap_or_default(),
|
||||
is_open: r.get::<_, Option<i64>>(2)?.unwrap_or(1) != 0,
|
||||
favorite: r.get::<_, Option<i64>>(3)?.unwrap_or(0) != 0,
|
||||
current: r.get::<_, Option<i64>>(4)?.unwrap_or(-1),
|
||||
items: r.get::<_, Option<String>>(5)?.unwrap_or_else(|| "[]".into()),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub fn playlist_row(&self, id: i64) -> Option<PlaylistRow> {
|
||||
self.load_playlists().into_iter().find(|p| p.id == id)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn save_playlist(&self, pid: i64, name: &str, songs: &[Song], ui_order: i64, is_open: bool, current: i64, favorite: bool) -> i64 {
|
||||
let items: Vec<serde_json::Value> = songs.iter().map(song_to_json).collect();
|
||||
let items = serde_json::to_string(&items).unwrap_or_else(|_| "[]".into());
|
||||
let con = self.con();
|
||||
if pid < 0 {
|
||||
let _ = con.execute(
|
||||
"INSERT INTO playlists(name,ui_order,is_open,favorite,current,items) VALUES (?,?,?,?,?,?)",
|
||||
rusqlite::params![name, ui_order, is_open as i64, favorite as i64, current, items],
|
||||
);
|
||||
con.last_insert_rowid()
|
||||
} else {
|
||||
let _ = con.execute(
|
||||
"UPDATE playlists SET name=?, ui_order=?, is_open=?, favorite=?, current=?, items=? WHERE id=?",
|
||||
rusqlite::params![name, ui_order, is_open as i64, favorite as i64, current, items, pid],
|
||||
);
|
||||
pid
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_playlist_meta(&self, pid: i64, name: &str, ui_order: i64, current: i64, favorite: bool) {
|
||||
let _ = self.con().execute(
|
||||
"UPDATE playlists SET name=?, ui_order=?, current=?, favorite=?, is_open=1 WHERE id=?",
|
||||
rusqlite::params![name, ui_order, current, favorite as i64, pid],
|
||||
);
|
||||
}
|
||||
|
||||
pub fn delete_playlist(&self, pid: i64) {
|
||||
let _ = self.con().execute("DELETE FROM playlists WHERE id=?", [pid]);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ radio
|
||||
pub fn radios(&self) -> Vec<(i64, String, String)> {
|
||||
self.query_rows("SELECT id,name,url FROM radio ORDER BY ui_order, id", &[], |r| {
|
||||
Ok((r.get(0)?, r.get::<_, Option<String>>(1)?.unwrap_or_default(), r.get::<_, Option<String>>(2)?.unwrap_or_default()))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn add_radio(&self, name: &str, url: &str) {
|
||||
let _ = self.con().execute("INSERT INTO radio(name,url,ui_order) VALUES (?,?,999)", [name, url]);
|
||||
}
|
||||
|
||||
pub fn remove_radio(&self, id: i64) {
|
||||
let _ = self.con().execute("DELETE FROM radio WHERE id=?", [id]);
|
||||
}
|
||||
|
||||
/// Resolve a playlist entry written on another machine by its last path parts.
|
||||
pub fn find_by_tail(&self, tail: &str) -> Option<String> {
|
||||
let rows = self.query_rows(
|
||||
"SELECT url FROM songs WHERE lower(replace(substr(url, -?), '\\', '/')) = lower(?) LIMIT 2",
|
||||
&[Value::Integer(tail.chars().count() as i64 + 1), Value::Text(format!("/{tail}"))],
|
||||
|r| r.get::<_, String>(0),
|
||||
);
|
||||
if rows.len() == 1 {
|
||||
rows.into_iter().next()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------ scanning
|
||||
pub fn scanning(&self) -> bool {
|
||||
self.scanning.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
pub fn stop_scan(&self) {
|
||||
self.abort.store(true, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn scan(&self, full: bool, bus: Bus) {
|
||||
if self.scanning.swap(true, Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
self.abort.store(false, Ordering::Relaxed);
|
||||
let folders: Vec<String> = settings().get_list("library/folders").into_iter().filter(|f| !f.is_empty()).collect();
|
||||
if folders.is_empty() {
|
||||
self.scanning.store(false, Ordering::SeqCst);
|
||||
return;
|
||||
}
|
||||
let (scanning, abort) = (self.scanning.clone(), self.abort.clone());
|
||||
std::thread::spawn(move || {
|
||||
run_scan(folders, full, &bus, &abort);
|
||||
scanning.store(false, Ordering::SeqCst);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn now_secs() -> i64 {
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs() as i64).unwrap_or(0)
|
||||
}
|
||||
|
||||
pub fn song_to_json(s: &Song) -> serde_json::Value {
|
||||
let mut v = serde_json::to_value(s).unwrap_or(serde_json::Value::Null);
|
||||
if let Some(o) = v.as_object_mut() {
|
||||
o.retain(|k, val| {
|
||||
k == "url" || !(val.is_null() || val == "" || val == 0 || val == 0.0 || (k == "id" && val == -1))
|
||||
});
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
pub fn song_from_json(v: &serde_json::Value) -> Song {
|
||||
let mut s: Song = serde_json::from_value(v.clone()).unwrap_or_default();
|
||||
if v.get("id").is_none() {
|
||||
s.id = -1;
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
fn walk_audio(dir: &Path, out: &mut Vec<String>, abort: &AtomicBool, follow_hidden: bool) {
|
||||
let Ok(rd) = std::fs::read_dir(dir) else { return };
|
||||
let mut entries: Vec<_> = rd.filter_map(|e| e.ok()).collect();
|
||||
entries.sort_by_key(|e| e.file_name());
|
||||
for e in entries {
|
||||
if abort.load(Ordering::Relaxed) {
|
||||
return;
|
||||
}
|
||||
let name = e.file_name().to_string_lossy().into_owned();
|
||||
let path = e.path();
|
||||
if path.is_dir() {
|
||||
if follow_hidden || !name.starts_with('.') {
|
||||
walk_audio(&path, out, abort, follow_hidden);
|
||||
}
|
||||
} else if AUDIO_EXTS.contains(&ext_of(&name).as_str()) {
|
||||
out.push(path.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Expand files/dirs to songs (used for drops and "open"), using the library DB when known.
|
||||
pub fn scan_paths(lib: &Library, paths: &[String]) -> Vec<Song> {
|
||||
let abort = AtomicBool::new(false);
|
||||
let mut files = vec![];
|
||||
for p in paths {
|
||||
if Path::new(p).is_dir() {
|
||||
walk_audio(Path::new(p), &mut files, &abort, true);
|
||||
} else {
|
||||
files.push(p.clone());
|
||||
}
|
||||
}
|
||||
let known = lib.songs_by_urls(&files);
|
||||
let mut dir_art: HashMap<String, String> = HashMap::new();
|
||||
let mut out = vec![];
|
||||
for f in files {
|
||||
if let Some(s) = known.get(&f) {
|
||||
out.push(s.clone());
|
||||
continue;
|
||||
}
|
||||
let Some(mut s) = tags::read_song(&f) else { continue };
|
||||
let dir = Path::new(&f).parent().map(|d| d.to_string_lossy().into_owned()).unwrap_or_default();
|
||||
let art = dir_art.entry(dir.clone()).or_insert_with(|| {
|
||||
let key = tags::album_key(&s.effective_albumartist(), &s.album, &dir);
|
||||
let cached = tags::cover_path(&key);
|
||||
if cached.exists() {
|
||||
return cached.to_string_lossy().into_owned();
|
||||
}
|
||||
if let Some(src) = tags::find_folder_cover(&dir) {
|
||||
return tags::store_cover(tags::CoverSrc::Path(&src), &key).unwrap_or_default();
|
||||
}
|
||||
tags::extract_embedded_cover(&f)
|
||||
.and_then(|d| tags::store_cover(tags::CoverSrc::Data(&d), &key))
|
||||
.unwrap_or_default()
|
||||
});
|
||||
s.art = art.clone();
|
||||
out.push(s);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn run_scan(folders: Vec<String>, full: bool, bus: &Bus, abort: &AtomicBool) {
|
||||
let con = connect();
|
||||
let mut known: HashMap<String, (i64, f64)> = HashMap::new();
|
||||
if let Ok(mut st) = con.prepare("SELECT id,url,mtime FROM songs") {
|
||||
if let Ok(rows) = st.query_map([], |r| Ok((r.get::<_, i64>(0)?, r.get::<_, String>(1)?, r.get::<_, Option<f64>>(2)?.unwrap_or(0.0)))) {
|
||||
for (id, url, m) in rows.flatten() {
|
||||
known.insert(url, (id, m));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut files = vec![];
|
||||
for folder in &folders {
|
||||
walk_audio(Path::new(folder), &mut files, abort, false);
|
||||
}
|
||||
if abort.load(Ordering::Relaxed) {
|
||||
return;
|
||||
}
|
||||
let seen: HashSet<&String> = files.iter().collect();
|
||||
let (mut added, mut updated) = (0usize, 0usize);
|
||||
let total = files.len();
|
||||
let mut art_cache: HashMap<String, String> = HashMap::new();
|
||||
let mut dir_cover: HashMap<String, Option<String>> = HashMap::new();
|
||||
let now = now_secs();
|
||||
let _ = con.execute_batch("BEGIN");
|
||||
let mut batch = 0;
|
||||
let upd_cols: Vec<&str> = SONG_COLS.iter().copied().filter(|c| !["playcount", "skipcount", "lastplayed", "rating", "added"].contains(c)).collect();
|
||||
for (i, path) in files.iter().enumerate() {
|
||||
if abort.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
let Some(mtime) = std::fs::metadata(path).ok().and_then(|m| m.modified().ok()).and_then(|m| m.duration_since(std::time::UNIX_EPOCH).ok()).map(|d| d.as_secs_f64()) else { continue };
|
||||
let prev = known.get(path);
|
||||
if let Some((_, pm)) = prev {
|
||||
if !full && (pm - mtime).abs() < 1.0 {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if i % 25 == 0 {
|
||||
bus.send(Msg::ScanProgress { done: i, total });
|
||||
}
|
||||
let Some(mut s) = tags::read_song(path) else { continue };
|
||||
let dir = Path::new(path).parent().map(|d| d.to_string_lossy().into_owned()).unwrap_or_default();
|
||||
let key = tags::album_key(&s.effective_albumartist(), &s.album, &dir);
|
||||
if let Some(a) = art_cache.get(&key) {
|
||||
s.art = a.clone();
|
||||
} else {
|
||||
let src = dir_cover.entry(dir.clone()).or_insert_with(|| tags::find_folder_cover(&dir)).clone();
|
||||
let art = match src {
|
||||
Some(p) => tags::store_cover(tags::CoverSrc::Path(&p), &key),
|
||||
None => tags::extract_embedded_cover(path).and_then(|d| tags::store_cover(tags::CoverSrc::Data(&d), &key)),
|
||||
}
|
||||
.unwrap_or_default();
|
||||
art_cache.insert(key, art.clone());
|
||||
s.art = art;
|
||||
}
|
||||
let vals = song_values(&s);
|
||||
if let Some((id, _)) = prev {
|
||||
let idx: Vec<usize> = upd_cols.iter().map(|c| SONG_COLS.iter().position(|x| x == c).unwrap()).collect();
|
||||
let mut args: Vec<Value> = idx.iter().map(|i| vals[*i].clone()).collect();
|
||||
args.push(Value::Integer(*id));
|
||||
let sql = format!("UPDATE songs SET {}, unavailable=0 WHERE id=?", upd_cols.iter().map(|c| format!("{c}=?")).collect::<Vec<_>>().join(", "));
|
||||
let _ = con.execute(&sql, params_from_iter(args.iter()));
|
||||
updated += 1;
|
||||
} else {
|
||||
let mut vals = vals;
|
||||
vals[SONG_COLS.iter().position(|c| *c == "added").unwrap()] = Value::Integer(now);
|
||||
let sql = format!("INSERT OR REPLACE INTO songs({}) VALUES ({})", SONG_COLS.join(", "), vec!["?"; SONG_COLS.len()].join(","));
|
||||
let _ = con.execute(&sql, params_from_iter(vals.iter()));
|
||||
added += 1;
|
||||
}
|
||||
batch += 1;
|
||||
if batch >= 200 {
|
||||
let _ = con.execute_batch("COMMIT; BEGIN");
|
||||
batch = 0;
|
||||
}
|
||||
}
|
||||
let _ = con.execute_batch("COMMIT");
|
||||
let mut removed = 0;
|
||||
if !abort.load(Ordering::Relaxed) {
|
||||
let gone: Vec<&String> = known.keys().filter(|u| !seen.contains(u)).collect();
|
||||
for u in &gone {
|
||||
let _ = con.execute("DELETE FROM songs WHERE url=?", [u]);
|
||||
}
|
||||
removed = gone.len();
|
||||
}
|
||||
bus.send(Msg::ScanProgress { done: total, total });
|
||||
bus.send(Msg::ScanFinished { added, updated, removed });
|
||||
}
|
||||
46
src/main.rs
Normal file
46
src/main.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
use eframe::egui;
|
||||
use mulberry::{app, config, instance};
|
||||
|
||||
fn app_icon() -> egui::IconData {
|
||||
let svg = include_str!("../assets/mulberry.svg");
|
||||
let size = 256u32;
|
||||
let mut pm = resvg::tiny_skia::Pixmap::new(size, size).unwrap();
|
||||
if let Ok(tree) = resvg::usvg::Tree::from_str(svg, &resvg::usvg::Options::default()) {
|
||||
let s = size as f32 / tree.size().width().max(tree.size().height());
|
||||
resvg::render(&tree, resvg::tiny_skia::Transform::from_scale(s, s), &mut pm.as_mut());
|
||||
}
|
||||
// tiny-skia is premultiplied; IconData wants straight alpha
|
||||
let mut rgba = pm.take();
|
||||
for px in rgba.chunks_exact_mut(4) {
|
||||
let a = px[3] as u32;
|
||||
if a > 0 && a < 255 {
|
||||
for c in &mut px[..3] {
|
||||
*c = ((*c as u32 * 255 + a / 2) / a).min(255) as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
egui::IconData { rgba, width: size, height: size }
|
||||
}
|
||||
|
||||
fn main() -> eframe::Result {
|
||||
let args: Vec<String> = std::env::args().skip(1).filter(|a| !a.starts_with("--")).collect();
|
||||
let abs: Vec<String> = args
|
||||
.iter()
|
||||
.map(|a| if a.contains("://") { a.clone() } else { std::fs::canonicalize(a).map(|p| p.to_string_lossy().into_owned()).unwrap_or_else(|_| a.clone()) })
|
||||
.collect();
|
||||
if instance::forward(&abs) {
|
||||
return Ok(());
|
||||
}
|
||||
let (mut win_w, mut win_h) = (config::settings().get_f64("ui/win_w") as f32, config::settings().get_f64("ui/win_h") as f32);
|
||||
if win_w < 860.0 || win_h < 560.0 {
|
||||
(win_w, win_h) = (1380.0, 880.0);
|
||||
}
|
||||
let viewport = egui::ViewportBuilder::default()
|
||||
.with_title(config::APP_NAME)
|
||||
.with_app_id("mulberry")
|
||||
.with_inner_size([win_w, win_h])
|
||||
.with_min_inner_size([860.0, 560.0])
|
||||
.with_icon(std::sync::Arc::new(app_icon()));
|
||||
let options = eframe::NativeOptions { viewport, multisampling: 4, ..Default::default() };
|
||||
eframe::run_native(config::APP_NAME, options, Box::new(move |cc| Ok(Box::new(app::App::new(cc, abs.clone())))))
|
||||
}
|
||||
336
src/mpris.rs
Normal file
336
src/mpris.rs
Normal file
|
|
@ -0,0 +1,336 @@
|
|||
//! MPRIS2 D-Bus interface so desktop media controls, KDE Connect, media keys and shell widgets
|
||||
//! see and control Mulberry.
|
||||
|
||||
use crate::bus::{Bus, Msg, MprisCmd};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::atomic::{AtomicBool, AtomicI64, Ordering};
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use zbus::object_server::SignalEmitter;
|
||||
use zbus::zvariant::{ObjectPath, OwnedValue, Value};
|
||||
|
||||
const PATH: &str = "/org/mpris/MediaPlayer2";
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct Snapshot {
|
||||
pub status: String, // Playing | Paused | Stopped
|
||||
pub loop_status: String,
|
||||
pub shuffle: bool,
|
||||
pub volume: f64,
|
||||
pub can_seek: bool,
|
||||
pub has_song: bool,
|
||||
pub track_id: String,
|
||||
pub title: String,
|
||||
pub artists: Vec<String>,
|
||||
pub album: String,
|
||||
pub album_artist: String,
|
||||
pub genre: String,
|
||||
pub track: i64,
|
||||
pub disc: i64,
|
||||
pub length_us: i64,
|
||||
pub url: String,
|
||||
pub art_url: String,
|
||||
pub year: i64,
|
||||
pub use_count: i64,
|
||||
pub rating: f64,
|
||||
}
|
||||
|
||||
struct Shared {
|
||||
snap: Mutex<Snapshot>,
|
||||
pos_us: AtomicI64,
|
||||
}
|
||||
|
||||
struct Root {
|
||||
bus: Bus,
|
||||
}
|
||||
|
||||
#[zbus::interface(name = "org.mpris.MediaPlayer2")]
|
||||
impl Root {
|
||||
fn raise(&self) {
|
||||
self.bus.send(Msg::Mpris(MprisCmd::Raise));
|
||||
}
|
||||
fn quit(&self) {
|
||||
self.bus.send(Msg::Mpris(MprisCmd::Quit));
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_quit(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_raise(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn has_track_list(&self) -> bool {
|
||||
false
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn identity(&self) -> String {
|
||||
"Mulberry".into()
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn desktop_entry(&self) -> String {
|
||||
"mulberry".into()
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn supported_uri_schemes(&self) -> Vec<String> {
|
||||
["file", "http", "https", "cdda"].iter().map(|s| s.to_string()).collect()
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn supported_mime_types(&self) -> Vec<String> {
|
||||
["audio/mpeg", "audio/flac", "audio/ogg", "audio/opus", "audio/mp4", "audio/aac", "audio/x-wav", "audio/x-ms-wma", "audio/x-ape", "audio/x-wavpack", "audio/x-musepack", "audio/x-aiff", "audio/x-mpegurl", "audio/x-scpls", "application/xspf+xml"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
struct PlayerIface {
|
||||
bus: Bus,
|
||||
sh: Arc<Shared>,
|
||||
}
|
||||
|
||||
impl PlayerIface {
|
||||
fn cmd(&self, c: MprisCmd) {
|
||||
self.bus.send(Msg::Mpris(c));
|
||||
}
|
||||
}
|
||||
|
||||
#[zbus::interface(name = "org.mpris.MediaPlayer2.Player")]
|
||||
impl PlayerIface {
|
||||
fn next(&self) {
|
||||
self.cmd(MprisCmd::Next);
|
||||
}
|
||||
fn previous(&self) {
|
||||
self.cmd(MprisCmd::Prev);
|
||||
}
|
||||
fn pause(&self) {
|
||||
self.cmd(MprisCmd::Pause);
|
||||
}
|
||||
fn play_pause(&self) {
|
||||
self.cmd(MprisCmd::PlayPause);
|
||||
}
|
||||
fn stop(&self) {
|
||||
self.cmd(MprisCmd::Stop);
|
||||
}
|
||||
fn play(&self) {
|
||||
self.cmd(MprisCmd::Play);
|
||||
}
|
||||
fn seek(&self, offset: i64) {
|
||||
self.cmd(MprisCmd::Seek(offset as f64 / 1e6));
|
||||
}
|
||||
fn set_position(&self, _track: ObjectPath<'_>, pos: i64) {
|
||||
self.cmd(MprisCmd::SetPos(pos as f64 / 1e6));
|
||||
}
|
||||
fn open_uri(&self, uri: String) {
|
||||
self.bus.send(Msg::OpenArgs(vec![uri]));
|
||||
}
|
||||
#[zbus(signal)]
|
||||
async fn seeked(emitter: &SignalEmitter<'_>, position: i64) -> zbus::Result<()>;
|
||||
|
||||
#[zbus(property)]
|
||||
fn playback_status(&self) -> String {
|
||||
self.sh.snap.lock().unwrap().status.clone()
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn loop_status(&self) -> String {
|
||||
self.sh.snap.lock().unwrap().loop_status.clone()
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn set_loop_status(&self, v: String) {
|
||||
self.cmd(MprisCmd::SetLoop(v));
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn rate(&self) -> f64 {
|
||||
1.0
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn set_rate(&self, _v: f64) {}
|
||||
#[zbus(property)]
|
||||
fn shuffle(&self) -> bool {
|
||||
self.sh.snap.lock().unwrap().shuffle
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn set_shuffle(&self, v: bool) {
|
||||
self.cmd(MprisCmd::SetShuffle(v));
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn metadata(&self) -> HashMap<String, OwnedValue> {
|
||||
metadata(&self.sh.snap.lock().unwrap())
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn volume(&self) -> f64 {
|
||||
self.sh.snap.lock().unwrap().volume
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn set_volume(&self, v: f64) {
|
||||
self.cmd(MprisCmd::SetVolume(v));
|
||||
}
|
||||
#[zbus(property(emits_changed_signal = "false"))]
|
||||
fn position(&self) -> i64 {
|
||||
self.sh.pos_us.load(Ordering::Relaxed)
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn minimum_rate(&self) -> f64 {
|
||||
1.0
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn maximum_rate(&self) -> f64 {
|
||||
1.0
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_go_next(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_go_previous(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_play(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_pause(&self) -> bool {
|
||||
true
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_seek(&self) -> bool {
|
||||
self.sh.snap.lock().unwrap().can_seek
|
||||
}
|
||||
#[zbus(property)]
|
||||
fn can_control(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fn ov<'a, T: Into<Value<'a>>>(v: T) -> OwnedValue {
|
||||
OwnedValue::try_from(v.into()).unwrap()
|
||||
}
|
||||
|
||||
fn metadata(s: &Snapshot) -> HashMap<String, OwnedValue> {
|
||||
let mut m: HashMap<String, OwnedValue> = HashMap::new();
|
||||
if !s.has_song {
|
||||
m.insert("mpris:trackid".into(), ov(ObjectPath::try_from("/org/mpris/MediaPlayer2/TrackList/NoTrack").unwrap()));
|
||||
return m;
|
||||
}
|
||||
m.insert("mpris:trackid".into(), ov(ObjectPath::try_from(s.track_id.clone()).unwrap_or_else(|_| ObjectPath::try_from("/org/mulberry/track/0").unwrap())));
|
||||
m.insert("mpris:length".into(), ov(s.length_us));
|
||||
m.insert("xesam:title".into(), ov(s.title.clone()));
|
||||
m.insert("xesam:album".into(), ov(s.album.clone()));
|
||||
m.insert("xesam:artist".into(), ov(s.artists.clone()));
|
||||
m.insert("xesam:albumArtist".into(), ov(if s.album_artist.is_empty() { vec![] } else { vec![s.album_artist.clone()] }));
|
||||
m.insert("xesam:genre".into(), ov(if s.genre.is_empty() { vec![] } else { vec![s.genre.clone()] }));
|
||||
m.insert("xesam:trackNumber".into(), ov(s.track as i32));
|
||||
m.insert("xesam:discNumber".into(), ov(s.disc as i32));
|
||||
m.insert("xesam:useCount".into(), ov(s.use_count as i32));
|
||||
m.insert("xesam:userRating".into(), ov(s.rating));
|
||||
m.insert("xesam:url".into(), ov(s.url.clone()));
|
||||
if !s.art_url.is_empty() {
|
||||
m.insert("mpris:artUrl".into(), ov(s.art_url.clone()));
|
||||
}
|
||||
if s.year > 0 {
|
||||
m.insert("xesam:contentCreated".into(), ov(format!("{:04}-01-01T00:00:00", s.year)));
|
||||
}
|
||||
m
|
||||
}
|
||||
|
||||
enum Cmd {
|
||||
Publish(Box<Snapshot>),
|
||||
Seeked(i64),
|
||||
}
|
||||
|
||||
pub struct Mpris {
|
||||
tx: Sender<Cmd>,
|
||||
dirty: Arc<AtomicBool>,
|
||||
sh: Arc<Shared>,
|
||||
}
|
||||
|
||||
impl Mpris {
|
||||
pub fn start(bus: Bus) -> Option<Mpris> {
|
||||
let sh = Arc::new(Shared { snap: Mutex::new(Snapshot { status: "Stopped".into(), loop_status: "None".into(), volume: 0.7, ..Default::default() }), pos_us: AtomicI64::new(0) });
|
||||
let (tx, rx) = channel::<Cmd>();
|
||||
let sh2 = sh.clone();
|
||||
let (ready_tx, ready_rx) = channel::<bool>();
|
||||
std::thread::Builder::new()
|
||||
.name("mpris".into())
|
||||
.spawn(move || {
|
||||
let sh_build = sh2.clone();
|
||||
let res = zbus::block_on(async move {
|
||||
let name = "org.mpris.MediaPlayer2.mulberry";
|
||||
let build = |n: String| {
|
||||
let (bus, sh) = (bus.clone(), sh_build.clone());
|
||||
async move {
|
||||
zbus::connection::Builder::session()?
|
||||
.name(n)?
|
||||
.serve_at(PATH, Root { bus: bus.clone() })?
|
||||
.serve_at(PATH, PlayerIface { bus, sh })?
|
||||
.build()
|
||||
.await
|
||||
}
|
||||
};
|
||||
let conn = match build(name.to_string()).await {
|
||||
Ok(c) => c,
|
||||
Err(_) => build(format!("{name}.instance{}", std::process::id())).await?,
|
||||
};
|
||||
Ok::<_, zbus::Error>(conn)
|
||||
});
|
||||
let Ok(conn) = res else {
|
||||
let _ = ready_tx.send(false);
|
||||
return;
|
||||
};
|
||||
let _ = ready_tx.send(true);
|
||||
while let Ok(cmd) = rx.recv() {
|
||||
zbus::block_on(async {
|
||||
match cmd {
|
||||
Cmd::Publish(s) => {
|
||||
*sh2.snap.lock().unwrap() = *s;
|
||||
if let Ok(iface) = conn.object_server().interface::<_, PlayerIface>(PATH).await {
|
||||
let g = iface.get().await;
|
||||
let em = iface.signal_emitter();
|
||||
let _ = g.playback_status_changed(em).await;
|
||||
let _ = g.loop_status_changed(em).await;
|
||||
let _ = g.shuffle_changed(em).await;
|
||||
let _ = g.metadata_changed(em).await;
|
||||
let _ = g.volume_changed(em).await;
|
||||
let _ = g.can_seek_changed(em).await;
|
||||
}
|
||||
}
|
||||
Cmd::Seeked(us) => {
|
||||
if let Ok(iface) = conn.object_server().interface::<_, PlayerIface>(PATH).await {
|
||||
let _ = PlayerIface::seeked(iface.signal_emitter(), us).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.ok()?;
|
||||
if !ready_rx.recv().unwrap_or(false) {
|
||||
return None;
|
||||
}
|
||||
Some(Mpris { tx, dirty: Arc::new(AtomicBool::new(false)), sh })
|
||||
}
|
||||
|
||||
/// Flag that state changed; the app publishes a fresh snapshot on its next frame.
|
||||
pub fn notify_changed(&self) {
|
||||
self.dirty.store(true, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn take_dirty(&self) -> bool {
|
||||
self.dirty.swap(false, Ordering::Relaxed)
|
||||
}
|
||||
|
||||
pub fn publish(&self, s: Snapshot) {
|
||||
let _ = self.tx.send(Cmd::Publish(Box::new(s)));
|
||||
}
|
||||
|
||||
pub fn set_position(&self, sec: f64) {
|
||||
self.sh.pos_us.store((sec * 1e6) as i64, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn seeked(&self, sec: f64) {
|
||||
self.sh.pos_us.store((sec * 1e6) as i64, Ordering::Relaxed);
|
||||
let _ = self.tx.send(Cmd::Seeked((sec * 1e6) as i64));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue