Mulberry 1.1.0: Material You music player for Linux and Windows
- KDE/Windows accent-driven Material 3 theme, live updating - Library, tabbed playlists, smart/saved lists, queue, ratings - mpv and Qt Multimedia engines, EQ, ReplayGain, gapless - Synced lyrics (LRCLIB, NetEase, local .lrc), covers, MusicBrainz tags - Last.fm/ListenBrainz scrobbling, MPRIS, Windows media keys - Audio CD playback and ripping - PyInstaller, Inno Setup and AppImage builds via GitHub Actions Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
This commit is contained in:
commit
615b21d64a
48 changed files with 11333 additions and 0 deletions
115
.github/workflows/build.yml
vendored
Normal file
115
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt pyinstaller
|
||||
- name: Version
|
||||
shell: bash
|
||||
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
|
||||
- name: Icons
|
||||
run: python packaging/make_icons.py
|
||||
- name: Fetch libmpv (gapless, EQ, CD playback & ripping)
|
||||
continue-on-error: true
|
||||
shell: pwsh
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
$rel = Invoke-RestMethod "https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest" -Headers @{ Authorization = "Bearer $env:GH_TOKEN" }
|
||||
$asset = $rel.assets | Where-Object { $_.name -match '^mpv-dev-x86_64-\d{8}-git-[0-9a-f]+\.7z$' } | Select-Object -First 1
|
||||
if (-not $asset) { throw "libmpv asset not found" }
|
||||
Invoke-WebRequest $asset.browser_download_url -OutFile mpv-dev.7z
|
||||
7z x mpv-dev.7z -ompv-dev -y | Out-Null
|
||||
New-Item -ItemType Directory -Force packaging/windows/mpv | Out-Null
|
||||
Copy-Item mpv-dev/libmpv-2.dll packaging/windows/mpv/
|
||||
Get-ChildItem packaging/windows/mpv
|
||||
- name: PyInstaller
|
||||
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
|
||||
- name: Portable zip
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force dist | Out-Null
|
||||
Compress-Archive -Path build/dist/Mulberry -DestinationPath "dist/Mulberry-$env:VERSION-Windows-Portable.zip"
|
||||
- name: Installer (Inno Setup)
|
||||
shell: pwsh
|
||||
run: |
|
||||
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
|
||||
if (-not (Test-Path $iscc)) { choco install innosetup -y --no-progress; $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" }
|
||||
& $iscc "/DAppVersion=$env:VERSION" packaging\windows\mulberry.iss
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows
|
||||
path: dist/*
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: System packages
|
||||
run: sudo apt-get update && sudo apt-get install -y libegl1 libxkbcommon0 libxcb-cursor0 desktop-file-utils file
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt pyinstaller
|
||||
- name: Version
|
||||
run: echo "VERSION=$(python -c "import re;print(re.search(r'VERSION = \"(.+?)\"', open('mulberry/config.py').read()).group(1))")" >> $GITHUB_ENV
|
||||
- name: Icons
|
||||
run: python packaging/make_icons.py
|
||||
- name: PyInstaller
|
||||
run: pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work
|
||||
- name: Tarball
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp mulberry.desktop mulberry/assets/mulberry.svg build/dist/Mulberry/
|
||||
tar -C build/dist -czf "dist/Mulberry-$VERSION-Linux-x86_64.tar.gz" Mulberry
|
||||
- name: AppImage
|
||||
run: |
|
||||
APPDIR=build/AppDir
|
||||
mkdir -p $APPDIR/usr/lib $APPDIR/usr/share/icons/hicolor/256x256/apps $APPDIR/usr/share/applications
|
||||
cp -r build/dist/Mulberry $APPDIR/usr/lib/mulberry
|
||||
cp packaging/linux/AppRun $APPDIR/AppRun && chmod +x $APPDIR/AppRun
|
||||
grep -v '^Actions=\|^\[Desktop Action\|^Name=Play\|^Name=Next\|^Name=Previous\|^Exec=dbus' mulberry.desktop > $APPDIR/mulberry.desktop
|
||||
cp $APPDIR/mulberry.desktop $APPDIR/usr/share/applications/
|
||||
cp packaging/build-icons/mulberry-256.png $APPDIR/mulberry.png
|
||||
cp packaging/build-icons/mulberry-256.png $APPDIR/usr/share/icons/hicolor/256x256/apps/mulberry.png
|
||||
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
|
||||
chmod +x appimagetool
|
||||
ARCH=x86_64 ./appimagetool --appimage-extract-and-run $APPDIR "dist/Mulberry-$VERSION-x86_64.AppImage"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux
|
||||
path: dist/*
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [windows, linux]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: artifacts/**/*
|
||||
generate_release_notes: true
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
__pycache__/
|
||||
*.pyc
|
||||
build/
|
||||
dist/
|
||||
packaging/build-icons/
|
||||
packaging/windows/mpv/
|
||||
*.spec.bak
|
||||
.venv/
|
||||
venv/
|
||||
*.AppImage
|
||||
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.
|
||||
122
README.md
Normal file
122
README.md
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# Mulberry 🫐
|
||||
|
||||
A full-featured Material You music player for **Linux (KDE and others) and Windows**, written in PyQt6. It combines Strawberry's layout (library sidebar, tabbed playlists, analyzer) with an expressive "now playing" panel: a cookie-shaped cover with a radial visualizer, a wavy seek bar, morphing buttons and synced lyrics. Its colours come live from your system: the KDE colour scheme and accent on Linux, the Windows accent colour and light/dark mode on Windows.
|
||||
|
||||

|
||||
|
||||
## Download
|
||||
|
||||
Grab the latest build from the **[Releases](../../releases)** page:
|
||||
|
||||
| Platform | File | Notes |
|
||||
|---|---|---|
|
||||
| Windows 10/11 (x64) | `Mulberry-x.y.z-Windows-Setup.exe` | Installer with Start menu entry and "Open with" integration |
|
||||
| Windows (portable) | `Mulberry-x.y.z-Windows-Portable.zip` | Unzip anywhere and run `Mulberry.exe` |
|
||||
| Linux (any distro) | `Mulberry-x.y.z-x86_64.AppImage` | `chmod +x` it and run it |
|
||||
| Linux | `Mulberry-x.y.z-Linux-x86_64.tar.gz` | Plain folder; run `Mulberry/mulberry` |
|
||||
|
||||
The Windows builds include libmpv, so gapless playback, the EQ, CD playback and CD ripping work out of the box. On Linux, Mulberry uses your system's `mpv` (install it for those features); without it, the built-in Qt/FFmpeg engine still plays nearly everything.
|
||||
|
||||
## Run from source
|
||||
|
||||
**Linux**
|
||||
```bash
|
||||
./install.sh # venv + `mulberry` launcher + app-menu entry and icon
|
||||
mulberry
|
||||
```
|
||||
Or run it straight from the folder: `pip install -r requirements.txt && ./run.sh`
|
||||
|
||||
**Windows** (Python 3.10+)
|
||||
```bat
|
||||
py -m pip install -r requirements.txt
|
||||
run.bat
|
||||
```
|
||||
|
||||
**Build the packages yourself:** `pip install pyinstaller && python packaging/make_icons.py && pyinstaller packaging/mulberry.spec`. GitHub Actions builds every format on each push, and pushing a tag like `v1.1.0` publishes a Release automatically.
|
||||
|
||||
### Optional Linux packages
|
||||
|
||||
| Package | What it enables |
|
||||
|---|---|
|
||||
| `mpv` / `libmpv` | Gapless playback, 10-band EQ, ReplayGain, audio-CD playback |
|
||||
| `cdparanoia` + `ffmpeg` | Best-quality CD ripping (libmpv is used otherwise) |
|
||||
| `libdiscid` | Faster CD TOC reading |
|
||||
| `chromaprint` (`fpcalc`) | AcoustID audio fingerprint tag lookup |
|
||||
|
||||
### Platform differences
|
||||
|
||||
| | Linux | Windows |
|
||||
|---|---|---|
|
||||
| Theme source | KDE `kdeglobals`, live-updating (or the Qt palette on other desktops) | Accent colour + light/dark mode from Windows settings, live-updating |
|
||||
| Default engine | mpv, falling back to Qt | Qt (needed for the visualizer); mpv is selectable in Settings for EQ and gapless playback |
|
||||
| Media keys / OS media controls | MPRIS: Plasma widget, lock screen, KDE Connect, shells | Global media keys |
|
||||
| Notifications | Desktop notifications with cover art | Tray notifications |
|
||||
|
||||
## Features
|
||||
|
||||
**Look and feel**
|
||||
- Material 3 colour roles built from your KDE accent and window colours (`~/.config/kdeglobals`). Change your KDE colours and the player recolours instantly.
|
||||
- Other colour sources: dynamic colours taken from the album art, or a custom seed colour. Light/dark either follows KDE or can be forced.
|
||||
- Hero panel: a cookie-shaped cover with a slow-spinning radial spectrum, a wavy M3 Expressive progress bar, a play button that morphs shape, and a synced lyrics card where you can click a line to seek.
|
||||
- Three layouts: Large, Compact bar, or Hidden (a mini transport moves to the bottom bar). F11 or clicking the cover gives a Focus mode with a big cover and lyrics.
|
||||
- An optional **floating bass shape** in the bottom-left corner (Settings › Appearance, or View menu). It morphs between Material shapes on bass hits, spins, pulses in size and cycles through your theme colours. Click it to play or pause.
|
||||
- The playing track gets a gradient pill, and the album art shows faintly behind the playlist. The bottom bar has a block spectrum analyzer.
|
||||
|
||||
**Library and playback**
|
||||
- SQLite collection with an incremental background scanner (only changed files are re-read). Group by album artist, artist, genre, year or album, and search with `artist:` `album:` `genre:` `year:>2000` `rating:>3`.
|
||||
- Formats: MP3, FLAC, Ogg Vorbis/Opus/Speex, AAC/ALAC/M4A, WMA, APE, WavPack, Musepack, TTA, OptimFROG, TAK, AIFF, WAV, DSF/DFF, MKA, tracker modules, MIDI and more. Cue sheets play as separate tracks.
|
||||
- Tabbed playlists with undo/redo, drag and drop, column chooser, sort by column, filtering, duplicate and unavailable-file removal, and saved/pinned playlists.
|
||||
- A play queue with Play next, Stop after this track, shuffle, and repeat (track or playlist).
|
||||
- Smart playlists: Recently added, Most played, Recently played, Loved & top rated, Never played, Random 100, Most skipped.
|
||||
- Play counts, skip counts and 0–5 star ratings.
|
||||
- Playlist import: M3U, M3U8, PLS, XSPF, WPL, ASX, CUE. Export: M3U, M3U8, PLS, XSPF, WPL, with relative or absolute paths.
|
||||
- Internet radio with ICY now-playing titles. A few SomaFM, Radio Paradise and KEXP stations are included, and you can add your own.
|
||||
- Output device selection, a 10-band equalizer with presets, ReplayGain (track or album, with pre-amp), and resume where you left off.
|
||||
|
||||
**Online and metadata**
|
||||
- Last.fm scrobbling, now-playing updates and Love. Scrobbles are cached offline and batch-sent later.
|
||||
- ListenBrainz submissions and loved-track feedback.
|
||||
- Tag editor for single files or many at once, with cover embedding for MP3, FLAC, Ogg, M4A and APE/WavPack.
|
||||
- MusicBrainz tag lookup, either picking a match or auto-applying it in batch, plus AcoustID fingerprinting.
|
||||
- Automatic cover fetching (iTunes, Deezer, Cover Art Archive, Last.fm) and a cover manager with a grid of candidates.
|
||||
- Synced lyrics. In the lyrics card's ⋮ menu you can pick the source: **Auto** (local `.lrc` → embedded → LRCLIB → NetEase), **LRCLIB**, **NetEase Cloud Music**, **Local .lrc files** (such as those downloaded by LRCGET) or **Embedded tags**. You can also turn on **Show as plain text**. Click any synced line to jump there. You can also edit lyrics, nudge their timing, and switch the card to the artist bio.
|
||||
|
||||
**Audio CD**
|
||||
- Detects drives, reads the TOC (libdiscid, cdparanoia or cd-info), looks the disc up on MusicBrainz and fetches its cover.
|
||||
- Plays CD tracks (mpv backend).
|
||||
- Ripper: format, quality, folder and filename pattern are configurable. It tags the files, embeds the cover and adds the result to your library.
|
||||
|
||||
**Desktop integration**
|
||||
- Full MPRIS2 support, so Plasma's media controls, the lock screen, KDE Connect, media keys and shell widgets like Quickshell all see and control it.
|
||||
- Desktop notifications with the album art.
|
||||
- Tray icon (close to tray), single instance (opening files from Dolphin adds them to the running player), and native KDE file dialogs through the XDG portal.
|
||||
|
||||
## Last.fm setup
|
||||
In **Settings › Scrobbling**, click **Log in with Last.fm**. Your browser opens Last.fm's authorisation page. Click *Yes, allow access* there, and Mulberry detects it within a few seconds; no further clicks are needed.
|
||||
|
||||
Last.fm issues API keys per application, so the login button needs one key for this copy of Mulberry. You only have to add it once:
|
||||
- **Simplest:** tick *Use my own API key*, create a free key at <https://www.last.fm/api/account/create>, paste the key and secret, then press Log in.
|
||||
- **Or for everyone on the machine:** put the key in `mulberry/lastfm_app.py`, in `~/.config/mulberry/lastfm_app.json` (`{"key": "...", "secret": "..."}`), or in the `MULBERRY_LASTFM_KEY` and `MULBERRY_LASTFM_SECRET` environment variables. After that the login button works without anyone touching keys.
|
||||
|
||||
## 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 | Import / export playlist |
|
||||
| Ctrl+Z / Ctrl+Shift+Z | Undo / redo |
|
||||
| Ctrl+L | Love the current track |
|
||||
| F5 / Ctrl+F5 | Update library / full rescan |
|
||||
| F11 | Focus mode |
|
||||
|
||||
## Files (Linux; on Windows they live in `%APPDATA%\Mulberry` and `%LOCALAPPDATA%\Mulberry`)
|
||||
- Settings: `~/.config/mulberry/mulberry.conf`
|
||||
- Library, playlists and lyrics cache: `~/.local/share/mulberry/library.db`
|
||||
- Covers: `~/.local/share/mulberry/covers`, thumbnails in `~/.cache/mulberry`
|
||||
BIN
docs/screenshot.png
Normal file
BIN
docs/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
BIN
docs/shape.png
Normal file
BIN
docs/shape.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
50
install.sh
Executable file
50
install.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
# Installs Mulberry for the current user (no root needed for the app itself).
|
||||
set -euo pipefail
|
||||
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/mulberry-app"
|
||||
BIN="$HOME/.local/bin"
|
||||
|
||||
echo "==> Checking system packages"
|
||||
missing=()
|
||||
ldconfig -p 2>/dev/null | grep -q libmpv.so || missing+=("mpv / libmpv (gapless, EQ, ReplayGain, audio CD playback)")
|
||||
command -v cdparanoia >/dev/null || missing+=("cdparanoia (CD ripping)")
|
||||
command -v ffmpeg >/dev/null || missing+=("ffmpeg (CD rip encoding)")
|
||||
command -v fpcalc >/dev/null || missing+=("chromaprint / fpcalc (optional: AcoustID fingerprints)")
|
||||
if ((${#missing[@]})); then
|
||||
echo " Optional tools not found (install with your package manager):"
|
||||
for m in "${missing[@]}"; do echo " - $m"; done
|
||||
echo " e.g. Arch: sudo pacman -S mpv cdparanoia ffmpeg chromaprint libdiscid"
|
||||
echo " Fedora: sudo dnf install mpv-libs cdparanoia ffmpeg chromaprint-tools libdiscid"
|
||||
echo " Debian/Ubuntu/KDE neon: sudo apt install libmpv2 cdparanoia ffmpeg libchromaprint-tools libdiscid0"
|
||||
fi
|
||||
|
||||
echo "==> Creating virtual environment in $PREFIX"
|
||||
mkdir -p "$PREFIX"
|
||||
python3 -m venv "$PREFIX/venv"
|
||||
"$PREFIX/venv/bin/pip" install --upgrade pip >/dev/null
|
||||
"$PREFIX/venv/bin/pip" install -r "$SRC/requirements.txt"
|
||||
"$PREFIX/venv/bin/pip" install discid >/dev/null 2>&1 || true # optional, uses libdiscid
|
||||
|
||||
echo "==> Copying application"
|
||||
rm -rf "$PREFIX/mulberry"
|
||||
cp -r "$SRC/mulberry" "$PREFIX/mulberry"
|
||||
|
||||
mkdir -p "$BIN"
|
||||
cat > "$BIN/mulberry" <<LAUNCH
|
||||
#!/usr/bin/env bash
|
||||
cd "$PREFIX" && exec "$PREFIX/venv/bin/python" -m mulberry "\$@"
|
||||
LAUNCH
|
||||
chmod +x "$BIN/mulberry"
|
||||
|
||||
echo "==> Desktop integration"
|
||||
APPS="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
|
||||
ICONS="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/scalable/apps"
|
||||
mkdir -p "$APPS" "$ICONS"
|
||||
sed "s|^Exec=mulberry|Exec=$BIN/mulberry|" "$SRC/mulberry.desktop" > "$APPS/mulberry.desktop"
|
||||
cp "$SRC/mulberry/assets/mulberry.svg" "$ICONS/mulberry.svg"
|
||||
command -v update-desktop-database >/dev/null && update-desktop-database "$APPS" || true
|
||||
command -v kbuildsycoca6 >/dev/null && kbuildsycoca6 >/dev/null 2>&1 || true
|
||||
|
||||
echo
|
||||
echo "Done! Launch Mulberry from your app menu, or run: mulberry"
|
||||
26
mulberry.desktop
Normal file
26
mulberry.desktop
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Mulberry
|
||||
GenericName=Music Player
|
||||
Comment=Material You music player that follows your KDE colours
|
||||
Exec=mulberry %U
|
||||
Icon=mulberry
|
||||
Terminal=false
|
||||
Categories=AudioVideo;Audio;Player;Qt;KDE;
|
||||
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
|
||||
X-KDE-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
|
||||
0
mulberry/__init__.py
Normal file
0
mulberry/__init__.py
Normal file
98
mulberry/__main__.py
Normal file
98
mulberry/__main__.py
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
"""Entry point: python -m mulberry [files/urls…]"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtNetwork import QLocalServer, QLocalSocket
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
|
||||
from .config import APP_ID, APP_NAME, IS_LINUX, IS_WIN
|
||||
|
||||
if IS_LINUX:
|
||||
# pip-installed Qt has no KDE platform theme; use the XDG portal so
|
||||
# file dialogs are the native KDE ones.
|
||||
from PyQt6.QtCore import QLibraryInfo
|
||||
themes = os.path.join(QLibraryInfo.path(QLibraryInfo.LibraryPath.PluginsPath), "platformthemes")
|
||||
have_kde = os.path.isdir(themes) and any("kde" in f.lower() for f in os.listdir(themes))
|
||||
if not have_kde and os.environ.get("QT_QPA_PLATFORMTHEME", "kde").lower() in ("kde", ""):
|
||||
os.environ["QT_QPA_PLATFORMTHEME"] = "xdgdesktopportal"
|
||||
if IS_WIN:
|
||||
# own taskbar identity (correct icon + grouping instead of python.exe)
|
||||
try:
|
||||
import ctypes
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("Mulberry.MusicPlayer")
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
|
||||
QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName(APP_NAME)
|
||||
app.setApplicationDisplayName(APP_NAME)
|
||||
app.setOrganizationName(APP_ID)
|
||||
app.setDesktopFileName(APP_ID)
|
||||
app.setStyle("Fusion")
|
||||
app.setQuitOnLastWindowClosed(False)
|
||||
import locale
|
||||
locale.setlocale(locale.LC_NUMERIC, "C")
|
||||
|
||||
args = [a for a in sys.argv[1:] if not a.startswith("-")]
|
||||
import getpass
|
||||
try:
|
||||
who = getpass.getuser()
|
||||
except Exception: # noqa: BLE001
|
||||
who = "user"
|
||||
server_name = f"{APP_ID}-{who}"
|
||||
sock = QLocalSocket()
|
||||
sock.connectToServer(server_name)
|
||||
if sock.waitForConnected(300):
|
||||
sock.write(json.dumps([os.path.abspath(a) if os.path.exists(a) else a for a in args] or ["--raise"]).encode())
|
||||
sock.flush()
|
||||
sock.waitForBytesWritten(500)
|
||||
sock.disconnectFromServer()
|
||||
return 0
|
||||
|
||||
from .theme import init_theme
|
||||
init_theme()
|
||||
from .library import init_library
|
||||
init_library()
|
||||
from .mainwindow import MainWindow
|
||||
|
||||
win = MainWindow()
|
||||
win.show()
|
||||
|
||||
server = QLocalServer()
|
||||
QLocalServer.removeServer(server_name)
|
||||
server.listen(server_name)
|
||||
|
||||
def incoming():
|
||||
c = server.nextPendingConnection()
|
||||
if c is None:
|
||||
return
|
||||
|
||||
def read():
|
||||
try:
|
||||
items = json.loads(bytes(c.readAll()).decode() or "[]")
|
||||
except ValueError:
|
||||
items = []
|
||||
items = [i for i in items if i != "--raise"]
|
||||
win.handle_args(items)
|
||||
win.show()
|
||||
win.raise_()
|
||||
win.activateWindow()
|
||||
c.readyRead.connect(read)
|
||||
server.newConnection.connect(incoming)
|
||||
|
||||
if args:
|
||||
win.handle_args([os.path.abspath(a) if os.path.exists(a) else a for a in args])
|
||||
rc = app.exec()
|
||||
server.close()
|
||||
return rc
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
5
mulberry/assets/mulberry.svg
Normal file
5
mulberry/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 |
371
mulberry/cd.py
Normal file
371
mulberry/cd.py
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
"""Audio CD: drive detection, TOC reading, MusicBrainz disc lookup, playback
|
||||
songs and ripping (cdparanoia/icedax/mpv → FLAC/Opus/MP3/Vorbis/ALAC/WAV)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import glob
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt6.QtCore import QThread, pyqtSignal
|
||||
|
||||
from . import online
|
||||
from . import tags as T
|
||||
from .song import Song
|
||||
|
||||
|
||||
IS_WIN = os.name == "nt"
|
||||
|
||||
|
||||
def list_drives() -> list[str]:
|
||||
if IS_WIN:
|
||||
import ctypes
|
||||
import string
|
||||
out = []
|
||||
mask = ctypes.windll.kernel32.GetLogicalDrives()
|
||||
for i, letter in enumerate(string.ascii_uppercase):
|
||||
if mask & (1 << i) and ctypes.windll.kernel32.GetDriveTypeW(f"{letter}:\\") == 5: # DRIVE_CDROM
|
||||
out.append(f"{letter}:")
|
||||
return out
|
||||
drives = sorted(set(glob.glob("/dev/sr[0-9]*")))
|
||||
if not drives and os.path.exists("/dev/cdrom"):
|
||||
drives = ["/dev/cdrom"]
|
||||
return drives
|
||||
|
||||
|
||||
def compute_discid(first: int, last: int, leadout: int, offsets: list[int]) -> str:
|
||||
s = f"{first:02X}{last:02X}{leadout:08X}"
|
||||
offs = offsets + [0] * (99 - len(offsets))
|
||||
s += "".join(f"{o:08X}" for o in offs[:99])
|
||||
h = hashlib.sha1(s.encode("ascii")).digest()
|
||||
return base64.b64encode(h).decode().replace("+", ".").replace("/", "_").replace("=", "-")
|
||||
|
||||
|
||||
def read_toc(device: str) -> dict:
|
||||
"""Returns {'first','last','leadout','offsets','discid','tracks':[(n,start_s,len_s)]}."""
|
||||
try:
|
||||
import discid # python-discid (libdiscid)
|
||||
d = discid.read(device)
|
||||
offsets = [t.offset for t in d.tracks]
|
||||
toc = {"first": d.first_track_num, "last": d.last_track_num, "leadout": d.sectors,
|
||||
"offsets": offsets, "discid": d.id}
|
||||
except Exception: # noqa: BLE001
|
||||
toc = (_toc_windows(device) if IS_WIN else None) or _toc_cdparanoia(device) or _toc_cdinfo(device)
|
||||
if not toc:
|
||||
raise RuntimeError("No audio CD found (or no TOC reader available — install cdparanoia "
|
||||
"or libdiscid).")
|
||||
toc["discid"] = compute_discid(toc["first"], toc["last"], toc["leadout"], toc["offsets"])
|
||||
offs = toc["offsets"] + [toc["leadout"]]
|
||||
toc["tracks"] = [(toc["first"] + i, (offs[i] - offs[0]) / 75.0, (offs[i + 1] - offs[i]) / 75.0)
|
||||
for i in range(len(toc["offsets"]))]
|
||||
toc["device"] = device
|
||||
return toc
|
||||
|
||||
|
||||
def _toc_windows(device):
|
||||
"""Read the TOC with IOCTL_CDROM_READ_TOC (no extra tools needed)."""
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
k32 = ctypes.windll.kernel32
|
||||
k32.CreateFileW.restype = wintypes.HANDLE
|
||||
h = k32.CreateFileW(f"\\\\.\\{device.rstrip(':')}:", 0x80000000, 0x1 | 0x2, None, 3, 0, None)
|
||||
if h in (None, wintypes.HANDLE(-1).value):
|
||||
return None
|
||||
try:
|
||||
buf = (ctypes.c_ubyte * 804)()
|
||||
got = wintypes.DWORD()
|
||||
if not k32.DeviceIoControl(h, 0x24000, None, 0, buf, 804, ctypes.byref(got), None):
|
||||
return None
|
||||
first, last = buf[2], buf[3]
|
||||
entries = []
|
||||
for i in range(last - first + 2): # + lead-out (0xAA)
|
||||
base = 4 + i * 8
|
||||
control = buf[base + 1] >> 4
|
||||
num = buf[base + 2]
|
||||
m, s_, f = buf[base + 5], buf[base + 6], buf[base + 7]
|
||||
entries.append((num, control, (m * 60 + s_) * 75 + f))
|
||||
audio = [e for e in entries[:-1] if not e[1] & 0x4]
|
||||
if not audio:
|
||||
return None
|
||||
leadout = entries[-1][2]
|
||||
nxt = [e for e in entries[:-1] if e[0] > audio[-1][0]]
|
||||
if nxt: # enhanced CD: data session after audio
|
||||
leadout = nxt[0][2] - 11400
|
||||
return {"first": audio[0][0], "last": audio[-1][0], "leadout": leadout,
|
||||
"offsets": [e[2] for e in audio]}
|
||||
finally:
|
||||
k32.CloseHandle(h)
|
||||
|
||||
|
||||
def _toc_cdparanoia(device):
|
||||
exe = shutil.which("cdparanoia")
|
||||
if not exe:
|
||||
return None
|
||||
try:
|
||||
p = subprocess.run([exe, "-Q", "-d", device], capture_output=True, text=True, timeout=30)
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return None
|
||||
rows = re.findall(r"^\s*(\d+)\.\s+(\d+)\s+\[[^\]]+\]\s+(\d+)\s+\[", p.stderr + p.stdout, re.M)
|
||||
if not rows:
|
||||
return None
|
||||
nums = [int(r[0]) for r in rows]
|
||||
offsets = [int(r[2]) + 150 for r in rows]
|
||||
leadout = int(rows[-1][2]) + int(rows[-1][1]) + 150
|
||||
return {"first": nums[0], "last": nums[-1], "leadout": leadout, "offsets": offsets}
|
||||
|
||||
|
||||
def _toc_cdinfo(device):
|
||||
exe = shutil.which("cd-info")
|
||||
if not exe:
|
||||
return None
|
||||
try:
|
||||
p = subprocess.run([exe, "--no-header", "--no-device-info", "--no-cddb", "-C", device],
|
||||
capture_output=True, text=True, timeout=30)
|
||||
except (OSError, subprocess.TimeoutExpired):
|
||||
return None
|
||||
rows = re.findall(r"^\s*(\d+):\s+\d+:\d+:\d+\s+(\d+)\s+audio", p.stdout, re.M)
|
||||
lead = re.search(r"^\s*170:\s+\d+:\d+:\d+\s+(\d+)\s+leadout", p.stdout, re.M)
|
||||
if not rows or not lead:
|
||||
return None
|
||||
return {"first": int(rows[0][0]), "last": int(rows[-1][0]), "leadout": int(lead.group(1)) + 150,
|
||||
"offsets": [int(r[1]) + 150 for r in rows]}
|
||||
|
||||
|
||||
def musicbrainz_lookup(toc: dict) -> list[dict]:
|
||||
"""Return candidate releases: {'album','albumartist','year','mb_albumid','tracks':[{title,artist,mbid}]}"""
|
||||
tocstr = " ".join(str(x) for x in [toc["first"], toc["last"], toc["leadout"], *toc["offsets"]])
|
||||
try:
|
||||
r = online.mb_get(f"discid/{toc['discid']}", {"inc": "recordings+artist-credits", "toc": tocstr})
|
||||
except Exception: # noqa: BLE001
|
||||
return []
|
||||
releases = r.get("releases", []) if "releases" in r else ([r] if r.get("media") else [])
|
||||
out = []
|
||||
for rel in releases:
|
||||
aa = "".join(a.get("name", "") + a.get("joinphrase", "") for a in rel.get("artist-credit", []))
|
||||
for med in rel.get("media", []):
|
||||
discids = [d.get("id") for d in med.get("discs", [])]
|
||||
if discids and toc["discid"] not in discids and len(med.get("tracks", [])) != len(toc["offsets"]):
|
||||
continue
|
||||
tracks = []
|
||||
for t in med.get("tracks", []):
|
||||
ar = "".join(a.get("name", "") + a.get("joinphrase", "") for a in t.get("artist-credit", [])) or aa
|
||||
tracks.append({"title": t.get("title", ""), "artist": ar,
|
||||
"mbid": (t.get("recording") or {}).get("id", "")})
|
||||
out.append({"album": rel.get("title", ""), "albumartist": aa,
|
||||
"year": int((rel.get("date") or "0")[:4] or 0), "mb_albumid": rel.get("id", ""),
|
||||
"disc": med.get("position", 1), "tracks": tracks,
|
||||
"country": rel.get("country", "")})
|
||||
break
|
||||
return out
|
||||
|
||||
|
||||
def songs_for(toc: dict, release: dict | None, art: str = "") -> list[Song]:
|
||||
out = []
|
||||
for i, (n, start, length) in enumerate(toc["tracks"]):
|
||||
t = (release or {}).get("tracks", [])
|
||||
info = t[i] if i < len(t) else {}
|
||||
s = Song(url=f"cdda://{n}", title=info.get("title") or f"Track {n}",
|
||||
artist=info.get("artist", (release or {}).get("albumartist", "")),
|
||||
album=(release or {}).get("album", "Audio CD"),
|
||||
albumartist=(release or {}).get("albumartist", ""),
|
||||
year=(release or {}).get("year", 0), track=n, disc=(release or {}).get("disc", 0),
|
||||
length=length, begin=start, end=start + length, cd_track=n, cd_device=toc["device"],
|
||||
filetype="CDDA", samplerate=44100, bitdepth=16, channels=2, bitrate=1411,
|
||||
mb_trackid=info.get("mbid", ""), mb_albumid=(release or {}).get("mb_albumid", ""), art=art)
|
||||
out.append(s)
|
||||
return out
|
||||
|
||||
|
||||
def eject(device: str):
|
||||
if IS_WIN:
|
||||
import ctypes
|
||||
mci = ctypes.windll.winmm.mciSendStringW
|
||||
mci(f"open {device} type cdaudio alias mulberrycd", None, 0, None)
|
||||
mci("set mulberrycd door open", None, 0, None)
|
||||
mci("close mulberrycd", None, 0, None)
|
||||
return
|
||||
exe = shutil.which("eject")
|
||||
if exe:
|
||||
subprocess.Popen([exe, device])
|
||||
else:
|
||||
subprocess.Popen(["udisksctl", "eject", "-b", device] if shutil.which("udisksctl") else ["true"])
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ ripping
|
||||
FORMATS = {
|
||||
"flac": ("FLAC (lossless)", "flac", lambda q: ["-c:a", "flac", "-compression_level", str(min(max(q, 0), 12))]),
|
||||
"alac": ("ALAC (lossless, .m4a)", "m4a", lambda q: ["-c:a", "alac"]),
|
||||
"opus": ("Opus", "opus", lambda q: ["-c:a", "libopus", "-b:a", f"{[64, 96, 128, 160, 192, 256][min(max(q, 0), 5)]}k"]),
|
||||
"ogg": ("Ogg Vorbis", "ogg", lambda q: ["-c:a", "libvorbis", "-q:a", str(min(max(q, 0), 10))]),
|
||||
"mp3": ("MP3 (LAME VBR)", "mp3", lambda q: ["-c:a", "libmp3lame", "-q:a", str(max(0, 9 - min(q, 9)))]),
|
||||
"wav": ("WAV (uncompressed)", "wav", lambda q: ["-c:a", "pcm_s16le"]),
|
||||
}
|
||||
|
||||
|
||||
def rip_tools() -> dict:
|
||||
return {"cdparanoia": shutil.which("cdparanoia"), "icedax": shutil.which("icedax") or shutil.which("cdda2wav"),
|
||||
"mpv": shutil.which("mpv"), "ffmpeg": shutil.which("ffmpeg")}
|
||||
|
||||
|
||||
def _safe(s: str) -> str:
|
||||
return re.sub(r'[\\/:*?"<>|\x00-\x1f]', "_", s).strip(" .") or "Unknown"
|
||||
|
||||
|
||||
class Ripper(QThread):
|
||||
progress = pyqtSignal(int, int, str) # track idx, total, message
|
||||
track_done = pyqtSignal(str)
|
||||
finished_rip = pyqtSignal(bool, str)
|
||||
|
||||
def __init__(self, songs: list[Song], fmt: str, quality: int, outdir: str, pattern: str,
|
||||
cover: bytes | None = None):
|
||||
super().__init__()
|
||||
self.songs, self.fmt, self.quality = songs, fmt, quality
|
||||
self.outdir, self.pattern, self.cover = outdir, pattern, cover
|
||||
self.abort = False
|
||||
self.proc = None
|
||||
|
||||
def _finish_file(self, s: Song, out: Path):
|
||||
if self.fmt != "wav":
|
||||
try:
|
||||
T.write_tags(str(out), {"title": s.title, "artist": s.artist, "album": s.album,
|
||||
"albumartist": s.albumartist, "year": s.year, "track": s.track,
|
||||
"disc": s.disc, "mb_trackid": s.mb_trackid, "mb_albumid": s.mb_albumid})
|
||||
if self.cover:
|
||||
T.embed_cover(str(out), self.cover)
|
||||
except Exception as e: # noqa: BLE001
|
||||
print("tagging failed", e)
|
||||
if self.cover and not (out.parent / "cover.jpg").exists():
|
||||
(out.parent / "cover.jpg").write_bytes(self.cover)
|
||||
|
||||
def cancel(self):
|
||||
self.abort = True
|
||||
m = getattr(self, "_mpv", None)
|
||||
if m is not None:
|
||||
try:
|
||||
m.command("stop")
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
if self.proc and self.proc.poll() is None:
|
||||
self.proc.terminate()
|
||||
|
||||
def _grab(self, s: Song, wav: str):
|
||||
tools = rip_tools()
|
||||
dev = s.cd_device
|
||||
if tools["cdparanoia"]:
|
||||
cmd = [tools["cdparanoia"], "-q", "-d", dev, str(s.cd_track), wav]
|
||||
elif tools["icedax"]:
|
||||
cmd = [tools["icedax"], "-D", dev, "-t", str(s.cd_track), "-O", "wav", "-q", wav]
|
||||
elif tools["mpv"]:
|
||||
cmd = [tools["mpv"], "--no-config", "--vo=null", f"--cdrom-device={dev}", "cdda://",
|
||||
f"--start={s.begin:.3f}", f"--end={s.end:.3f}", "--ao=pcm", f"--ao-pcm-file={wav}"]
|
||||
else:
|
||||
raise RuntimeError("No CD reader found. Install cdparanoia (recommended).")
|
||||
self.proc = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
_, err = self.proc.communicate()
|
||||
if self.abort:
|
||||
raise RuntimeError("Cancelled")
|
||||
if self.proc.returncode != 0 or not os.path.exists(wav):
|
||||
raise RuntimeError(f"Reading track {s.cd_track} failed: {err.decode(errors='replace')[-300:]}")
|
||||
|
||||
MPV_CODECS = {"flac": "flac", "alac": "alac", "opus": "libopus", "ogg": "libvorbis",
|
||||
"mp3": "libmp3lame", "wav": "pcm_s16le"}
|
||||
|
||||
def _mpv_encode(self, s: Song, out: Path):
|
||||
"""Read + encode in one go with libmpv's encoding mode (works on
|
||||
Windows without cdparanoia/ffmpeg)."""
|
||||
from .player import mpv_available
|
||||
if not mpv_available():
|
||||
raise RuntimeError("No CD reader found. Install mpv (libmpv), or cdparanoia + ffmpeg.")
|
||||
import mpv
|
||||
q = self.quality
|
||||
opts = {}
|
||||
if self.fmt == "opus":
|
||||
opts["oacopts"] = f"b={[64, 96, 128, 160, 192, 256][min(max(q, 0), 5)]}000"
|
||||
elif self.fmt in ("ogg", "mp3"):
|
||||
opts["oacopts"] = f"b={[128, 160, 192, 224, 256, 320][min(max(q // 2, 0), 5)]}000"
|
||||
elif self.fmt == "flac":
|
||||
opts["oacopts"] = f"compression_level={min(max(q, 0), 12)}"
|
||||
m = mpv.MPV(video=False, vo="null", terminal=False, config=False, o=str(out),
|
||||
oac=self.MPV_CODECS[self.fmt], cdrom_device=s.cd_device,
|
||||
start=f"{s.begin:.3f}", end=f"{s.end:.3f}", **opts)
|
||||
self._mpv = m
|
||||
try:
|
||||
m.play("cdda://")
|
||||
m.wait_for_playback()
|
||||
finally:
|
||||
self._mpv = None
|
||||
m.terminate()
|
||||
if self.abort:
|
||||
raise RuntimeError("Cancelled")
|
||||
if not out.exists() or out.stat().st_size < 1024:
|
||||
raise RuntimeError(f"Ripping track {s.cd_track} failed")
|
||||
|
||||
def run(self):
|
||||
ff = shutil.which("ffmpeg")
|
||||
tools = rip_tools()
|
||||
classic = bool(ff and (tools["cdparanoia"] or tools["icedax"] or tools["mpv"]))
|
||||
if not classic:
|
||||
from .player import mpv_available
|
||||
if not mpv_available():
|
||||
self.finished_rip.emit(False, "Ripping needs cdparanoia + ffmpeg, or mpv (libmpv).")
|
||||
return
|
||||
label, ext, args = FORMATS[self.fmt]
|
||||
tmp = tempfile.mkdtemp(prefix="mulberry-rip-")
|
||||
try:
|
||||
for i, s in enumerate(self.songs):
|
||||
if self.abort:
|
||||
break
|
||||
vals = {"title": _safe(s.title), "artist": _safe(s.display_artist()), "album": _safe(s.album),
|
||||
"albumartist": _safe(s.effective_albumartist() or "Various Artists"),
|
||||
"year": s.year, "track": s.track, "disc": s.disc}
|
||||
try:
|
||||
rel = self.pattern.format(**vals)
|
||||
except (KeyError, ValueError, IndexError):
|
||||
rel = f"{vals['albumartist']}/{vals['album']}/{s.track:02d} - {vals['title']}"
|
||||
out = Path(self.outdir) / f"{rel}.{ext}"
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
self.progress.emit(i, len(self.songs), f"Reading track {s.track}: {s.title}")
|
||||
wav = os.path.join(tmp, f"t{s.cd_track}.wav")
|
||||
if not classic:
|
||||
self._mpv_encode(s, out)
|
||||
self._finish_file(s, out)
|
||||
self.track_done.emit(str(out))
|
||||
continue
|
||||
self._grab(s, wav)
|
||||
self.progress.emit(i, len(self.songs), f"Encoding {out.name}")
|
||||
if self.fmt == "wav" and not ff:
|
||||
shutil.move(wav, out)
|
||||
else:
|
||||
cmd = [ff, "-y", "-loglevel", "error", "-i", wav, *args(self.quality), str(out)]
|
||||
self.proc = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
||||
_, err = self.proc.communicate()
|
||||
if self.proc.returncode != 0:
|
||||
raise RuntimeError(f"Encoding failed: {err.decode(errors='replace')[-300:]}")
|
||||
if self.fmt != "wav":
|
||||
try:
|
||||
T.write_tags(str(out), {"title": s.title, "artist": s.artist, "album": s.album,
|
||||
"albumartist": s.albumartist, "year": s.year,
|
||||
"track": s.track, "disc": s.disc,
|
||||
"mb_trackid": s.mb_trackid, "mb_albumid": s.mb_albumid})
|
||||
if self.cover:
|
||||
T.embed_cover(str(out), self.cover)
|
||||
except Exception as e: # noqa: BLE001
|
||||
print("tagging failed", e)
|
||||
if self.cover and not (out.parent / "cover.jpg").exists():
|
||||
(out.parent / "cover.jpg").write_bytes(self.cover)
|
||||
try:
|
||||
os.remove(wav)
|
||||
except OSError:
|
||||
pass
|
||||
self.track_done.emit(str(out))
|
||||
self.progress.emit(len(self.songs), len(self.songs), "Done")
|
||||
self.finished_rip.emit(not self.abort, "Cancelled" if self.abort else f"Ripped {len(self.songs)} tracks")
|
||||
except Exception as e: # noqa: BLE001
|
||||
self.finished_rip.emit(False, str(e))
|
||||
finally:
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
67
mulberry/clock.py
Normal file
67
mulberry/clock.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
"""One shared, display-rate animation clock.
|
||||
|
||||
Every animated thing (spectrum analysis, cover, wavy bar, lyrics scroll, the
|
||||
floating shape) runs off this single timer so frames stay in lock-step instead
|
||||
of two timers beating against each other. Subscribers receive `dt` in seconds
|
||||
and should animate by time, not by tick count, so jitter never shows as stutter.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
from PyQt6.QtCore import Qt, QTimer
|
||||
from PyQt6.QtGui import QGuiApplication
|
||||
|
||||
|
||||
class FrameClock:
|
||||
_timer: QTimer | None = None
|
||||
_pre: dict = {} # run first (data producers, e.g. spectrum)
|
||||
_subs: dict = {} # then painters
|
||||
_last = 0.0
|
||||
dt = 1 / 60
|
||||
|
||||
@classmethod
|
||||
def _ensure(cls):
|
||||
if cls._timer is None:
|
||||
cls._timer = QTimer()
|
||||
cls._timer.setTimerType(Qt.TimerType.PreciseTimer)
|
||||
hz = 60.0
|
||||
try:
|
||||
scr = QGuiApplication.primaryScreen()
|
||||
if scr is not None and scr.refreshRate() > 30:
|
||||
hz = min(scr.refreshRate(), 165.0)
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
cls._timer.setInterval(max(5, int(1000 / hz)))
|
||||
cls._timer.timeout.connect(cls._tick)
|
||||
|
||||
@classmethod
|
||||
def subscribe(cls, fn, pre=False):
|
||||
cls._ensure()
|
||||
(cls._pre if pre else cls._subs)[fn] = True
|
||||
if not cls._timer.isActive():
|
||||
cls._last = time.monotonic()
|
||||
cls._timer.start()
|
||||
|
||||
@classmethod
|
||||
def unsubscribe(cls, fn):
|
||||
cls._pre.pop(fn, None)
|
||||
cls._subs.pop(fn, None)
|
||||
if not cls._pre and not cls._subs and cls._timer:
|
||||
cls._timer.stop()
|
||||
|
||||
@classmethod
|
||||
def is_subscribed(cls, fn) -> bool:
|
||||
return fn in cls._pre or fn in cls._subs
|
||||
|
||||
@classmethod
|
||||
def _tick(cls):
|
||||
now = time.monotonic()
|
||||
dt = now - cls._last
|
||||
cls._last = now
|
||||
# clamp: after a stall don't jump animations forward
|
||||
cls.dt = dt = max(1 / 240, min(dt, 1 / 20))
|
||||
for fn in list(cls._pre):
|
||||
fn(dt)
|
||||
for fn in list(cls._subs):
|
||||
fn(dt)
|
||||
223
mulberry/config.py
Normal file
223
mulberry/config.py
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
"""Paths, settings and small shared helpers."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt6.QtCore import QObject, QRunnable, QSettings, QThreadPool, pyqtSignal
|
||||
|
||||
APP_NAME = "Mulberry"
|
||||
APP_ID = "mulberry"
|
||||
VERSION = "1.1.0"
|
||||
USER_AGENT = f"{APP_NAME}/{VERSION} ( https://github.com/mulberry-player )"
|
||||
|
||||
IS_WIN = sys.platform == "win32"
|
||||
IS_MAC = sys.platform == "darwin"
|
||||
IS_LINUX = not IS_WIN and not IS_MAC
|
||||
FROZEN = bool(getattr(sys, "frozen", False))
|
||||
# folder holding bundled extras (libmpv dll, assets) in a PyInstaller build
|
||||
BUNDLE_DIR = Path(getattr(sys, "_MEIPASS", Path(__file__).resolve().parent.parent))
|
||||
|
||||
|
||||
def _xdg(var: str, default: str) -> Path:
|
||||
return Path(os.environ.get(var) or os.path.expanduser(default))
|
||||
|
||||
|
||||
if IS_WIN:
|
||||
_roaming = Path(os.environ.get("APPDATA") or Path.home() / "AppData" / "Roaming")
|
||||
_local = Path(os.environ.get("LOCALAPPDATA") or Path.home() / "AppData" / "Local")
|
||||
CONFIG_DIR = _roaming / APP_NAME
|
||||
DATA_DIR = _local / APP_NAME
|
||||
CACHE_DIR = _local / APP_NAME / "cache"
|
||||
elif IS_MAC:
|
||||
_sup = Path.home() / "Library" / "Application Support" / APP_NAME
|
||||
CONFIG_DIR, DATA_DIR = _sup, _sup
|
||||
CACHE_DIR = Path.home() / "Library" / "Caches" / APP_NAME
|
||||
else:
|
||||
CONFIG_DIR = _xdg("XDG_CONFIG_HOME", "~/.config") / APP_ID
|
||||
DATA_DIR = _xdg("XDG_DATA_HOME", "~/.local/share") / APP_ID
|
||||
CACHE_DIR = _xdg("XDG_CACHE_HOME", "~/.cache") / APP_ID
|
||||
COVER_DIR = DATA_DIR / "covers"
|
||||
THUMB_DIR = CACHE_DIR / "thumbs"
|
||||
DB_PATH = DATA_DIR / "library.db"
|
||||
SCROBBLE_CACHE = DATA_DIR / "scrobble_cache.json"
|
||||
|
||||
for _d in (CONFIG_DIR, DATA_DIR, CACHE_DIR, COVER_DIR, THUMB_DIR):
|
||||
_d.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
AUDIO_EXTS = {
|
||||
"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",
|
||||
}
|
||||
PLAYLIST_EXTS = {"m3u", "m3u8", "pls", "xspf", "wpl", "asx", "cue"}
|
||||
|
||||
|
||||
class Settings:
|
||||
"""Thin typed wrapper around QSettings with defaults."""
|
||||
|
||||
DEFAULTS = {
|
||||
"library/folders": [],
|
||||
"library/scan_on_start": True,
|
||||
"library/grouping": "albumartist_album",
|
||||
"playback/backend": "auto", # auto (mpv on Linux, Qt on Windows) | mpv | qt
|
||||
"playback/device": "",
|
||||
"playback/volume": 70,
|
||||
"playback/replaygain": "off", # off | track | album
|
||||
"playback/rg_preamp": 0.0,
|
||||
"playback/gapless": True,
|
||||
"playback/eq_enabled": False,
|
||||
"playback/eq_bands": [0.0] * 10,
|
||||
"playback/eq_preamp": 0.0,
|
||||
"playback/repeat": "off", # off | track | playlist
|
||||
"playback/shuffle": False,
|
||||
"playback/resume": True,
|
||||
"appearance/color_source": "kde", # kde (= follow system) | album | custom
|
||||
"appearance/mode": "kde", # kde | dark | light
|
||||
"appearance/custom_color": "#9a7fd1",
|
||||
"appearance/hero": "full", # full | compact | hidden
|
||||
"appearance/playlist_art_bg": True,
|
||||
"appearance/visualizer": True,
|
||||
"appearance/analyzer": True,
|
||||
"appearance/font": "",
|
||||
"appearance/notifications": True,
|
||||
"appearance/tray": True,
|
||||
"lastfm/enabled": False,
|
||||
"lastfm/api_key": "",
|
||||
"lastfm/use_own_key": False,
|
||||
"lastfm/api_secret": "",
|
||||
"lastfm/session": "",
|
||||
"lastfm/user": "",
|
||||
"listenbrainz/enabled": False,
|
||||
"listenbrainz/token": "",
|
||||
"online/auto_lyrics": True,
|
||||
"lyrics/source": "auto", # auto | lrclib | netease | local | embedded
|
||||
"lyrics/plain": False,
|
||||
"appearance/floating_shape": True,
|
||||
"online/auto_covers": True,
|
||||
"online/save_covers_to_folder": False,
|
||||
"online/acoustid_key": "",
|
||||
"cd/device": "",
|
||||
"cd/rip_format": "flac",
|
||||
"cd/rip_quality": 5,
|
||||
"cd/rip_dir": str(Path.home() / "Music"),
|
||||
"cd/rip_pattern": "{albumartist}/{album}/{track:02d} - {title}",
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
self.q = QSettings(str(CONFIG_DIR / "mulberry.conf"), QSettings.Format.IniFormat)
|
||||
|
||||
def get(self, key: str, default=None):
|
||||
d = self.DEFAULTS.get(key, default)
|
||||
v = self.q.value(key, d)
|
||||
if v is None:
|
||||
return d
|
||||
if isinstance(d, bool):
|
||||
return v if isinstance(v, bool) else str(v).lower() in ("1", "true", "yes")
|
||||
if isinstance(d, int) and not isinstance(d, bool):
|
||||
try:
|
||||
return int(v)
|
||||
except (TypeError, ValueError):
|
||||
return d
|
||||
if isinstance(d, float):
|
||||
try:
|
||||
return float(v)
|
||||
except (TypeError, ValueError):
|
||||
return d
|
||||
if isinstance(d, list):
|
||||
if isinstance(v, str):
|
||||
v = [v] if v else []
|
||||
if d and isinstance(d[0], float):
|
||||
try:
|
||||
return [float(x) for x in v]
|
||||
except (TypeError, ValueError):
|
||||
return d
|
||||
return list(v)
|
||||
return v
|
||||
|
||||
def set(self, key: str, value):
|
||||
self.q.setValue(key, value)
|
||||
|
||||
def raw(self):
|
||||
return self.q
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- async helper
|
||||
class _Signals(QObject):
|
||||
done = pyqtSignal(object)
|
||||
failed = pyqtSignal(str)
|
||||
|
||||
|
||||
class _Job(QRunnable):
|
||||
def __init__(self, fn, args, kwargs):
|
||||
super().__init__()
|
||||
self.fn, self.args, self.kwargs = fn, args, kwargs
|
||||
self.sig = _Signals()
|
||||
self.setAutoDelete(True)
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
res = self.fn(*self.args, **self.kwargs)
|
||||
except Exception as e: # noqa: BLE001
|
||||
import urllib.error
|
||||
if not isinstance(e, (urllib.error.URLError, TimeoutError, OSError, RuntimeError)):
|
||||
traceback.print_exc()
|
||||
try:
|
||||
self.sig.failed.emit(str(e) or e.__class__.__name__)
|
||||
except RuntimeError:
|
||||
pass
|
||||
return
|
||||
try:
|
||||
self.sig.done.emit(res)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
|
||||
_jobs: set = set()
|
||||
_pool = QThreadPool()
|
||||
_pool.setMaxThreadCount(6)
|
||||
|
||||
|
||||
def run_async(fn, *args, on_done=None, on_error=None, **kwargs):
|
||||
"""Run fn in a worker thread; deliver result/error on the GUI thread."""
|
||||
job = _Job(fn, args, kwargs)
|
||||
sig = job.sig
|
||||
_jobs.add(sig)
|
||||
|
||||
def _finish(res):
|
||||
_jobs.discard(sig)
|
||||
if on_done:
|
||||
on_done(res)
|
||||
|
||||
def _fail(msg):
|
||||
_jobs.discard(sig)
|
||||
if on_error:
|
||||
on_error(msg)
|
||||
|
||||
sig.done.connect(_finish)
|
||||
sig.failed.connect(_fail)
|
||||
_pool.start(job)
|
||||
return sig
|
||||
|
||||
|
||||
def fmt_time(sec: float | int | None, force_hours=False) -> str:
|
||||
if sec is None or sec < 0:
|
||||
return "--:--"
|
||||
sec = int(sec)
|
||||
h, rem = divmod(sec, 3600)
|
||||
m, s = divmod(rem, 60)
|
||||
if h or force_hours:
|
||||
return f"{h}:{m:02d}:{s:02d}"
|
||||
return f"{m}:{s:02d}"
|
||||
|
||||
|
||||
def is_audio_file(path: str) -> bool:
|
||||
return Path(path).suffix.lower().lstrip(".") in AUDIO_EXTS
|
||||
91
mulberry/icondata.py
Normal file
91
mulberry/icondata.py
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
"""Material Symbols Rounded (Apache 2.0) path data, viewBox 0 -960 960 960."""
|
||||
PATHS = {
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
}
|
||||
86
mulberry/icons.py
Normal file
86
mulberry/icons.py
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
"""Theme-aware Material Symbols icons.
|
||||
|
||||
Icons are rendered from SVG path data at paint time using the *current* theme
|
||||
colour for their role, so they recolour automatically when KDE colours change.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from PyQt6.QtCore import QByteArray, QRectF, QSize, Qt
|
||||
from PyQt6.QtGui import QColor, QIcon, QIconEngine, QPainter, QPixmap
|
||||
from PyQt6.QtSvg import QSvgRenderer
|
||||
|
||||
from . import theme as T
|
||||
from .icondata import PATHS
|
||||
|
||||
_renderers: dict[str, QSvgRenderer] = {}
|
||||
|
||||
|
||||
def _renderer(name: str, color: QColor) -> QSvgRenderer:
|
||||
key = f"{name}:{color.name(QColor.NameFormat.HexArgb)}"
|
||||
r = _renderers.get(key)
|
||||
if r is None:
|
||||
d = PATHS.get(name) or PATHS["music_note"]
|
||||
op = color.alphaF()
|
||||
svg = (f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960">'
|
||||
f'<path fill="{color.name()}" fill-opacity="{op:.3f}" d="{d}"/></svg>')
|
||||
r = QSvgRenderer(QByteArray(svg.encode()))
|
||||
if len(_renderers) > 600:
|
||||
_renderers.clear()
|
||||
_renderers[key] = r
|
||||
return r
|
||||
|
||||
|
||||
def paint_icon(p: QPainter, rect: QRectF, name: str, color: QColor):
|
||||
_renderer(name, color).render(p, QRectF(rect))
|
||||
|
||||
|
||||
def role_color(role: str | QColor) -> QColor:
|
||||
if isinstance(role, QColor):
|
||||
return role
|
||||
if T.theme is None:
|
||||
return QColor("#cccccc")
|
||||
return T.theme.c.get(role, T.theme.c["onSurface"])
|
||||
|
||||
|
||||
class MaterialIconEngine(QIconEngine):
|
||||
def __init__(self, name: str, role: str | QColor = "onSurfaceVariant",
|
||||
checked_name: str | None = None, checked_role: str | QColor | None = None):
|
||||
super().__init__()
|
||||
self.name, self.role = name, role
|
||||
self.checked_name = checked_name
|
||||
self.checked_role = checked_role
|
||||
|
||||
def paint(self, p: QPainter, rect, mode, state):
|
||||
on = state == QIcon.State.On
|
||||
name = self.checked_name if (on and self.checked_name) else self.name
|
||||
col = QColor(role_color(self.checked_role if (on and self.checked_role) else self.role))
|
||||
if mode == QIcon.Mode.Disabled:
|
||||
col.setAlphaF(0.38)
|
||||
elif mode == QIcon.Mode.Selected and T.theme is not None:
|
||||
col = QColor(T.theme.c["onSecondaryContainer"])
|
||||
p.save()
|
||||
p.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
paint_icon(p, QRectF(rect), name, col)
|
||||
p.restore()
|
||||
|
||||
def pixmap(self, size: QSize, mode, state):
|
||||
pm = QPixmap(size)
|
||||
pm.fill(Qt.GlobalColor.transparent)
|
||||
p = QPainter(pm)
|
||||
self.paint(p, pm.rect(), mode, state)
|
||||
p.end()
|
||||
return pm
|
||||
|
||||
def scaledPixmap(self, size, mode, state, scale):
|
||||
s = QSize(int(size.width() * scale), int(size.height() * scale))
|
||||
pm = self.pixmap(s, mode, state)
|
||||
pm.setDevicePixelRatio(scale)
|
||||
return pm
|
||||
|
||||
def clone(self):
|
||||
return MaterialIconEngine(self.name, self.role, self.checked_name, self.checked_role)
|
||||
|
||||
|
||||
def icon(name: str, role: str | QColor = "onSurfaceVariant", checked: str | None = None,
|
||||
checked_role: str | QColor | None = None) -> QIcon:
|
||||
return QIcon(MaterialIconEngine(name, role, checked, checked_role))
|
||||
13
mulberry/lastfm_app.py
Normal file
13
mulberry/lastfm_app.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"""Application-wide Last.fm API credentials.
|
||||
|
||||
Last.fm gives every *application* its own API key. If you register Mulberry once
|
||||
at https://www.last.fm/api/account/create (any name/description, callback URL can
|
||||
be left empty) and paste the key + shared secret below, the "Log in with
|
||||
Last.fm" button works for every user without them touching keys.
|
||||
|
||||
They can also be supplied without editing code via the environment variables
|
||||
MULBERRY_LASTFM_KEY / MULBERRY_LASTFM_SECRET or the file
|
||||
~/.config/mulberry/lastfm_app.json -> {"key": "...", "secret": "..."}
|
||||
"""
|
||||
API_KEY = ""
|
||||
API_SECRET = ""
|
||||
430
mulberry/library.py
Normal file
430
mulberry/library.py
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
"""SQLite-backed music collection with an incremental background scanner."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sqlite3
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt6.QtCore import QObject, QThread, pyqtSignal
|
||||
|
||||
from .config import AUDIO_EXTS, DB_PATH, settings
|
||||
from .song import Song
|
||||
from . import tags as T
|
||||
|
||||
SONG_COLS = ("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").split()
|
||||
|
||||
SCHEMA = f"""
|
||||
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);
|
||||
"""
|
||||
|
||||
DEFAULT_RADIO = [
|
||||
("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"),
|
||||
]
|
||||
|
||||
|
||||
def connect() -> sqlite3.Connection:
|
||||
con = sqlite3.connect(str(DB_PATH), timeout=30, check_same_thread=False)
|
||||
con.row_factory = sqlite3.Row
|
||||
con.execute("PRAGMA journal_mode=WAL")
|
||||
con.execute("PRAGMA synchronous=NORMAL")
|
||||
con.execute("PRAGMA temp_store=MEMORY")
|
||||
return con
|
||||
|
||||
|
||||
def row_to_song(r: sqlite3.Row) -> Song:
|
||||
d = {k: r[k] for k in r.keys() if k in SONG_COLS or k == "id"}
|
||||
for k, v in list(d.items()):
|
||||
if v is None and k not in ("rg_track", "rg_album"):
|
||||
d[k] = "" if k in ("title", "artist", "album", "albumartist", "genre", "composer",
|
||||
"comment", "filetype", "art", "mb_trackid", "mb_albumid") else 0
|
||||
return Song.from_dict(d)
|
||||
|
||||
|
||||
class Library(QObject):
|
||||
changed = pyqtSignal()
|
||||
scan_progress = pyqtSignal(int, int, str) # done, total, current
|
||||
scan_finished = pyqtSignal(int, int, int) # added, updated, removed
|
||||
song_updated = pyqtSignal(object)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.con = connect()
|
||||
self.lock = threading.RLock()
|
||||
with self.lock:
|
||||
self.con.executescript(SCHEMA)
|
||||
if not self.con.execute("SELECT 1 FROM radio LIMIT 1").fetchone():
|
||||
if not self.kv("radio_seeded"):
|
||||
self.con.executemany("INSERT INTO radio(name,url,ui_order) VALUES (?,?,?)",
|
||||
[(n, u, i) for i, (n, u) in enumerate(DEFAULT_RADIO)])
|
||||
self.set_kv("radio_seeded", "1")
|
||||
self.con.commit()
|
||||
self._scanner: Scanner | None = None
|
||||
|
||||
# ------------------------------------------------------------ kv
|
||||
def kv(self, k, default=None):
|
||||
r = self.con.execute("SELECT v FROM kv WHERE k=?", (k,)).fetchone()
|
||||
return r[0] if r else default
|
||||
|
||||
def set_kv(self, k, v):
|
||||
with self.lock:
|
||||
self.con.execute("INSERT OR REPLACE INTO kv(k,v) VALUES (?,?)", (k, str(v)))
|
||||
self.con.commit()
|
||||
|
||||
# ------------------------------------------------------------ queries
|
||||
def query(self, sql, args=()):
|
||||
with self.lock:
|
||||
return self.con.execute(sql, args).fetchall()
|
||||
|
||||
def count(self) -> tuple[int, float]:
|
||||
r = self.query("SELECT COUNT(*), COALESCE(SUM(length),0) FROM songs WHERE unavailable=0")[0]
|
||||
return r[0], r[1]
|
||||
|
||||
def songs_where(self, where="1", args=(), order="albumartist COLLATE NOCASE, album COLLATE NOCASE, disc, track, title"):
|
||||
rows = self.query(f"SELECT * FROM songs WHERE unavailable=0 AND ({where}) ORDER BY {order}", args)
|
||||
return [row_to_song(r) for r in rows]
|
||||
|
||||
def song_by_url(self, url: str) -> Song | None:
|
||||
r = self.query("SELECT * FROM songs WHERE url=?", (url,))
|
||||
return row_to_song(r[0]) if r else None
|
||||
|
||||
def filter_clause(self, text: str):
|
||||
"""Build WHERE for a search string. Supports field:value tokens."""
|
||||
text = (text or "").strip()
|
||||
if not text:
|
||||
return "1", ()
|
||||
clauses, args = [], []
|
||||
fields_map = {"artist": "artist", "album": "album", "title": "title", "genre": "genre",
|
||||
"year": "year", "albumartist": "albumartist", "composer": "composer",
|
||||
"type": "filetype", "rating": "rating"}
|
||||
for tok in text.split():
|
||||
if ":" in tok:
|
||||
f, v = tok.split(":", 1)
|
||||
if f.lower() in fields_map and v:
|
||||
col = fields_map[f.lower()]
|
||||
if col in ("year", "rating"):
|
||||
op = ">=" if v.startswith(">") else "<=" if v.startswith("<") else "="
|
||||
clauses.append(f"{col} {op} ?")
|
||||
args.append(int(v.lstrip("<>=") or 0))
|
||||
else:
|
||||
clauses.append(f"{col} LIKE ?")
|
||||
args.append(f"%{v}%")
|
||||
continue
|
||||
clauses.append("(title LIKE ? OR artist LIKE ? OR album LIKE ? OR albumartist LIKE ? OR genre LIKE ? OR composer LIKE ?)")
|
||||
args += [f"%{tok}%"] * 6
|
||||
return " AND ".join(clauses), tuple(args)
|
||||
|
||||
# ------------------------------------------------------------ updates
|
||||
def update_fields(self, song_id: int, **vals):
|
||||
if song_id < 0 or not vals:
|
||||
return
|
||||
cols = ", ".join(f"{k}=?" for k in vals)
|
||||
with self.lock:
|
||||
self.con.execute(f"UPDATE songs SET {cols} WHERE id=?", (*vals.values(), song_id))
|
||||
self.con.commit()
|
||||
|
||||
def mark_played(self, song: Song):
|
||||
if song.id < 0:
|
||||
return
|
||||
now = int(time.time())
|
||||
with self.lock:
|
||||
self.con.execute("UPDATE songs SET playcount=playcount+1, lastplayed=? WHERE id=?", (now, song.id))
|
||||
self.con.commit()
|
||||
song.playcount += 1
|
||||
song.lastplayed = now
|
||||
|
||||
def mark_skipped(self, song: Song):
|
||||
if song.id < 0:
|
||||
return
|
||||
with self.lock:
|
||||
self.con.execute("UPDATE songs SET skipcount=skipcount+1 WHERE id=?", (song.id,))
|
||||
self.con.commit()
|
||||
song.skipcount += 1
|
||||
|
||||
def set_rating(self, song: Song, rating: int):
|
||||
song.rating = rating
|
||||
self.update_fields(song.id, rating=rating)
|
||||
self.song_updated.emit(song)
|
||||
|
||||
def reread(self, path: str) -> Song | None:
|
||||
"""Re-read tags for one file after editing and persist."""
|
||||
s = T.read_song(path)
|
||||
if s is None:
|
||||
return None
|
||||
old = self.song_by_url(path)
|
||||
if old:
|
||||
s.id, s.playcount, s.skipcount, s.lastplayed, s.rating, s.added = (
|
||||
old.id, old.playcount, old.skipcount, old.lastplayed, old.rating, old.added)
|
||||
s.art = old.art
|
||||
self._upsert(self.con, s)
|
||||
self.con.commit()
|
||||
self.song_updated.emit(s)
|
||||
self.changed.emit()
|
||||
return s
|
||||
|
||||
def set_album_art(self, artist: str, album: str, art_path: str):
|
||||
with self.lock:
|
||||
self.con.execute("UPDATE songs SET art=? WHERE (albumartist=? OR (albumartist='' AND artist=?)) AND album=?",
|
||||
(art_path, artist, artist, album))
|
||||
self.con.commit()
|
||||
self.changed.emit()
|
||||
|
||||
@staticmethod
|
||||
def _upsert(con, s: Song):
|
||||
d = s.to_dict()
|
||||
vals = [getattr(s, c) for c in SONG_COLS]
|
||||
if s.id >= 0:
|
||||
con.execute(f"UPDATE songs SET {', '.join(c + '=?' for c in SONG_COLS)}, unavailable=0 WHERE id=?",
|
||||
(*vals, s.id))
|
||||
else:
|
||||
con.execute(f"INSERT OR REPLACE INTO songs({', '.join(SONG_COLS)}) VALUES ({', '.join('?' * len(SONG_COLS))})",
|
||||
vals)
|
||||
return d
|
||||
|
||||
# ------------------------------------------------------------ lyrics cache
|
||||
def get_lyrics(self, key: str):
|
||||
r = self.query("SELECT text, source FROM lyrics WHERE key=?", (key,))
|
||||
return (r[0][0], r[0][1]) if r else (None, None)
|
||||
|
||||
def put_lyrics(self, key: str, text: str, source: str):
|
||||
with self.lock:
|
||||
self.con.execute("INSERT OR REPLACE INTO lyrics(key,text,source,fetched) VALUES (?,?,?,?)",
|
||||
(key, text, source, int(time.time())))
|
||||
self.con.commit()
|
||||
|
||||
# ------------------------------------------------------------ playlists
|
||||
def load_playlists(self):
|
||||
return self.query("SELECT * FROM playlists ORDER BY ui_order, id")
|
||||
|
||||
def save_playlist(self, pid: int | None, name: str, songs: list[Song], ui_order=0, is_open=1,
|
||||
current=-1, favorite=0) -> int:
|
||||
items = json.dumps([s.to_dict() for s in songs], separators=(",", ":"))
|
||||
with self.lock:
|
||||
if pid is None or pid < 0:
|
||||
cur = self.con.execute("INSERT INTO playlists(name,ui_order,is_open,favorite,current,items) VALUES (?,?,?,?,?,?)",
|
||||
(name, ui_order, is_open, favorite, current, items))
|
||||
pid = cur.lastrowid
|
||||
else:
|
||||
self.con.execute("UPDATE playlists SET name=?, ui_order=?, is_open=?, favorite=?, current=?, items=? WHERE id=?",
|
||||
(name, ui_order, is_open, favorite, current, items, pid))
|
||||
self.con.commit()
|
||||
return pid
|
||||
|
||||
def update_playlist_meta(self, pid: int, name: str, ui_order: int, current: int, favorite: int):
|
||||
with self.lock:
|
||||
self.con.execute("UPDATE playlists SET name=?, ui_order=?, current=?, favorite=?, is_open=1 WHERE id=?",
|
||||
(name, ui_order, current, favorite, pid))
|
||||
self.con.commit()
|
||||
|
||||
def delete_playlist(self, pid: int):
|
||||
with self.lock:
|
||||
self.con.execute("DELETE FROM playlists WHERE id=?", (pid,))
|
||||
self.con.commit()
|
||||
|
||||
# ------------------------------------------------------------ radio
|
||||
def radios(self):
|
||||
return self.query("SELECT * FROM radio ORDER BY ui_order, id")
|
||||
|
||||
def add_radio(self, name, url):
|
||||
with self.lock:
|
||||
self.con.execute("INSERT INTO radio(name,url,ui_order) VALUES (?,?,999)", (name, url))
|
||||
self.con.commit()
|
||||
|
||||
def remove_radio(self, rid):
|
||||
with self.lock:
|
||||
self.con.execute("DELETE FROM radio WHERE id=?", (rid,))
|
||||
self.con.commit()
|
||||
|
||||
# ------------------------------------------------------------ scanning
|
||||
def scan(self, full=False):
|
||||
if self._scanner and self._scanner.isRunning():
|
||||
return
|
||||
folders = [f for f in settings.get("library/folders") if f]
|
||||
self._scanner = Scanner(folders, full)
|
||||
self._scanner.progress.connect(self.scan_progress)
|
||||
self._scanner.finished_scan.connect(self._scan_done)
|
||||
self._scanner.start(QThread.Priority.LowPriority)
|
||||
|
||||
def scanning(self) -> bool:
|
||||
return bool(self._scanner and self._scanner.isRunning())
|
||||
|
||||
def stop_scan(self):
|
||||
if self._scanner:
|
||||
self._scanner.abort = True
|
||||
self._scanner.wait(3000)
|
||||
|
||||
def _scan_done(self, a, u, r):
|
||||
self.scan_finished.emit(a, u, r)
|
||||
self.changed.emit()
|
||||
|
||||
|
||||
class Scanner(QThread):
|
||||
progress = pyqtSignal(int, int, str)
|
||||
finished_scan = pyqtSignal(int, int, int)
|
||||
|
||||
def __init__(self, folders, full):
|
||||
super().__init__()
|
||||
self.folders, self.full, self.abort = folders, full, False
|
||||
|
||||
def run(self):
|
||||
con = connect()
|
||||
known = {r["url"]: (r["id"], r["mtime"], r["art"]) for r in
|
||||
con.execute("SELECT id,url,mtime,art FROM songs")}
|
||||
files = []
|
||||
for folder in self.folders:
|
||||
for root, dirs, fnames in os.walk(folder, followlinks=True):
|
||||
if self.abort:
|
||||
return
|
||||
dirs[:] = [d for d in dirs if not d.startswith(".")]
|
||||
for fn in fnames:
|
||||
if fn.rsplit(".", 1)[-1].lower() in AUDIO_EXTS:
|
||||
files.append(os.path.join(root, fn))
|
||||
seen = set(files)
|
||||
added = updated = 0
|
||||
total = len(files)
|
||||
art_cache: dict[str, str] = {}
|
||||
dir_cover: dict[str, str | None] = {}
|
||||
now = int(time.time())
|
||||
batch = 0
|
||||
for i, path in enumerate(files):
|
||||
if self.abort:
|
||||
break
|
||||
try:
|
||||
mtime = os.stat(path).st_mtime
|
||||
except OSError:
|
||||
continue
|
||||
prev = known.get(path)
|
||||
if prev and not self.full and abs((prev[1] or 0) - mtime) < 1:
|
||||
continue
|
||||
if i % 25 == 0:
|
||||
self.progress.emit(i, total, path)
|
||||
s = T.read_song(path)
|
||||
if s is None:
|
||||
continue
|
||||
d = os.path.dirname(path)
|
||||
key = T.album_key(s.effective_albumartist(), s.album, d)
|
||||
if key in art_cache:
|
||||
s.art = art_cache[key]
|
||||
else:
|
||||
art = ""
|
||||
if d not in dir_cover:
|
||||
dir_cover[d] = T.find_folder_cover(d)
|
||||
src = dir_cover[d]
|
||||
data = None if src else T.extract_embedded_cover(path)
|
||||
if src or data:
|
||||
art = T.store_cover(src or data, key) or ""
|
||||
art_cache[key] = art
|
||||
s.art = art
|
||||
if prev:
|
||||
s.id = prev[0]
|
||||
cols = [c for c in SONG_COLS if c not in ("playcount", "skipcount", "lastplayed", "rating", "added")]
|
||||
con.execute(f"UPDATE songs SET {', '.join(c + '=?' for c in cols)}, unavailable=0 WHERE id=?",
|
||||
(*[getattr(s, c) for c in cols], s.id))
|
||||
updated += 1
|
||||
else:
|
||||
s.added = now
|
||||
con.execute(f"INSERT INTO songs({', '.join(SONG_COLS)}) VALUES ({', '.join('?' * len(SONG_COLS))})",
|
||||
[getattr(s, c) for c in SONG_COLS])
|
||||
added += 1
|
||||
batch += 1
|
||||
if batch >= 200:
|
||||
con.commit()
|
||||
batch = 0
|
||||
con.commit()
|
||||
removed = 0
|
||||
if not self.abort:
|
||||
in_folders = lambda u: any(u.startswith(f.rstrip("/") + "/") for f in self.folders) # noqa: E731
|
||||
gone = [(u,) for u in known if u not in seen]
|
||||
# songs outside configured folders get removed, missing ones too
|
||||
if gone:
|
||||
con.executemany("DELETE FROM songs WHERE url=?", gone)
|
||||
removed = len(gone)
|
||||
con.commit()
|
||||
_ = in_folders
|
||||
self.progress.emit(total, total, "")
|
||||
con.close()
|
||||
self.finished_scan.emit(added, updated, removed)
|
||||
|
||||
|
||||
library: Library | None = None
|
||||
|
||||
|
||||
def init_library() -> Library:
|
||||
global library
|
||||
library = Library()
|
||||
return library
|
||||
|
||||
|
||||
def scan_paths(paths: list[str]) -> list[Song]:
|
||||
"""Expand files/dirs to songs (used for drops & 'open'), using DB if known."""
|
||||
out: list[Song] = []
|
||||
files: list[str] = []
|
||||
for p in paths:
|
||||
if os.path.isdir(p):
|
||||
for root, dirs, fns in os.walk(p):
|
||||
dirs.sort()
|
||||
for fn in sorted(fns):
|
||||
if fn.rsplit(".", 1)[-1].lower() in AUDIO_EXTS:
|
||||
files.append(os.path.join(root, fn))
|
||||
else:
|
||||
files.append(p)
|
||||
lib_rows = {}
|
||||
if library is not None and files:
|
||||
con = connect()
|
||||
for i in range(0, len(files), 500):
|
||||
chunk = files[i:i + 500]
|
||||
q = f"SELECT * FROM songs WHERE url IN ({','.join('?' * len(chunk))})"
|
||||
for r in con.execute(q, chunk):
|
||||
lib_rows[r["url"]] = row_to_song(r)
|
||||
con.close()
|
||||
dir_art: dict[str, str] = {}
|
||||
for f in files:
|
||||
if f in lib_rows:
|
||||
out.append(lib_rows[f])
|
||||
continue
|
||||
s = T.read_song(f)
|
||||
if s is None:
|
||||
continue
|
||||
d = os.path.dirname(f)
|
||||
if d not in dir_art:
|
||||
src = T.find_folder_cover(d)
|
||||
key = T.album_key(s.effective_albumartist(), s.album, d)
|
||||
data = None if src else T.extract_embedded_cover(f)
|
||||
cached = Path(T.COVER_DIR / f"{key}.jpg")
|
||||
if cached.exists():
|
||||
dir_art[d] = str(cached)
|
||||
else:
|
||||
dir_art[d] = (T.store_cover(src or data, key) or "") if (src or data) else ""
|
||||
s.art = dir_art[d]
|
||||
out.append(s)
|
||||
return out
|
||||
869
mulberry/mainwindow.py
Normal file
869
mulberry/mainwindow.py
Normal file
|
|
@ -0,0 +1,869 @@
|
|||
"""Main window: wires library, playlists, player, hero, sidebar and services."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt6.QtCore import QByteArray, QEvent, QSize, Qt, QTimer, QUrl
|
||||
from PyQt6.QtGui import QAction, QDesktopServices, QIcon, QKeySequence, QPixmap, QShortcut
|
||||
from PyQt6.QtWidgets import (QApplication, QFileDialog, QHBoxLayout, QInputDialog, QLabel,
|
||||
QLineEdit, QMainWindow, QMenu, QMessageBox, QSplitter,
|
||||
QSystemTrayIcon, QToolButton, QVBoxLayout, QWidget)
|
||||
|
||||
from . import library as L
|
||||
from . import theme as Th
|
||||
from .config import APP_NAME, IS_LINUX, IS_WIN, fmt_time, settings
|
||||
from .icons import icon
|
||||
try: # MPRIS + freedesktop notifications (Linux); QtDBus isn't shipped on Windows
|
||||
from .mpris import Mpris, notify
|
||||
except ImportError:
|
||||
Mpris, notify = None, None
|
||||
from .nowplaying import NowPlaying
|
||||
from .player import Player
|
||||
from .playlist import PlaylistManager
|
||||
from .playlistio import EXPORT_FILTERS, IMPORT_FILTER, export_playlist
|
||||
from .scrobble import Scrobbler
|
||||
from .song import Song
|
||||
from .spectrum import Spectrum
|
||||
from .widgets.analyzer import Analyzer
|
||||
from .widgets.dialogs import (AboutDialog, BatchTagFetch, CoverManager, EqualizerDialog,
|
||||
MusicBrainzDialog, RipDialog, SettingsDialog, TagEditor)
|
||||
from .widgets.bassshape import BassShape
|
||||
from .widgets.hero import Hero
|
||||
from .widgets.m3 import IconButton, VolumeSlider, WavySlider
|
||||
from .widgets.playlistview import PlaylistArea, show_in_file_manager
|
||||
from .widgets.sidebar import Sidebar
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setWindowTitle(APP_NAME)
|
||||
self.setWindowIcon(app_icon())
|
||||
self.setAcceptDrops(True)
|
||||
self.current_art_path = ""
|
||||
self._quitting = False
|
||||
self._notif_id = 0
|
||||
|
||||
self.mgr = PlaylistManager()
|
||||
self.mgr.restore()
|
||||
self.player = Player(self.mgr)
|
||||
self.spectrum = Spectrum(64)
|
||||
if self.player.backend.provides_pcm:
|
||||
self.player.backend.pcm.connect(self.spectrum.push)
|
||||
self.np = NowPlaying(self.player)
|
||||
self.scrobbler = Scrobbler(self.player)
|
||||
self.scrobbler.status.connect(self.toast)
|
||||
self.player.message.connect(self.toast)
|
||||
self.player.state_changed.connect(self._on_state)
|
||||
self.player.song_changed.connect(self._on_song)
|
||||
self.np.art_changed.connect(self._on_art)
|
||||
|
||||
# ------------------------------------------------------------ layout
|
||||
self.sidebar = Sidebar()
|
||||
self.hero = Hero(self.player, self.np, self.spectrum, self.scrobbler)
|
||||
self.hero.open_menu.connect(lambda pos: self.player.song and self.song_menu(
|
||||
[self.player.song], pos, self.player.playlist))
|
||||
self.hero.cover_clicked.connect(self.toggle_focus_mode)
|
||||
self.area = PlaylistArea(self.mgr)
|
||||
self.area.play_requested.connect(lambda pl, s: self.player.play_song(pl, s))
|
||||
self.area.context_requested.connect(self._playlist_menu)
|
||||
self.area.tool["import"].clicked.connect(self.import_playlist)
|
||||
self.area.tool["export"].clicked.connect(lambda: self.export_playlist(self.mgr.current))
|
||||
|
||||
self.vsplit = QSplitter(Qt.Orientation.Vertical)
|
||||
self.vsplit.addWidget(self.hero)
|
||||
self.vsplit.addWidget(self.area)
|
||||
self.vsplit.setChildrenCollapsible(False)
|
||||
self.vsplit.setStretchFactor(0, 0)
|
||||
self.vsplit.setStretchFactor(1, 1)
|
||||
self.hsplit = QSplitter(Qt.Orientation.Horizontal)
|
||||
self.hsplit.addWidget(self.sidebar)
|
||||
self.hsplit.addWidget(self.vsplit)
|
||||
self.hsplit.setStretchFactor(1, 1)
|
||||
self.hsplit.setSizes([300, 1100])
|
||||
|
||||
bottom = QWidget()
|
||||
bl = QHBoxLayout(bottom)
|
||||
bl.setContentsMargins(14, 2, 14, 6)
|
||||
bl.setSpacing(10)
|
||||
self.summary = QLabel()
|
||||
self.summary.setObjectName("muted")
|
||||
self.toast_lbl = QLabel()
|
||||
self.toast_lbl.setObjectName("muted")
|
||||
self.analyzer = Analyzer(self.spectrum)
|
||||
self.mute_btn = QToolButton()
|
||||
self.mute_btn.setIcon(icon("volume_up"))
|
||||
self.mute_btn.clicked.connect(self.player.toggle_mute)
|
||||
self.vol = VolumeSlider()
|
||||
self.vol.setFixedWidth(130)
|
||||
self.vol.set_value(self.player.volume)
|
||||
self.vol.changed.connect(self.player.set_volume)
|
||||
self.vol_lbl = QLabel(f"{self.player.volume}%")
|
||||
self.vol_lbl.setObjectName("muted")
|
||||
self.vol_lbl.setMinimumWidth(38)
|
||||
self.player.volume_changed.connect(self._on_volume)
|
||||
self.mini = QWidget()
|
||||
ml = QHBoxLayout(self.mini)
|
||||
ml.setContentsMargins(0, 0, 0, 0)
|
||||
ml.setSpacing(4)
|
||||
self.mini_prev = IconButton("skip_previous_fill", "standard", 34, 22, tooltip="Previous")
|
||||
self.mini_play = IconButton("play_arrow_fill", "filled", 36, 22, wide=56, tooltip="Play / Pause")
|
||||
self.mini_next = IconButton("skip_next_fill", "standard", 34, 22, tooltip="Next")
|
||||
self.mini_wave = WavySlider()
|
||||
self.mini_wave.setFixedWidth(260)
|
||||
self.mini_time = QLabel("0:00")
|
||||
self.mini_time.setObjectName("muted")
|
||||
self.mini_prev.clicked.connect(self.player.prev)
|
||||
self.mini_play.clicked.connect(self.player.play_pause)
|
||||
self.mini_next.clicked.connect(self.player.next)
|
||||
self.mini_wave.seek_requested.connect(lambda v: self.player.seek(v * self.player.dur))
|
||||
self.player.position_changed.connect(lambda p, d: (self.mini_wave.set_value(p / d if d else 0, d),
|
||||
self.mini_time.setText(f"{fmt_time(p)} / {fmt_time(d)}")))
|
||||
for wdg in (self.mini_prev, self.mini_play, self.mini_next, self.mini_wave, self.mini_time):
|
||||
ml.addWidget(wdg)
|
||||
bl.addWidget(self.mini)
|
||||
bl.addWidget(self.summary)
|
||||
bl.addWidget(self.toast_lbl)
|
||||
bl.addWidget(self.analyzer, 1)
|
||||
bl.addWidget(self.mute_btn)
|
||||
bl.addWidget(self.vol)
|
||||
bl.addWidget(self.vol_lbl)
|
||||
|
||||
central = QWidget()
|
||||
cl = QVBoxLayout(central)
|
||||
cl.setContentsMargins(4, 0, 4, 0)
|
||||
cl.setSpacing(0)
|
||||
cl.addWidget(self.hsplit, 1)
|
||||
cl.addWidget(bottom)
|
||||
self.setCentralWidget(central)
|
||||
self.bottom_bar = bottom
|
||||
self.shape = BassShape(self.spectrum, self.player, central)
|
||||
self.shape.hide_requested.connect(lambda: self._set_shape(False))
|
||||
self.bottom_bar.installEventFilter(self)
|
||||
|
||||
self._toast_timer = QTimer(self, singleShot=True, interval=6000)
|
||||
self._toast_timer.timeout.connect(lambda: self.toast_lbl.setText(""))
|
||||
self.mgr.summary_changed.connect(self._summary)
|
||||
self.mgr.busy.connect(lambda b: self.toast("Adding files…") if b else None)
|
||||
self._summary()
|
||||
|
||||
# ------------------------------------------------------------ sidebar wiring
|
||||
sb = self.sidebar
|
||||
sb.library.add_songs.connect(self.add_songs)
|
||||
sb.library.context.connect(lambda songs, pos: self.song_menu(songs, pos, None))
|
||||
sb.files.add_paths.connect(self.add_paths)
|
||||
sb.playlists.open_smart.connect(self._open_smart)
|
||||
sb.playlists.open_saved.connect(self.mgr.reopen_saved)
|
||||
sb.radio.play_stream.connect(lambda s, mode: self.add_songs([s], mode))
|
||||
sb.cd.add_songs.connect(self.add_songs)
|
||||
sb.cd.rip.connect(lambda songs, cover: RipDialog(songs, cover, self).exec())
|
||||
sb.nav.set_current(settings.raw().value("ui/sidebar_tab", 0, int), animate=False)
|
||||
|
||||
self._build_menus()
|
||||
self._shortcuts()
|
||||
self.mpris = Mpris(self, self.player, self.mgr) if Mpris is not None else _NoMpris()
|
||||
self.media_keys = None
|
||||
if IS_WIN:
|
||||
try:
|
||||
from .winmedia import WindowsMediaKeys
|
||||
self.media_keys = WindowsMediaKeys(self.player)
|
||||
except Exception as e: # noqa: BLE001
|
||||
print("media keys unavailable:", e)
|
||||
self._tray()
|
||||
self.apply_layout_settings()
|
||||
self._restore_geometry()
|
||||
Th.theme.changed.connect(self._theme_changed)
|
||||
QApplication.instance().installEventFilter(self)
|
||||
|
||||
if settings.get("library/scan_on_start") and settings.get("library/folders"):
|
||||
QTimer.singleShot(1500, lambda: L.library.scan(False))
|
||||
QTimer.singleShot(0, self._resume)
|
||||
|
||||
# ================================================================ menus
|
||||
def _build_menus(self):
|
||||
mb = self.menuBar()
|
||||
m = mb.addMenu("&Music")
|
||||
self.act = {}
|
||||
|
||||
def A(menu, text, slot, shortcut=None, ic=None, checkable=False):
|
||||
a = QAction(text, self)
|
||||
if ic:
|
||||
a.setIcon(icon(ic))
|
||||
if shortcut:
|
||||
a.setShortcut(QKeySequence(shortcut))
|
||||
a.setCheckable(checkable)
|
||||
a.triggered.connect(slot)
|
||||
menu.addAction(a)
|
||||
return a
|
||||
|
||||
A(m, "Open files…", self.open_files, "Ctrl+O", "file_open")
|
||||
A(m, "Open folder…", self.open_folder, "Ctrl+Shift+O", "folder_open")
|
||||
A(m, "Open audio CD", lambda: self.sidebar.nav.set_current(4), None, "album")
|
||||
A(m, "Open stream URL…", self.open_url, "Ctrl+U", "link")
|
||||
m.addSeparator()
|
||||
A(m, "Previous", self.player.prev, "Ctrl+Left", "skip_previous_fill")
|
||||
self.act["play"] = A(m, "Play / Pause", self.player.play_pause, None, "play_arrow_fill")
|
||||
A(m, "Stop", self.player.stop, "Ctrl+Shift+S", "stop_fill")
|
||||
self.act["stop_after"] = A(m, "Stop after this track", self._stop_after, "Ctrl+Alt+V", "stop_circle", True)
|
||||
A(m, "Next", self.player.next, "Ctrl+Right", "skip_next_fill")
|
||||
A(m, "Seek forward 10 s", lambda: self.player.seek_relative(10), "Alt+Right")
|
||||
A(m, "Seek back 10 s", lambda: self.player.seek_relative(-10), "Alt+Left")
|
||||
A(m, "Volume up", lambda: self.player.set_volume(self.player.volume + 5), "Ctrl+Up", "volume_up")
|
||||
A(m, "Volume down", lambda: self.player.set_volume(self.player.volume - 5), "Ctrl+Down", "volume_down")
|
||||
A(m, "Mute", self.player.toggle_mute, "Ctrl+M", "volume_off")
|
||||
m.addSeparator()
|
||||
A(m, "Love current track", lambda: self.hero.love.click(), "Ctrl+L", "favorite")
|
||||
m.addSeparator()
|
||||
A(m, "Quit", self.quit_app, "Ctrl+Q", "close")
|
||||
|
||||
p = mb.addMenu("&Playlist")
|
||||
A(p, "New playlist", lambda: self.mgr.new_playlist(), "Ctrl+T", "playlist_add")
|
||||
A(p, "Import playlist…", self.import_playlist, "Ctrl+I", "file_open")
|
||||
A(p, "Export playlist…", lambda: self.export_playlist(self.mgr.current), "Ctrl+S", "save")
|
||||
A(p, "Close playlist", lambda: self.mgr.close_playlist(self.mgr.current), "Ctrl+W", "close")
|
||||
p.addSeparator()
|
||||
A(p, "Undo", lambda: self.mgr.current.undo.undo(), "Ctrl+Z", "undo")
|
||||
A(p, "Redo", lambda: self.mgr.current.undo.redo(), "Ctrl+Shift+Z", "redo")
|
||||
A(p, "Select all", lambda: self.area.view() and self.area.view().selectAll(), "Ctrl+A")
|
||||
A(p, "Filter…", lambda: self.area.filter.setFocus(), "Ctrl+F", "search")
|
||||
A(p, "Jump to playing track", self.area.jump_to_current, "Ctrl+J", "queue_play_next")
|
||||
A(p, "Queue selected tracks", self._queue_selected, "Ctrl+D", "queue_music")
|
||||
A(p, "Clear queue", self.mgr.clear_queue, None, "clear_all")
|
||||
p.addSeparator()
|
||||
A(p, "Shuffle playlist order", lambda: self.mgr.current.shuffle_items(), None, "shuffle")
|
||||
A(p, "Remove duplicates", lambda: self.mgr.current.remove_duplicates(), None, "content_copy")
|
||||
A(p, "Remove unavailable", lambda: self.mgr.current.remove_unavailable(), None, "delete")
|
||||
A(p, "Clear playlist", lambda: self.mgr.current.clear(), None, "clear_all")
|
||||
p.addSeparator()
|
||||
self.act["shuffle"] = A(p, "Shuffle", self._menu_shuffle, "Ctrl+H", "shuffle", True)
|
||||
rm = p.addMenu(icon("repeat"), "Repeat")
|
||||
self.act["repeat"] = {}
|
||||
for k, t in (("off", "Off"), ("playlist", "Playlist"), ("track", "Track")):
|
||||
self.act["repeat"][k] = A(rm, t, lambda _c, k=k: self._menu_repeat(k), None, None, True)
|
||||
|
||||
t = mb.addMenu("&Tools")
|
||||
A(t, "Edit tags…", lambda: self._tag_selected(), "Ctrl+E", "edit")
|
||||
A(t, "Fetch tags from MusicBrainz…", lambda: self._mb_selected(), None, "cloud_download")
|
||||
A(t, "Album cover…", lambda: self._cover_selected(), None, "image")
|
||||
A(t, "Equalizer…", lambda: EqualizerDialog(self).exec(), None, "tune")
|
||||
A(t, "Rip audio CD…", lambda: self.sidebar.nav.set_current(4), None, "download")
|
||||
t.addSeparator()
|
||||
A(t, "Update library", lambda: L.library.scan(False), "F5", "refresh")
|
||||
A(t, "Full library rescan", lambda: L.library.scan(True), "Ctrl+F5", "sync")
|
||||
A(t, "Add music folder…", lambda: self.add_library_folder(), None, "library_add")
|
||||
t.addSeparator()
|
||||
A(t, "Settings…", lambda: SettingsDialog(self).exec(), "Ctrl+,", "settings")
|
||||
|
||||
v = mb.addMenu("&View")
|
||||
hm = v.addMenu(icon("art_track"), "Now playing panel")
|
||||
self.act["hero"] = {}
|
||||
for k, tt in (("full", "Large"), ("compact", "Compact"), ("hidden", "Hidden")):
|
||||
self.act["hero"][k] = A(hm, tt, lambda _c, k=k: self._set_hero(k), None, None, True)
|
||||
self.act["sidebar"] = A(v, "Show sidebar", self._toggle_sidebar, "Ctrl+B", "menu", True)
|
||||
self.act["sidebar"].setChecked(True)
|
||||
self.act["analyzer"] = A(v, "Show spectrum analyzer", self._toggle_analyzer, None, "graphic_eq", True)
|
||||
self.act["shape"] = A(v, "Floating bass shape", lambda: self._set_shape(self.act["shape"].isChecked()),
|
||||
None, "auto_awesome", True)
|
||||
A(v, "Focus mode (cover & lyrics)", self.toggle_focus_mode, "F11", "open_in_full")
|
||||
v.addSeparator()
|
||||
A(v, "Theme: follow system colours", lambda: self._quick_theme("kde"), None, "palette")
|
||||
A(v, "Theme: colours from album art", lambda: self._quick_theme("album"), None, "image")
|
||||
|
||||
h = mb.addMenu("&Help")
|
||||
A(h, f"About {APP_NAME}", lambda: AboutDialog(self).exec(), None, "info")
|
||||
A(h, "About Qt", QApplication.aboutQt)
|
||||
self.sync_modes()
|
||||
|
||||
def _shortcuts(self):
|
||||
sc = QShortcut(QKeySequence(Qt.Key.Key_Space), self)
|
||||
sc.setContext(Qt.ShortcutContext.WindowShortcut)
|
||||
sc.activated.connect(self._space)
|
||||
for key, fn in ((Qt.Key.Key_MediaPlay, self.player.play_pause), (Qt.Key.Key_MediaTogglePlayPause, self.player.play_pause),
|
||||
(Qt.Key.Key_MediaNext, self.player.next), (Qt.Key.Key_MediaPrevious, self.player.prev),
|
||||
(Qt.Key.Key_MediaStop, self.player.stop), (Qt.Key.Key_MediaPause, self.player.pause)):
|
||||
s = QShortcut(QKeySequence(key), self)
|
||||
s.activated.connect(fn)
|
||||
|
||||
def _space(self):
|
||||
if isinstance(QApplication.focusWidget(), QLineEdit):
|
||||
fw = QApplication.focusWidget()
|
||||
fw.insert(" ")
|
||||
return
|
||||
self.player.play_pause()
|
||||
|
||||
# ================================================================ modes
|
||||
def sync_modes(self):
|
||||
self.act["shuffle"].setChecked(self.mgr.shuffle)
|
||||
for k, a in self.act["repeat"].items():
|
||||
a.setChecked(k == self.mgr.repeat)
|
||||
self.hero.sync_modes()
|
||||
if hasattr(self, "mpris"):
|
||||
self.mpris.modes_changed()
|
||||
|
||||
def _menu_shuffle(self):
|
||||
self.mgr.set_shuffle(self.act["shuffle"].isChecked())
|
||||
self.player.refresh_next()
|
||||
self.sync_modes()
|
||||
|
||||
def _menu_repeat(self, k):
|
||||
self.mgr.set_repeat(k)
|
||||
self.player.refresh_next()
|
||||
self.sync_modes()
|
||||
|
||||
def _stop_after(self):
|
||||
self.mgr.stop_after = self.player.song if self.act["stop_after"].isChecked() else None
|
||||
self.player.refresh_next()
|
||||
|
||||
def _set_hero(self, mode):
|
||||
settings.set("appearance/hero", mode)
|
||||
self.apply_layout_settings()
|
||||
|
||||
def apply_layout_settings(self):
|
||||
mode = settings.get("appearance/hero")
|
||||
for k, a in self.act["hero"].items():
|
||||
a.setChecked(k == mode)
|
||||
self.hero.setVisible(mode != "hidden")
|
||||
if mode != "hidden":
|
||||
self.hero.set_mode(mode)
|
||||
h = 300 if mode == "full" else 118
|
||||
self.hero.setMinimumHeight(h)
|
||||
self.hero.setMaximumHeight(h + 140 if mode == "full" else h)
|
||||
sizes = self.vsplit.sizes()
|
||||
total = sum(sizes) or 900
|
||||
self.vsplit.setSizes([h, max(200, total - h)])
|
||||
ana = settings.get("appearance/analyzer")
|
||||
self.analyzer.setVisible(ana)
|
||||
self.act["analyzer"].setChecked(ana)
|
||||
self.spectrum.enabled = ana or settings.get("appearance/floating_shape") or (settings.get("appearance/visualizer") and mode == "full")
|
||||
self.spectrum._update_running()
|
||||
self.spectrum.use_monitor = self.player.backend.name == "mpv" and IS_LINUX
|
||||
self.spectrum._update_monitor()
|
||||
self.mini.setVisible(mode == "hidden")
|
||||
self.area.set_art(self.area._art)
|
||||
on = settings.get("appearance/floating_shape")
|
||||
self.act["shape"].setChecked(on)
|
||||
self.shape.setVisible(on)
|
||||
self.bottom_bar.layout().setContentsMargins(14 + (78 if on else 0), 2, 14, 6)
|
||||
self.sidebar.layout().setContentsMargins(4, 0, 0, 40 if on else 0)
|
||||
self._place_shape()
|
||||
if hasattr(self, "tray_icon"):
|
||||
self.tray_icon.setVisible(settings.get("appearance/tray"))
|
||||
|
||||
def _toggle_sidebar(self):
|
||||
self.sidebar.setVisible(self.act["sidebar"].isChecked())
|
||||
|
||||
def _set_shape(self, on):
|
||||
settings.set("appearance/floating_shape", on)
|
||||
self.apply_layout_settings()
|
||||
|
||||
def _place_shape(self):
|
||||
c = self.centralWidget()
|
||||
if c is None or not hasattr(self, "shape"):
|
||||
return
|
||||
bb = self.bottom_bar.geometry()
|
||||
y = bb.center().y() - self.shape.height() // 2 - 16 # floats up out of the bar
|
||||
self.shape.move(4, max(0, y))
|
||||
self.shape.raise_()
|
||||
|
||||
def resizeEvent(self, e):
|
||||
super().resizeEvent(e)
|
||||
self._place_shape()
|
||||
|
||||
def _toggle_analyzer(self):
|
||||
settings.set("appearance/analyzer", self.act["analyzer"].isChecked())
|
||||
self.apply_layout_settings()
|
||||
|
||||
def toggle_focus_mode(self):
|
||||
"""Hide everything but the hero (big cover + lyrics)."""
|
||||
focus = not getattr(self, "_focus", False)
|
||||
self._focus = focus
|
||||
self.sidebar.setVisible(not focus and self.act["sidebar"].isChecked())
|
||||
self.area.setVisible(not focus)
|
||||
if focus:
|
||||
self.hero.set_mode("full")
|
||||
self.hero.setVisible(True)
|
||||
self.hero.setMaximumHeight(16777215)
|
||||
self.hero.cover.setFixedSize(420, 420)
|
||||
else:
|
||||
self.apply_layout_settings()
|
||||
|
||||
def _quick_theme(self, src):
|
||||
settings.set("appearance/color_source", src)
|
||||
if src == "album" and self.np.image is not None:
|
||||
Th.theme.album_seed = Th.dominant_color(self.np.image)
|
||||
Th.theme.rebuild()
|
||||
|
||||
def _theme_changed(self):
|
||||
self.setWindowIcon(app_icon())
|
||||
if hasattr(self, "tray_icon"):
|
||||
self.tray_icon.setIcon(app_icon())
|
||||
for v in self.area.views.values():
|
||||
v.viewport().update()
|
||||
self.update()
|
||||
|
||||
# ================================================================ adding
|
||||
def add_songs(self, songs: list[Song], mode: str):
|
||||
if not songs:
|
||||
return
|
||||
pl = self.mgr.current
|
||||
if mode == "new":
|
||||
name = songs[0].album or songs[0].display_artist() or "Playlist"
|
||||
pl = self.mgr.new_playlist(name, [])
|
||||
self.mgr.add_songs(songs, pl, play=True)
|
||||
elif mode == "replace":
|
||||
self.mgr.add_songs(songs, pl, play=True, replace=True)
|
||||
elif mode == "play":
|
||||
self.mgr.add_songs(songs, pl, play=True)
|
||||
elif mode == "queue":
|
||||
pl.insert_songs(songs)
|
||||
self.mgr.enqueue(pl, songs)
|
||||
elif mode == "next":
|
||||
row = pl.current_row() + 1 if pl.current_song is not None else -1
|
||||
pl.insert_songs(songs, row)
|
||||
self.mgr.enqueue(pl, songs, front=True)
|
||||
else:
|
||||
self.mgr.add_songs(songs, pl)
|
||||
|
||||
def _open_smart(self, name, songs):
|
||||
"""Smart lists reuse their tab (refreshed) instead of piling up copies."""
|
||||
for pl in self.mgr.playlists:
|
||||
if pl.name == name and getattr(pl, "smart", False):
|
||||
pl.replace(songs)
|
||||
self.mgr.set_current(pl)
|
||||
return
|
||||
pl = self.mgr.new_playlist(name, songs)
|
||||
pl.smart = True
|
||||
|
||||
def add_paths(self, paths, mode="append"):
|
||||
if mode == "new":
|
||||
pl = self.mgr.new_playlist(os.path.basename(paths[0].rstrip("/")) or "Playlist")
|
||||
self.mgr.add_paths(paths, pl, play=True)
|
||||
elif mode == "replace":
|
||||
self.mgr.add_paths(paths, self.mgr.current, play=True, replace=True)
|
||||
else:
|
||||
self.mgr.add_paths(paths, self.mgr.current, play=mode == "play")
|
||||
|
||||
def open_files(self):
|
||||
from .config import AUDIO_EXTS
|
||||
exts = " ".join(f"*.{e}" for e in sorted(AUDIO_EXTS))
|
||||
files, _ = QFileDialog.getOpenFileNames(self, "Open audio files", os.path.expanduser("~/Music"),
|
||||
f"Audio ({exts});;Playlists (*.m3u *.m3u8 *.pls *.xspf *.cue);;All files (*)")
|
||||
if files:
|
||||
self.add_paths(files, "play")
|
||||
|
||||
def open_folder(self):
|
||||
d = QFileDialog.getExistingDirectory(self, "Open folder", os.path.expanduser("~/Music"))
|
||||
if d:
|
||||
self.add_paths([d], "play")
|
||||
|
||||
def open_url(self):
|
||||
url, ok = QInputDialog.getText(self, "Open stream", "URL:")
|
||||
if ok and url.strip():
|
||||
self.add_songs([Song(url=url.strip(), title=url.strip(), filetype="Stream")], "play")
|
||||
|
||||
def add_library_folder(self, d=None):
|
||||
if d is None:
|
||||
d = QFileDialog.getExistingDirectory(self, "Add music folder", os.path.expanduser("~/Music"))
|
||||
if d:
|
||||
folders = settings.get("library/folders")
|
||||
if d not in folders:
|
||||
settings.set("library/folders", folders + [d])
|
||||
L.library.scan(False)
|
||||
self.sidebar.files.go_home()
|
||||
|
||||
def import_playlist(self):
|
||||
files, _ = QFileDialog.getOpenFileNames(self, "Import playlist", os.path.expanduser("~/Music"), IMPORT_FILTER)
|
||||
for f in files:
|
||||
pl = self.mgr.new_playlist(os.path.splitext(os.path.basename(f))[0])
|
||||
self.mgr.add_paths([f], pl)
|
||||
|
||||
def export_playlist(self, pl):
|
||||
if pl is None:
|
||||
return
|
||||
path, flt = QFileDialog.getSaveFileName(self, "Export playlist",
|
||||
os.path.join(os.path.expanduser("~/Music"), pl.name + ".m3u8"),
|
||||
EXPORT_FILTERS)
|
||||
if not path:
|
||||
return
|
||||
if not os.path.splitext(path)[1]:
|
||||
path += "." + flt.split("*.")[1].rstrip(")")
|
||||
rel = QMessageBox.question(self, "Export playlist", "Use paths relative to the playlist file?\n"
|
||||
"(Recommended if you move the music folder with the playlist.)") \
|
||||
== QMessageBox.StandardButton.Yes
|
||||
try:
|
||||
export_playlist(path, pl.songs, rel)
|
||||
self.toast(f"Exported {len(pl.songs)} tracks to {os.path.basename(path)}")
|
||||
except Exception as e: # noqa: BLE001
|
||||
QMessageBox.warning(self, "Export failed", str(e))
|
||||
|
||||
# ================================================================ context menus
|
||||
def _playlist_menu(self, view, pos):
|
||||
songs = view.selected_songs()
|
||||
if not songs:
|
||||
return
|
||||
self.song_menu(songs, pos, view.pl, view)
|
||||
|
||||
def song_menu(self, songs: list[Song], pos, pl=None, view=None):
|
||||
m = QMenu(self)
|
||||
if pl is not None:
|
||||
m.addAction(icon("play_arrow"), "Play", lambda: self.player.play_song(pl, songs[0]))
|
||||
qa = m.addAction(icon("queue_music"), "Queue / dequeue")
|
||||
qa.triggered.connect(lambda: self._toggle_queue(pl, songs))
|
||||
m.addAction(icon("queue_play_next"), "Play next",
|
||||
lambda: self.mgr.enqueue(pl, songs, front=True))
|
||||
sa = m.addAction(icon("stop_circle"), "Stop after this track")
|
||||
sa.triggered.connect(lambda: (setattr(self.mgr, "stop_after", songs[0]), self.player.refresh_next()))
|
||||
m.addSeparator()
|
||||
if view is not None:
|
||||
m.addAction(icon("delete"), "Remove from playlist", view.remove_selected)
|
||||
m.addAction(icon("filter_list"), "Crop to selection",
|
||||
lambda: pl.remove_rows([i for i in range(len(pl.songs)) if i not in set(view.selected_rows())]))
|
||||
else:
|
||||
m.addAction(icon("playlist_add"), "Append to playlist", lambda: self.add_songs(songs, "append"))
|
||||
m.addAction(icon("play_arrow"), "Append and play", lambda: self.add_songs(songs, "play"))
|
||||
m.addAction(icon("playlist_play"), "Replace current playlist", lambda: self.add_songs(songs, "replace"))
|
||||
m.addAction(icon("queue_music"), "Open in new playlist", lambda: self.add_songs(songs, "new"))
|
||||
m.addAction(icon("queue_play_next"), "Play next", lambda: self.add_songs(songs, "next"))
|
||||
m.addAction(icon("queue_music"), "Add to queue", lambda: self.add_songs(songs, "queue"))
|
||||
sub = m.addMenu(icon("playlist_add"), "Add to playlist")
|
||||
for other in self.mgr.playlists:
|
||||
if other is not pl:
|
||||
sub.addAction(other.name, lambda o=other: o.insert_songs(list(songs)))
|
||||
sub.addSeparator()
|
||||
sub.addAction(icon("add"), "New playlist…", lambda: self.mgr.new_playlist(
|
||||
songs[0].album or "Playlist", list(songs)))
|
||||
m.addSeparator()
|
||||
rate = m.addMenu(icon("star"), "Rating")
|
||||
for r in range(6):
|
||||
rate.addAction("★" * r + "☆" * (5 - r) if r else "No rating",
|
||||
lambda r=r: [L.library.set_rating(s, r) for s in songs] and self._refresh_songs(songs))
|
||||
local = [s for s in songs if s.is_local]
|
||||
if local:
|
||||
m.addAction(icon("edit"), "Edit tags…", lambda: TagEditor(local, self).exec())
|
||||
mbm = m.addMenu(icon("cloud_download"), "Fetch tags")
|
||||
mbm.addAction("Choose match (MusicBrainz)…", lambda: self._mb_for(local))
|
||||
mbm.addAction(f"Auto-apply best match ({len(local)} song(s))", lambda: BatchTagFetch.run(self, local))
|
||||
m.addAction(icon("image"), "Album cover…", lambda: CoverManager(songs[0], self).exec())
|
||||
if local:
|
||||
m.addAction(icon("folder_open"), "Show in file manager", lambda: show_in_file_manager(local[0].path))
|
||||
if any(s.is_cd for s in songs):
|
||||
m.addAction(icon("download"), "Rip selected CD tracks…",
|
||||
lambda: RipDialog([s for s in songs if s.is_cd], self.sidebar.cd.cover, self).exec())
|
||||
m.exec(pos)
|
||||
|
||||
def _toggle_queue(self, pl, songs):
|
||||
queued = {id(s) for _, s in self.mgr.queue}
|
||||
if all(id(s) in queued for s in songs):
|
||||
for s in songs:
|
||||
self.mgr.dequeue(s)
|
||||
else:
|
||||
self.mgr.enqueue(pl, [s for s in songs if id(s) not in queued])
|
||||
self.player.refresh_next()
|
||||
|
||||
def _queue_selected(self):
|
||||
v = self.area.view()
|
||||
if v:
|
||||
songs = v.selected_songs()
|
||||
if songs:
|
||||
self._toggle_queue(v.pl, songs)
|
||||
|
||||
def _selected_or_current(self):
|
||||
v = self.area.view()
|
||||
songs = v.selected_songs() if v else []
|
||||
if not songs and self.player.song:
|
||||
songs = [self.player.song]
|
||||
return songs
|
||||
|
||||
def _tag_selected(self):
|
||||
songs = [s for s in self._selected_or_current() if s.is_local]
|
||||
if songs:
|
||||
TagEditor(songs, self).exec()
|
||||
|
||||
def _mb_selected(self):
|
||||
songs = [s for s in self._selected_or_current() if s.is_local]
|
||||
if songs:
|
||||
self._mb_for(songs)
|
||||
|
||||
def _mb_for(self, songs):
|
||||
if len(songs) > 1:
|
||||
TagEditor(songs, self).exec()
|
||||
return
|
||||
dlg = MusicBrainzDialog(songs[0], self)
|
||||
if dlg.exec() and dlg.choice:
|
||||
c = dlg.choice
|
||||
vals = {k: c[k] for k in ("title", "artist", "album", "albumartist", "year", "track", "disc",
|
||||
"genre", "mb_trackid", "mb_albumid") if c.get(k)}
|
||||
from . import tags as T
|
||||
try:
|
||||
T.write_tags(songs[0].path, vals)
|
||||
except Exception as e: # noqa: BLE001
|
||||
QMessageBox.warning(self, "Tags", str(e))
|
||||
return
|
||||
ns = L.library.reread(songs[0].path) or T.read_song(songs[0].path)
|
||||
if ns:
|
||||
ns.art = ns.art or songs[0].art
|
||||
self.song_replaced(songs[0], ns)
|
||||
self.toast("Tags updated from MusicBrainz")
|
||||
|
||||
def _cover_selected(self):
|
||||
songs = self._selected_or_current()
|
||||
if songs:
|
||||
CoverManager(songs[0], self).exec()
|
||||
|
||||
# ================================================================ song updates
|
||||
def song_replaced(self, old: Song, new: Song):
|
||||
"""After tag edits: swap the Song object everywhere it appears."""
|
||||
for pl in self.mgr.playlists:
|
||||
for i, s in enumerate(pl.songs):
|
||||
if s is old or (s.url == old.url and s.begin == old.begin):
|
||||
for f in ("title", "artist", "album", "albumartist", "genre", "composer", "comment", "year",
|
||||
"track", "disc", "mb_trackid", "mb_albumid", "art", "id"):
|
||||
setattr(s, f, getattr(new, f))
|
||||
pl.dataChanged.emit(pl.index(i, 0), pl.index(i, pl.columnCount() - 1))
|
||||
pl.dirty = True
|
||||
if self.player.song is not None and self.player.song.url == old.url:
|
||||
self.player.song_changed.emit(self.player.song)
|
||||
self.mgr.schedule_save()
|
||||
|
||||
def _refresh_songs(self, songs):
|
||||
for pl in self.mgr.playlists:
|
||||
for s in songs:
|
||||
r = pl.row_of(s)
|
||||
if r >= 0:
|
||||
pl.dataChanged.emit(pl.index(r, 0), pl.index(r, pl.columnCount() - 1))
|
||||
|
||||
def refresh_art(self, songs):
|
||||
self._refresh_songs(songs)
|
||||
self.mgr.schedule_save()
|
||||
|
||||
def refresh_saved_playlists(self):
|
||||
self.sidebar.playlists.refresh()
|
||||
|
||||
# ================================================================ player events
|
||||
def _on_state(self, st):
|
||||
self.spectrum.set_playing(st == "playing")
|
||||
self.mini_play.set_icon("pause_fill" if st == "playing" else "play_arrow_fill")
|
||||
self.mini_play.set_morph(st == "playing")
|
||||
self.mini_wave.set_playing(st == "playing")
|
||||
self.act["play"].setIcon(icon("pause_fill" if st == "playing" else "play_arrow_fill"))
|
||||
if hasattr(self, "tray_play"):
|
||||
self.tray_play.setText("Pause" if st == "playing" else "Play")
|
||||
if st == "stopped" and self.player.song is None:
|
||||
self.setWindowTitle(APP_NAME)
|
||||
|
||||
def _on_song(self, s: Song):
|
||||
title = s.stream_title or s.display_title() if s.is_stream else s.display_title()
|
||||
artist = s.display_artist()
|
||||
self.setWindowTitle(f"{artist} - {title} — {APP_NAME}" if artist else f"{title} — {APP_NAME}")
|
||||
if hasattr(self, "tray_icon"):
|
||||
self.tray_icon.setToolTip(f"{title}\n{artist}")
|
||||
v = self.area.view_for(self.mgr.active)
|
||||
if v is not None and not v.underMouse():
|
||||
v.scroll_to_current()
|
||||
self.area._refresh_tabs()
|
||||
self._pending_notify = True
|
||||
QTimer.singleShot(700, self._notify)
|
||||
if self.act["stop_after"].isChecked() and self.mgr.stop_after is not s:
|
||||
self.act["stop_after"].setChecked(self.mgr.stop_after is not None)
|
||||
|
||||
def _notify(self):
|
||||
if not getattr(self, "_pending_notify", False) or not settings.get("appearance/notifications"):
|
||||
return
|
||||
self._pending_notify = False
|
||||
s = self.player.song
|
||||
if s is None or self.isActiveWindow() or self.player.state != "playing":
|
||||
return
|
||||
title = s.stream_title or s.display_title()
|
||||
body = " — ".join(x for x in (s.display_artist(), s.album) if x)
|
||||
if notify is not None and not IS_WIN:
|
||||
notify(title, body, self.current_art_path, self._notif_id)
|
||||
elif hasattr(self, "tray_icon") and self.tray_icon.isVisible():
|
||||
from PyQt6.QtGui import QIcon as _QIcon
|
||||
ic = _QIcon(self.current_art_path) if self.current_art_path else app_icon()
|
||||
self.tray_icon.showMessage(title, body, ic, 4000)
|
||||
|
||||
def _on_art(self, img, path):
|
||||
self.current_art_path = path
|
||||
pm = QPixmap.fromImage(img) if img is not None else None
|
||||
self.area.set_art(pm)
|
||||
if settings.get("appearance/color_source") == "album":
|
||||
Th.theme.set_album_seed(Th.dominant_color(img) if img is not None else None)
|
||||
else:
|
||||
Th.theme.album_seed = Th.dominant_color(img) if img is not None else None
|
||||
if getattr(self, "mpris", None) is not None and self.mpris.ok:
|
||||
self.mpris.art_changed()
|
||||
|
||||
def _on_volume(self, v):
|
||||
self.vol.set_value(v)
|
||||
self.vol_lbl.setText(f"{v}%")
|
||||
self.mute_btn.setIcon(icon("volume_off" if v == 0 else "volume_down" if v < 50 else "volume_up"))
|
||||
|
||||
def _summary(self):
|
||||
pl = self.mgr.current
|
||||
if pl is None:
|
||||
return
|
||||
n = len(pl.songs)
|
||||
self.summary.setText(f"{n} track{'s' if n != 1 else ''} · {fmt_time(pl.total_length(), force_hours=True)}")
|
||||
|
||||
def toast(self, msg):
|
||||
if not msg:
|
||||
return
|
||||
self.toast_lbl.setText(" • " + str(msg))
|
||||
self._toast_timer.start()
|
||||
|
||||
# ================================================================ tray
|
||||
def _tray(self):
|
||||
if not QSystemTrayIcon.isSystemTrayAvailable():
|
||||
return
|
||||
self.tray_icon = QSystemTrayIcon(app_icon(), self)
|
||||
m = QMenu()
|
||||
m.addAction(icon("skip_previous_fill"), "Previous", self.player.prev)
|
||||
self.tray_play = m.addAction(icon("play_arrow_fill"), "Play", self.player.play_pause)
|
||||
m.addAction(icon("skip_next_fill"), "Next", self.player.next)
|
||||
m.addAction(icon("stop_fill"), "Stop", self.player.stop)
|
||||
m.addSeparator()
|
||||
m.addAction("Show / hide", self._toggle_visible)
|
||||
m.addAction(icon("close"), "Quit", self.quit_app)
|
||||
self.tray_icon.setContextMenu(m)
|
||||
self.tray_icon.activated.connect(
|
||||
lambda r: self._toggle_visible() if r == QSystemTrayIcon.ActivationReason.Trigger else
|
||||
self.player.play_pause() if r == QSystemTrayIcon.ActivationReason.MiddleClick else None)
|
||||
self.tray_icon.setVisible(settings.get("appearance/tray"))
|
||||
|
||||
def _toggle_visible(self):
|
||||
if self.isVisible() and self.isActiveWindow():
|
||||
self.hide()
|
||||
else:
|
||||
self.show()
|
||||
self.raise_()
|
||||
self.activateWindow()
|
||||
|
||||
# ================================================================ drag & drop
|
||||
def dragEnterEvent(self, e):
|
||||
if e.mimeData().hasUrls():
|
||||
e.acceptProposedAction()
|
||||
|
||||
def dropEvent(self, e):
|
||||
paths = [u.toLocalFile() for u in e.mimeData().urls() if u.isLocalFile()]
|
||||
streams = [Song(url=u.toString(), title=u.toString()) for u in e.mimeData().urls() if not u.isLocalFile()]
|
||||
if paths:
|
||||
self.add_paths(paths, "append")
|
||||
if streams:
|
||||
self.add_songs(streams, "append")
|
||||
|
||||
def eventFilter(self, obj, ev):
|
||||
if obj is getattr(self, "bottom_bar", None) and ev.type() in (QEvent.Type.Resize, QEvent.Type.Move):
|
||||
QTimer.singleShot(0, self._place_shape)
|
||||
if ev.type() == QEvent.Type.Polish and isinstance(obj, QMenu):
|
||||
obj.setWindowFlag(Qt.WindowType.FramelessWindowHint, True)
|
||||
obj.setWindowFlag(Qt.WindowType.NoDropShadowWindowHint, True)
|
||||
obj.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, True)
|
||||
return False
|
||||
|
||||
# ================================================================ lifecycle
|
||||
def handle_args(self, args: list[str]):
|
||||
paths = [a for a in args if os.path.exists(a)]
|
||||
urls = [a for a in args if "://" in a and not os.path.exists(a)]
|
||||
if paths:
|
||||
self.add_paths(paths, "play")
|
||||
for u in urls:
|
||||
if u.startswith("file://"):
|
||||
from .playlist import url_to_path
|
||||
self.add_paths([url_to_path(u)], "play")
|
||||
else:
|
||||
self.add_songs([Song(url=u, title=u)], "play")
|
||||
if args:
|
||||
self.show()
|
||||
self.raise_()
|
||||
self.activateWindow()
|
||||
|
||||
def _resume(self):
|
||||
if self.player.song is not None or not settings.get("playback/resume"):
|
||||
return
|
||||
pl = self.mgr.active
|
||||
if pl and pl.current_song is not None and not pl.current_song.is_stream:
|
||||
try:
|
||||
pos = float(L.library.kv("resume_pos", 0) or 0)
|
||||
except ValueError:
|
||||
pos = 0.0
|
||||
self.player.play_song(pl, pl.current_song, start=pos, paused=True)
|
||||
|
||||
def _restore_geometry(self):
|
||||
q = settings.raw()
|
||||
g = q.value("ui/geometry")
|
||||
if isinstance(g, QByteArray):
|
||||
self.restoreGeometry(g)
|
||||
else:
|
||||
self.resize(1380, 880)
|
||||
for key, sp in (("ui/hsplit", self.hsplit), ("ui/vsplit", self.vsplit)):
|
||||
st = q.value(key)
|
||||
if isinstance(st, QByteArray):
|
||||
sp.restoreState(st)
|
||||
|
||||
def closeEvent(self, e):
|
||||
if not self._quitting and settings.get("appearance/tray") and hasattr(self, "tray_icon") \
|
||||
and self.tray_icon.isVisible():
|
||||
self.hide()
|
||||
e.ignore()
|
||||
return
|
||||
self.quit_app()
|
||||
e.accept()
|
||||
|
||||
def quit_app(self):
|
||||
if self._quitting:
|
||||
return
|
||||
self._quitting = True
|
||||
q = settings.raw()
|
||||
q.setValue("ui/geometry", self.saveGeometry())
|
||||
q.setValue("ui/hsplit", self.hsplit.saveState())
|
||||
q.setValue("ui/vsplit", self.vsplit.saveState())
|
||||
L.library.set_kv("resume_pos", f"{self.player.pos:.1f}" if self.player.song else "0")
|
||||
self.mgr.save_all()
|
||||
L.library.stop_scan()
|
||||
self.player.shutdown()
|
||||
if self.media_keys is not None:
|
||||
self.media_keys.close()
|
||||
q.sync()
|
||||
if hasattr(self, "tray_icon"):
|
||||
self.tray_icon.hide()
|
||||
QApplication.instance().quit()
|
||||
|
||||
|
||||
class _NoMpris:
|
||||
ok = False
|
||||
|
||||
def modes_changed(self):
|
||||
pass
|
||||
|
||||
def art_changed(self):
|
||||
pass
|
||||
|
||||
|
||||
def app_icon() -> QIcon:
|
||||
"""Cookie-shaped app icon in the current accent colour."""
|
||||
from PyQt6.QtCore import QPointF, QRectF
|
||||
from PyQt6.QtGui import QPainter, QPainterPath
|
||||
import math
|
||||
ic = QIcon()
|
||||
for size in (16, 22, 32, 48, 64, 128, 256):
|
||||
pm = QPixmap(size, size)
|
||||
pm.fill(Qt.GlobalColor.transparent)
|
||||
p = QPainter(pm)
|
||||
p.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
c = size / 2
|
||||
R = size * 0.47
|
||||
path = QPainterPath()
|
||||
for i in range(121):
|
||||
t = i / 120 * 2 * math.pi
|
||||
r = R * (0.92 + 0.08 * math.cos(9 * t))
|
||||
pt = QPointF(c + r * math.cos(t), c + r * math.sin(t))
|
||||
path.moveTo(pt) if i == 0 else path.lineTo(pt)
|
||||
p.fillPath(path, Th.theme["primary"] if Th.theme else Qt.GlobalColor.magenta)
|
||||
from .icons import paint_icon
|
||||
s = size * 0.56
|
||||
paint_icon(p, QRectF(c - s / 2, c - s / 2, s, s), "music_note",
|
||||
Th.theme["onPrimary"] if Th.theme else Qt.GlobalColor.white)
|
||||
p.end()
|
||||
ic.addPixmap(pm)
|
||||
return ic
|
||||
350
mulberry/mpris.py
Normal file
350
mulberry/mpris.py
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
"""MPRIS2 D-Bus interface so Plasma's media controls, KDE Connect, media keys
|
||||
and shell widgets (Quickshell, etc.) see and control Mulberry."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt6.QtCore import QMetaType, QObject, pyqtClassInfo, pyqtProperty, pyqtSignal, pyqtSlot
|
||||
from PyQt6.QtDBus import (QDBusAbstractAdaptor, QDBusArgument, QDBusConnection, QDBusMessage,
|
||||
QDBusObjectPath)
|
||||
|
||||
from .config import APP_ID, APP_NAME
|
||||
|
||||
PATH = "/org/mpris/MediaPlayer2"
|
||||
ROOT_XML = """
|
||||
<interface name="org.mpris.MediaPlayer2">
|
||||
<method name="Raise"/><method name="Quit"/>
|
||||
<property name="CanQuit" type="b" access="read"/>
|
||||
<property name="CanRaise" type="b" access="read"/>
|
||||
<property name="HasTrackList" type="b" access="read"/>
|
||||
<property name="Identity" type="s" access="read"/>
|
||||
<property name="DesktopEntry" type="s" access="read"/>
|
||||
<property name="SupportedUriSchemes" type="as" access="read"/>
|
||||
<property name="SupportedMimeTypes" type="as" access="read"/>
|
||||
</interface>"""
|
||||
PLAYER_XML = """
|
||||
<interface name="org.mpris.MediaPlayer2.Player">
|
||||
<method name="Next"/><method name="Previous"/><method name="Pause"/>
|
||||
<method name="PlayPause"/><method name="Stop"/><method name="Play"/>
|
||||
<method name="Seek"><arg direction="in" type="x" name="Offset"/></method>
|
||||
<method name="SetPosition"><arg direction="in" type="o" name="TrackId"/><arg direction="in" type="x" name="Position"/></method>
|
||||
<method name="OpenUri"><arg direction="in" type="s" name="Uri"/></method>
|
||||
<signal name="Seeked"><arg type="x" name="Position"/></signal>
|
||||
<property name="PlaybackStatus" type="s" access="read"/>
|
||||
<property name="LoopStatus" type="s" access="readwrite"/>
|
||||
<property name="Rate" type="d" access="readwrite"/>
|
||||
<property name="Shuffle" type="b" access="readwrite"/>
|
||||
<property name="Metadata" type="a{sv}" access="read"/>
|
||||
<property name="Volume" type="d" access="readwrite"/>
|
||||
<property name="Position" type="x" access="read"/>
|
||||
<property name="MinimumRate" type="d" access="read"/>
|
||||
<property name="MaximumRate" type="d" access="read"/>
|
||||
<property name="CanGoNext" type="b" access="read"/>
|
||||
<property name="CanGoPrevious" type="b" access="read"/>
|
||||
<property name="CanPlay" type="b" access="read"/>
|
||||
<property name="CanPause" type="b" access="read"/>
|
||||
<property name="CanSeek" type="b" access="read"/>
|
||||
<property name="CanControl" type="b" access="read"/>
|
||||
</interface>"""
|
||||
|
||||
|
||||
@pyqtClassInfo("D-Bus Interface", "org.mpris.MediaPlayer2")
|
||||
@pyqtClassInfo("D-Bus Introspection", ROOT_XML)
|
||||
class RootAdaptor(QDBusAbstractAdaptor):
|
||||
def __init__(self, parent, window):
|
||||
super().__init__(parent)
|
||||
self.window = window
|
||||
self.setAutoRelaySignals(False)
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanQuit(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanRaise(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def HasTrackList(self):
|
||||
return False
|
||||
|
||||
@pyqtProperty(str)
|
||||
def Identity(self):
|
||||
return APP_NAME
|
||||
|
||||
@pyqtProperty(str)
|
||||
def DesktopEntry(self):
|
||||
return APP_ID
|
||||
|
||||
@pyqtProperty("QStringList")
|
||||
def SupportedUriSchemes(self):
|
||||
return ["file", "http", "https", "cdda"]
|
||||
|
||||
@pyqtProperty("QStringList")
|
||||
def SupportedMimeTypes(self):
|
||||
return ["audio/mpeg", "audio/flac", "audio/ogg", "audio/x-vorbis+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"]
|
||||
|
||||
@pyqtSlot()
|
||||
def Raise(self):
|
||||
w = self.window
|
||||
w.show()
|
||||
w.raise_()
|
||||
w.activateWindow()
|
||||
|
||||
@pyqtSlot()
|
||||
def Quit(self):
|
||||
self.window.quit_app()
|
||||
|
||||
|
||||
@pyqtClassInfo("D-Bus Interface", "org.mpris.MediaPlayer2.Player")
|
||||
@pyqtClassInfo("D-Bus Introspection", PLAYER_XML)
|
||||
class PlayerAdaptor(QDBusAbstractAdaptor):
|
||||
Seeked = pyqtSignal("qlonglong")
|
||||
|
||||
def __init__(self, parent, player, mgr):
|
||||
super().__init__(parent)
|
||||
self.player, self.mgr = player, mgr
|
||||
self.setAutoRelaySignals(False)
|
||||
|
||||
@pyqtProperty(str)
|
||||
def PlaybackStatus(self):
|
||||
return {"playing": "Playing", "paused": "Paused"}.get(self.player.state, "Stopped")
|
||||
|
||||
@pyqtProperty(str)
|
||||
def LoopStatus(self):
|
||||
return {"track": "Track", "playlist": "Playlist"}.get(self.mgr.repeat, "None")
|
||||
|
||||
@LoopStatus.setter
|
||||
def LoopStatus(self, v):
|
||||
self.mgr.set_repeat({"Track": "track", "Playlist": "playlist"}.get(v, "off"))
|
||||
self.parent().repeat_changed_external()
|
||||
|
||||
@pyqtProperty(float)
|
||||
def Rate(self):
|
||||
return 1.0
|
||||
|
||||
@Rate.setter
|
||||
def Rate(self, v):
|
||||
pass
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def Shuffle(self):
|
||||
return bool(self.mgr.shuffle)
|
||||
|
||||
@Shuffle.setter
|
||||
def Shuffle(self, v):
|
||||
self.mgr.set_shuffle(bool(v))
|
||||
self.parent().repeat_changed_external()
|
||||
|
||||
@pyqtProperty("QVariantMap")
|
||||
def Metadata(self):
|
||||
return self.parent().metadata()
|
||||
|
||||
@pyqtProperty(float)
|
||||
def Volume(self):
|
||||
return self.player.volume / 100.0
|
||||
|
||||
@Volume.setter
|
||||
def Volume(self, v):
|
||||
self.player.set_volume(int(round(v * 100)))
|
||||
|
||||
@pyqtProperty("qlonglong")
|
||||
def Position(self):
|
||||
return int(self.player.pos * 1_000_000)
|
||||
|
||||
@pyqtProperty(float)
|
||||
def MinimumRate(self):
|
||||
return 1.0
|
||||
|
||||
@pyqtProperty(float)
|
||||
def MaximumRate(self):
|
||||
return 1.0
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanGoNext(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanGoPrevious(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanPlay(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanPause(self):
|
||||
return True
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanSeek(self):
|
||||
return self.player.song is not None and not self.player.song.is_stream
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def CanControl(self):
|
||||
return True
|
||||
|
||||
@pyqtSlot()
|
||||
def Next(self):
|
||||
self.player.next()
|
||||
|
||||
@pyqtSlot()
|
||||
def Previous(self):
|
||||
self.player.prev()
|
||||
|
||||
@pyqtSlot()
|
||||
def Pause(self):
|
||||
self.player.pause()
|
||||
|
||||
@pyqtSlot()
|
||||
def PlayPause(self):
|
||||
self.player.play_pause()
|
||||
|
||||
@pyqtSlot()
|
||||
def Stop(self):
|
||||
self.player.stop()
|
||||
|
||||
@pyqtSlot()
|
||||
def Play(self):
|
||||
self.player.play()
|
||||
|
||||
@pyqtSlot("qlonglong")
|
||||
def Seek(self, offset):
|
||||
self.player.seek_relative(offset / 1_000_000)
|
||||
|
||||
@pyqtSlot(QDBusObjectPath, "qlonglong")
|
||||
def SetPosition(self, track, pos):
|
||||
self.player.seek(pos / 1_000_000)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def OpenUri(self, uri):
|
||||
from .playlist import url_to_path
|
||||
p = url_to_path(uri)
|
||||
if os.path.exists(p):
|
||||
self.mgr.add_paths([p], play=True)
|
||||
|
||||
|
||||
class Mpris(QObject):
|
||||
def __init__(self, window, player, mgr):
|
||||
super().__init__()
|
||||
self.player, self.mgr, self.window = player, mgr, window
|
||||
self.ok = False
|
||||
bus = QDBusConnection.sessionBus()
|
||||
if not bus.isConnected():
|
||||
return
|
||||
self.root = RootAdaptor(self, window)
|
||||
self.padaptor = PlayerAdaptor(self, player, mgr)
|
||||
if not bus.registerObject(PATH, self):
|
||||
return
|
||||
name = "org.mpris.MediaPlayer2." + APP_ID
|
||||
if not bus.registerService(name):
|
||||
bus.registerService(f"{name}.instance{os.getpid()}")
|
||||
self.ok = True
|
||||
player.state_changed.connect(lambda *_: self._changed(["PlaybackStatus", "CanSeek"]))
|
||||
player.song_changed.connect(lambda *_: self._changed(["Metadata", "CanSeek"]))
|
||||
player.volume_changed.connect(lambda *_: self._changed(["Volume"]))
|
||||
player.seeked.connect(lambda s: self._emit_seeked(s))
|
||||
|
||||
def repeat_changed_external(self):
|
||||
self._changed(["LoopStatus", "Shuffle"])
|
||||
if hasattr(self.window, "sync_modes"):
|
||||
self.window.sync_modes()
|
||||
|
||||
def modes_changed(self):
|
||||
self._changed(["LoopStatus", "Shuffle"])
|
||||
|
||||
def metadata(self) -> dict:
|
||||
s = self.player.song
|
||||
if s is None:
|
||||
return {"mpris:trackid": QDBusObjectPath("/org/mpris/MediaPlayer2/TrackList/NoTrack")}
|
||||
title = s.display_title()
|
||||
artist = s.display_artist()
|
||||
if s.is_stream:
|
||||
st = s.stream_title
|
||||
if st and " - " in st:
|
||||
artist, title = [x.strip() for x in st.split(" - ", 1)]
|
||||
else:
|
||||
title = st or s.title or s.url
|
||||
artist = artist or s.title
|
||||
tid = QDBusObjectPath(f"/org/{APP_ID}/track/{abs(hash(s.key())) % 10**12}")
|
||||
md = {
|
||||
"mpris:trackid": tid,
|
||||
"mpris:length": _i64(int(max(self.player.dur, s.duration()) * 1_000_000)),
|
||||
"xesam:title": title,
|
||||
"xesam:album": s.album,
|
||||
"xesam:artist": _as([artist] if artist else []),
|
||||
"xesam:albumArtist": _as([s.effective_albumartist()] if s.effective_albumartist() else []),
|
||||
"xesam:genre": _as([s.genre] if s.genre else []),
|
||||
"xesam:trackNumber": s.track,
|
||||
"xesam:discNumber": s.disc,
|
||||
"xesam:useCount": s.playcount,
|
||||
"xesam:userRating": s.rating / 5.0,
|
||||
"xesam:url": Path(s.path).as_uri() if s.is_local and os.path.isabs(s.path) else s.url,
|
||||
}
|
||||
art = getattr(self.window, "current_art_path", "") or s.art
|
||||
if art and os.path.exists(art):
|
||||
md["mpris:artUrl"] = Path(art).as_uri()
|
||||
if s.year:
|
||||
md["xesam:contentCreated"] = f"{s.year:04d}-01-01T00:00:00"
|
||||
return md
|
||||
|
||||
def _changed(self, props):
|
||||
if not self.ok:
|
||||
return
|
||||
changed = {}
|
||||
for p in props:
|
||||
if p == "Metadata":
|
||||
changed[p] = self.metadata()
|
||||
else:
|
||||
changed[p] = getattr(self.padaptor, p)
|
||||
msg = QDBusMessage.createSignal(PATH, "org.freedesktop.DBus.Properties", "PropertiesChanged")
|
||||
msg.setArguments(["org.mpris.MediaPlayer2.Player", changed,
|
||||
QDBusArgument([], QMetaType.Type.QStringList.value)])
|
||||
QDBusConnection.sessionBus().send(msg)
|
||||
|
||||
def art_changed(self):
|
||||
self._changed(["Metadata"])
|
||||
|
||||
def _emit_seeked(self, sec):
|
||||
if not self.ok:
|
||||
return
|
||||
msg = QDBusMessage.createSignal(PATH, "org.mpris.MediaPlayer2.Player", "Seeked")
|
||||
arg = QDBusArgument()
|
||||
arg.add(int(sec * 1_000_000), QMetaType.Type.LongLong.value)
|
||||
msg.setArguments([arg])
|
||||
QDBusConnection.sessionBus().send(msg)
|
||||
|
||||
|
||||
def _as(items: list[str]) -> QDBusArgument:
|
||||
"""Marshal as D-Bus 'as' (plain Python lists would become 'av', which
|
||||
many MPRIS clients ignore — they then show 'Unknown artist')."""
|
||||
return QDBusArgument([str(i) for i in items], QMetaType.Type.QStringList.value)
|
||||
|
||||
|
||||
def _i64(v: int) -> QDBusArgument:
|
||||
a = QDBusArgument()
|
||||
a.add(int(v), QMetaType.Type.LongLong.value)
|
||||
return a
|
||||
|
||||
|
||||
def notify(summary: str, body: str, icon_path: str = "", replaces: int = 0) -> None:
|
||||
"""Desktop notification via org.freedesktop.Notifications (async)."""
|
||||
bus = QDBusConnection.sessionBus()
|
||||
if not bus.isConnected():
|
||||
return
|
||||
msg = QDBusMessage.createMethodCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications", "Notify")
|
||||
hints = {"desktop-entry": APP_ID, "transient": True}
|
||||
if icon_path:
|
||||
hints["image-path"] = Path(icon_path).as_uri()
|
||||
rid = QDBusArgument()
|
||||
rid.add(int(replaces), QMetaType.Type.UInt.value)
|
||||
timeout = QDBusArgument()
|
||||
timeout.add(5000, QMetaType.Type.Int.value)
|
||||
msg.setArguments([APP_NAME, rid, icon_path or "audio-x-generic", summary, body,
|
||||
QDBusArgument([], QMetaType.Type.QStringList.value), hints, timeout])
|
||||
bus.asyncCall(msg)
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue