# ShadeTube development guide How ShadeTube is built, how it is put together and how to test and release it. For what the app does, see the [README](../README.md); for what changed between versions, see the [changelog](../CHANGELOG.md). ShadeTube is a native Windows x64 app in C++20: Direct2D + DirectWrite UI with its own widget tree and window chrome, Media Foundation and built-in Opus / Vorbis decoders → WASAPI audio (shared or exclusive), catalog data from Spotify (the user's own account), YouTube Music or MusicBrainz, and audio streamed from YouTube through a C++ YoutubeExplode port. ## Contents 1. [Build and run](#1-build-and-run) 2. [Repository layout](#2-repository-layout) 3. [Architecture](#3-architecture) 4. [Coding conventions](#4-coding-conventions) 5. [Testing](#5-testing) 6. [Release process](#6-release-process) 7. [Known limitations and open items](#7-known-limitations-and-open-items) ## 1. Build and run **Requirements**: Windows 10 1809+ or Windows 11 (x64); Visual Studio 2022 or newer with the **Desktop development with C++** workload (ships CMake and Ninja); Python 3 only for `tools/` and the update mock server. The first configure needs network access: `cmake/WebView2.cmake` downloads the pinned Microsoft.Web.WebView2 SDK into `/_webview2` and links its static loader. `external/YoutubeExplode` (the C++ YouTube library, also published as [shadesofdeath/YoutubeExplode](https://github.com/shadesofdeath/YoutubeExplode)) is part of this repository; it builds as a CMake subproject (WinHTTP backend) and also provides nlohmann/json. The Xiph decoders (external/libopus, opusfile, libvorbis, libogg; decoder sources of the official release tarballs, unchanged, their SHA-256 in each CMakeLists.txt) build as static C libraries. ```bat build.bat Debug :: configure (Ninja) + build everything -> build\Debug\bin\ShadeTube.exe build.bat Release :: /O2 /GL /LTCG -> build\Release\bin\ShadeTube.exe build.bat Debug st_audio :: build one target build.bat Debug ShadeTube build\other :: use a separate build folder ``` `build.bat` finds Visual Studio with `vswhere` and enters the x64 developer environment itself (works from cmd or PowerShell). It configures only when `build.ninja` is missing: after adding a `tests/` folder (globbed at configure time) re-run `cmake -S . -B build\Debug` or delete the build folder. Test programs are built by default (`-DST_BUILD_TESTS=OFF` skips them) into `build\\tests\\`. The result is a **single self-contained exe**: static CRT, static WebView2 loader, and every file under `assets/` embedded as an `RCDATA` resource named by its relative path (generated `resources.rc`; names starting with `_` are skipped). At run time the Spotify login needs the Evergreen **WebView2 Runtime** (included in Windows 11). Next to it the build makes `bin\ShadeTubeSetup.exe`, the setup that carries that exe (3.57). **First run** shows the connect screen: *Connect Spotify* opens a WebView2 login window; under *Explore without Spotify*, *YouTube Music* or *MusicBrainz* browses that open catalog (3.56). User data lives in `%LOCALAPPDATA%\ShadeTube` ([3.14](#314-user-data)); during development use a sandbox profile instead ([5.1](#51-sandbox-profiles)). ### Linux The Linux version (since 0.14.0) builds the same sources with GCC 13+ (or Clang 17+), CMake 3.25+ and Ninja; it is developed on Ubuntu 24.04. Modules join one by one: `ST_LINUX_` in the top-level `CMakeLists.txt` says which build there, the list in `tests/CMakeLists.txt` which test programs ([3.83](#383-linux-port--core)). Packages (Ubuntu / Debian names): ```sh # core, catalog, musicbrainz, spotify, youtube, ytmusic, lyrics, player sudo apt-get install build-essential cmake ninja-build pkg-config \ libglib2.0-dev libsecret-1-dev libcurl4-openssl-dev libssl-dev # audio and video (FFmpeg decoding, libswscale for video frames; PulseAudio for song recognition and the # headphones / calls watcher) sudo apt-get install libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev libpulse-dev # the desktop integration and the Spotify login window sudo apt-get install libgtk-4-dev librsvg2-dev libwebkitgtk-6.0-dev # the app: ICU (sorting), ALSA (miniaudio's fallback output), cover pictures sudo apt-get install libicu-dev libasound2-dev libwebp-dev libjpeg-turbo8-dev libpng-dev ``` ```sh cmake -S . -B build/linux-debug -G Ninja -DCMAKE_BUILD_TYPE=Debug # Release: -DCMAKE_BUILD_TYPE=Release cmake --build build/linux-debug -j8 SHADETUBE_DATA_DIR=/tmp/st-dev build/linux-debug/tests/coreport/coreport_test ``` Assets are compiled into each executable (`st_embed_assets`, `cmake/Assets.cmake`), so a binary works from anywhere with no data folder to find. User data follows the XDG base directories: `~/.local/share/ShadeTube` (accounts, library, history), `~/.config/ShadeTube/settings.json`, `~/.cache/ShadeTube`, logs in `~/.local/state/ShadeTube/logs`, downloads in the Music folder's `ShadeTube`, sockets and locks in `$XDG_RUNTIME_DIR/ShadeTube` (0700). `SHADETUBE_DATA_DIR` puts everything in that one folder, laid out as on Windows ([5.1](#51-sandbox-profiles)). **WSL**: build from a copy on the Linux disk (`rsync -a --exclude .git --exclude build / ~/st/src/`), not from `/mnt/c` (much slower); WSLg plays sound on the Windows speakers, so test programs that play audio run with the null backend or at volume 0. ## 2. Repository layout ``` ShadeTube/ ├─ CMakeLists.txt, build.bat top-level build (version lives here), build helper ├─ README.md, CHANGELOG.md, LICENSE, THIRD_PARTY_NOTICES.md ├─ cmake/WebView2.cmake fetches the WebView2 SDK at configure time, `webview2` static target ├─ cmake/LinuxPackaging.cmake Linux: install rules + CPack (.deb, .rpm), 3.87 ├─ assets/ embedded in the exe │ fonts/ Bricolage Grotesque + JetBrains Mono (variable, OFL.txt) │ i18n/ .json translations (en de es fr pt ru uk id ja ko); _keys.json is a local dump │ remote/ the phone remote's web page (index.html, app.js, app.css; served by the app, see 3.23) │ icons/12|14|16|18|20|24 (the thin outline set, written by tools/icons.py, 3.43), logo/, placeholders/, animations/ (SVG frames), │ textures/, tokens/ (dark/light), themes/ (preset color themes, 3.35), app.ico ├─ docs/ DEVELOPMENT.md ├─ packaging/winget/ winget-pkgs manifest of the current release (tools/update_manifests.py) ├─ packaging/linux/ desktop file, AppStream metainfo, hicolor icons, Flatpak manifest (3.87) ├─ .github/workflows/ pages.yml (the website), linux.yml (Linux build, tests, packages; 3.87) ├─ bucket/shadetube.json Scoop manifest: the repository doubles as a Scoop bucket ├─ external/YoutubeExplode/ C++ YoutubeExplode (dependency; change it upstream) ├─ external/qrcodegen/ Nayuki's QR Code generator (C++, MIT, vendored unchanged; the remote's pairing code) ├─ external/libopus/ opusfile/ libvorbis/ libogg/ Xiph decoders (BSD-3-Clause, decoder parts vendored unchanged; 3.52) ├─ tools/ │ package.ps1 Release build -> dist\ShadeTube--win64.zip + ShadeTube--setup.exe (+ .sha256) │ update_manifests.py winget + Scoop manifests for the packaged release (see 6) │ package-linux.sh Linux: .deb / .rpm / AppImage / Flatpak into dist/ (+ .sha256), 3.87 │ run-linux-tests.sh Linux: runs the tests listed in tests/CMakeLists.txt `_linux_tests` offline │ linux-icons.sh renders packaging/linux/icons from assets/logo/app-icon.svg │ i18n_check.py translation checker (see 3.13) │ icons.py the icon set: draws assets/icons//*.svg (and the design package's copy), 3.43 │ import_design.py regenerates assets/ from the design package ├─ src/ │ core/ st_core ThreadPool, Dispatcher, Async (Lifetime, Result), Http, Proxy + ProxyProtocol (3.68), │ Settings, Paths, Log, Resources, Utf, I18n, CrashHandler, SafeFile (user files, 3.14), │ FileName │ catalog/ st_catalog source-independent models (Track, Album, Artist, Playlist, Page, ...), Credits │ musicbrainz/ st_musicbrainz MusicBrainz, Cover Art Archive, ListenBrainz, Wikidata client (rate limit, disk cache), │ LB Radio (3.78) │ spotify/ st_spotify Totp, Auth, SpotifyApi (Pathfinder + spclient), HashRegistry, Session, Accounts │ youtube/ st_youtube MatchService (track -> video -> stream, caches), AltSource (Piped / Invidious), │ VideoStreams + OfficialVideo (video mode's streams and official video search, 3.41 / 3.42) │ ytmusic/ st_ytmusic YouTube Music catalog: Parse (tolerant InnerTube parsers), YtMusic (endpoints, cache) │ audio/ st_audio AudioEngine, WasapiOutput, Decoder, ProgressiveBuffer, MfByteStream, Spectrum, Fft, │ VisualAnalysis (the visualizer's bands / beats / waveform, 3.61), │ Track, Downloader (MP3 transcode + trimming), TagWriter (tag editor core), │ XiphDecoder + XiphCodecs + Matroska + Resampler + XiphTags (built-in Opus / Vorbis, 3.52), │ Tempo (BPM estimate of audio, 3.65), MediaFeed (what a cast device fetches: the │ stream's bytes or decoded PCM as WAV / L16, 3.74), AutoMix (beat-matched transitions, 3.80), │ Key + KeyNotation (musical key, energy, 3.82), │ ParametricEq (headphone correction, 3.66), SpeechDsp (podcast silence trimming / voice boost, 3.67) │ lyrics/ st_lyrics LRCLIB client, LRC / Spotify / ID3 lyrics parsers, local lyrics, offsets, translation, │ romanization (Romanize, 3.63); the synchronizer's draft, LRCLIB publishing, Genius' │ lyrics search (3.58), SongFacts (Genius' song page: description + related songs, 3.76) │ recognize/ st_recognize song recognition (3.59): Signature (Shazam-format peaks), Shazam (request / answer), │ Capture (WASAPI process / endpoint loopback, microphone -> 16 kHz), Session │ player/ st_player Player: queue, shuffle, repeat, prefetch, recovery, session restore; Queues (several │ queues, 3.77); AudioCache (song cache, 3.45); RemoteOutput (the output while a cast │ device plays, 3.74) │ gfx/ st_gfx Device, Canvas, Text, TextShape (display text as geometry, 3.62), Icons, ImageCache, Theme, │ Types │ video/ st_video video mode's picture: VideoDecoder (MF + DXVA; FFmpeg on Linux), SyncScheduler, VideoPlayer, Fmp4Index; │ Soundtrack + AudioAlign (the official video's alignment, 3.42) │ ui/ st_ui Widget, Window, Layout, Controls, TextBox, Popups (menu/toast/dialog), Acrylic (the │ overlay surface and material, 3.36), Anim, │ ScrollPhysics (smooth scrolling, 3.28), ScrollDemo (SHADETUBE_SCROLL_DEMO), │ PageMotion (page transitions' timeline + cover flight, 3.31), │ HoldGesture (press and hold, 3.30) │ app/ ShadeTube.exe main.cpp, App (composition root), AppContext, Router, Shell, Components, PageWidgets, │ PageTransition (page transitions + the shared cover, 3.31) │ pages: Home, Search, Artist, Profile, BrowsePages (library), Collection, Blend, NowPlaying, │ Downloads, LocalFiles, Podcasts, Radio, Stats, SmartLists, Settings (+ About/AltSource/ │ Playback), ConnectScreen, MiniPlayer (+ MiniLayout, its geometry) │ features: LoginWindow, Source, Downloads, LocalLibrary, TagEditor, ListenStats + HistoryImport + │ ScrobbleImport (Spotify / Last.fm / ListenBrainz history, 3.8, 3.55), LibrarySort + │ LibraryView (Library views, 3.22), Display (interface scale + list density, 3.25), │ TrackColumns (the track table's columns, the queue's sections; lists, 3.47), │ CollapsingHeader + HeaderCollapse (collapsing page headers, 3.38), │ Radio, Blacklist, │ CoverGradient + CoverBackdrop (Now Playing's backdrop, 3.40), │ Credits + CreditsUi (song credits), LyricsPicker ("Yanlış sözler mi?"; both 3.46), │ LyricsSync (the lyrics synchronizer) + LyricSearch ("Sözden şarkı bul"; both 3.58), │ LyricsRender (the lyrics views' drawing and motion, 3.62), LyricsRomanization (3.63), │ SponsorBlock, Scrobbler, DiscordRpc, Smtc, Tray, Installer, Updater, Podcasts + │ PodcastsSpotify (Spotify shows -> public feeds, 3.54), Links + │ LinkOpener (pasted links), ServiceImport + CatalogMatch (Deezer / Apple Music / TIDAL │ lists matched to the catalog, 3.60), WinShell (taskbar buttons / progress, jump list), │ Preview + PreviewSession (song preview, 3.30), │ VideoMode + VideoView + VideoWindow (3.41), OfficialVideo + OfficialVideoCache (3.42), │ RemoteControl (phone remote; RemoteServer, RemoteApi, RemoteAuth, RemoteHttp, RemoteState), │ Accounts (several Spotify accounts, 3.48), SongNotification + SongNotifier (3.49), │ Visualizer (the full-screen visualizer, 3.61), │ Together + TogetherPanel (listen together) on the standalone Jam* core (JamMqtt, │ JamCrypto, JamInvite, JamProtocol, JamSync), Blend + Blends + BlendPage (Blend, 3.50), │ Recognition + RecognizeUi (Şarkıyı tanı, 3.59), │ RuleLists + RuleListsPage + RuleSources (Kurallı listeler, 3.64), Bpm + BpmStore (tempo, key, 3.65), │ AutoEq + HeadphoneEqSettings (Kulaklık düzeltmesi, 3.66), PodcastChapters + PodcastExtras + │ PodcastChapterList (podcast chapters / transcripts / speech, 3.67), │ HomeLayout + HomeCustomize (Ana sayfayı düzenle, the support card; 3.69, 3.73), │ AudioFocus + AudioFocusUi (headphones, calls; 3.70), Snooze (3.71), │ PrivateSession + PrivateSessionUi (Gizli oturum, 3.72), │ Casting (cast to device, 3.74) on the standalone Cast* core (CastProtocol, CastNet, │ CastDiscovery, CastMedia, CastRenderer), │ ArtistEvents + ArtistEventsUi (concerts and announced releases, 3.75), │ SongInfo + SongInfoUi (Şarkı hakkında, 3.76), │ ContentFilter + ContentFilterUi (İçerik filtreleri), Genres + GenreLookup (genres; 3.79), │ SmartOrder + SmartReorder (Akıllı sırala, 3.82), │ MemDemo (SHADETUBE_MEM_DEMO) + MemProfile (ST_MEMPROFILE builds): memory measurements │ st_install Installer + Updater + Autostart (defined in app/CMakeLists.txt, sources in app/): the │ app and the setup link it │ setup/ ShadeTubeSetup.exe the setup (3.57): st_setup_core (Payload, SetupArgs, SetupEngine), setup_pack (the │ build-host packer), SetupUi + main └─ tests/ console test programs (not shipped, see 5.2): accounts, altsource, artistinfo, audio, audiocache, audiodsp, autoeq, automix, blend, browse, cast, codecs, collections, contentfilter, credits, downloads, gpuloss, headers, history, homecontrols, icons, jam, key, library, links, lists, liveaudio, localfiles, lyrics, lyricsview, matching, memory, micro, miniplayer, musicbrainz, network, newreleases, nowplaying, pagetx, playback, podcasts, popups, preview, proxy, queues, queueundo, radio, recognize, remote, review, rules, scrobble, scroll, services, setup, shortcuts, smartlists, smartshuffle, smtc, songnotify, sponsorblock, spotify, stations, stats, sync, tags, tempo, textedit, theme, updater, userdata, video, visualizer, winshell, ytmusic, ytstreams ``` The original design package (`ShadeTube-Design/`: specs, tokens, screens) is **not part of the repository**. `tools/import_design.py` expects it locally at the repository root and regenerates the SVGs (stripping C2PA metadata that `ID2D1SvgDocument` rejects), tokens, textures and `app.ico`. Without it, edit `assets/` directly. The icons are the exception: `tools/icons.py` draws them and writes both `assets/icons` and, with `--design ShadeTube-Design`, the package's `icons/` (3.43), so an import brings back the same files. **Module dependencies** (never reverse them): `core ← catalog ← musicbrainz, spotify, youtube, ytmusic`; `core ← audio, lyrics, gfx`; `gfx ← ui`; `audio + gfx ← video` (it reuses the audio module's ProgressiveBuffer and MfByteStream); `audio ← recognize` (its Resampler); `audio + youtube + catalog ← player`; everything `← app`; `ui + st_install ← setup` (the setup links nothing else of the app). A new module gets `src//CMakeLists.txt`, links only what it uses and is added to this guide. ## 3. Architecture ### 3.1 Threads | Thread | Owns | Notes | |---|---|---| | UI thread | windows, widget tree, Direct2D, `Settings` | message loop; renders only when invalidated or animating | | `st-worker-N` pool (4–8 threads, 3 priority lanes) | network, JSON, image decode, matching, scans | `st::async(prio, lifetime.ref(), work, done)` | | audio engine thread | MF source reader, WASAPI | events marshalled to the UI with `Dispatcher::post` | | download, Discord RPC, crash-dump threads | range downloads, pipe I/O, minidump writer | private to their modules | | `st-remote` (only while the phone remote is on) | the LAN server's sockets, HTTP, event streams | requests go to the UI thread with `Dispatcher::post` (3.23) | | `st-video-decode` (only while video mode's picture is on screen) | the picture's MF Source Reader, its download, NV12 slot copies | frames handed over through a locked queue (3.41) | - **Never block the UI thread**: no network, no disk beyond a few KB, no `future.get()`. - Anything that touches widgets or Direct2D runs on the UI thread; other threads use `st::Dispatcher::post`. - Every async continuation is guarded by a `st::Lifetime` owned by the receiver. Pages call `life_.renew()` when their content changes, so stale requests are dropped before they reach the network. - **Exit** (`App::~App`, then `main`). A `Lifetime` only drops work that has not started: a running worker task keeps the raw service pointers it captured (`MatchService`, `AudioCache`, the Spotify `Session` / `Api`). So the persist hooks save and **cancel the long jobs** (the active download, a sync listing, a rule-list source fetch, playlist imports / exports and link lookups, the BPM analysis, official-video lookups; their pauses between pages end at once), then App **waits for the pool** (`ThreadPool::waitIdle`, at most 4 s) before it destroys those services. Just before that wait `http::cancelAll()` stops the **reads** of `core/Http` still under way (GET / HEAD on the shared transport and `getLimited`: covers, lookups): they end with `OperationCanceledException` instead of keeping the exit waiting for a slow DNS server (a name check of `isLocalHost` runs on a thread of its own that is no longer waited for; Linux: libcurl's progress callback ends the transfer, `CURLOPT_QUICK_EXIT` leaves its resolver thread behind; Windows: before the next step). **Requests that send something** (POST, PUT, PATCH, DELETE: a playlist edit, a scrobble) **still finish**. A task still running after that keeps them alive: App leaks them on purpose (`App::servicesKept()`) instead of freeing them under a worker, and `main` gives the pool 1.5 s more, then ends the process (`TerminateProcess`, after the log is flushed; everything is saved by then). The **single-instance mutex is released last**. A launch while an instance is exiting (its main window carries the `kExitingProp` property from the first line of `~App`) waits up to 20 s for that mutex and then starts, instead of activating a window that is going away or starting a second instance that writes the same files. ### 3.2 Memory policy - Track lists are **virtualized**: rows are painted from the model, with no per-row widgets. So are the Library page's grid and list (`app/LibraryView`; text layouts of a few screens are cached). - **GPU objects are process memory.** On an integrated GPU (the default adapter of most laptops) the driver backs every texture with the process's own pages: measured on Intel UHD, a 1 MB D2D bitmap costs ~1.3 MB of private commit and a window-sized render target its full size. Releasing one gives nothing back by itself: the driver keeps the memory in pools at the peak until the immediate context is flushed, the GPU has finished with the objects and `IDXGIDevice3::Trim` runs (`Device::trimPool()`). So every bitmap below counts in Task Manager, not as "video memory". - Images: `gfx::ImageCache` downloads to a disk cache (`cache\images`, pruned to 400 MB), WIC-decodes **at the requested pixel size** rounded up to a bucket (64 / 128 / 192 / 256 / 384 / 512 / 768 / 1024 / 1280 px, steps of 1.5-2×: a 200 DIP card at 175 % is 384 px, 0.56 MB, where the old 512 px bucket was 1 MB) and keeps D2D bitmaps in an LRU with a byte budget (64 MB; eviction stops at bitmaps painted in the last two frames, so a screen needing more goes over it instead of thrashing). **Expiry**: the router starts a page scope for every page it shows (`ImageCache::beginScope()`), and while a window is on screen every housekeeping tick calls `expire(20 s)`, which drops the bitmaps painted neither in the last frames, nor on the current or the previous page, nor in the last 20 s: Back stays instant, the covers of pages further back and of a closed Now Playing go instead of staying for the rest of the session (scrolling back within a page is the budget's job, as before). **Failed loads** are tried again (0.13.0; they used to stay failed for the session): a request after the entry's retry time loads it again, 30 s doubling to 5 min for failures that may pass (no connection, timeouts, HTTP 5xx / 408 / 429, an unreadable local file), 10 min doubling to 1 h for those that will not (other 4xx, an undecodable picture, whose disk-cache copy is deleted). Windows' connectivity hint (`NotifyNetworkConnectivityHintChange`, internet back) makes the passing ones due at once, and a thread timer repaints an idle window when one is due. `fetchAccent` always answers: at once when the color is known (also "none"), else after the load, also when the entry was decoded without a vivid color. D2D's texture cache is capped at 24 MB. Requests from widgets that went off-screen are skipped. - Icons: one mask per pixel size up to 96 px (a 24 px icon is 2.3 KB). Larger multi-color artwork (the cover placeholders at card or Now Playing size, a placeholder in a cover's flight) is drawn from the parsed SVG document (`Icons::drawColored`): it used to keep a bitmap per size for the session, 4 MB for Now Playing's. - Audio: only the current, the preloaded next and (while crossfading) the outgoing track are held (the built-in Opus / Vorbis decoders add ~0.1-0.2 MB per track, 3.52). Every download above 1 MB is buffered in a memory-mapped temporary file (`FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE`) and a local file is mapped read-only as it is, so their pages belong to the file cache, not the private commit, and Windows can drop them under pressure. A heap block is the fallback when no temporary file can be created. The song cache (3.45) copies a complete stream from that mapping to its file and plays it from a read-only mapping: it adds only its index (~0.3 KB a song). - GPU device: created with `D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS` (no driver worker threads: ~20 MB less commit on Intel UHD). A window's swap chain is created by its first frame, never for a hidden window, and goes when the window is hidden (`WM_WINDOWPOSCHANGED` with `SWP_HIDEWINDOW`: the tray, the main window behind the mini player, where the idle release below never comes): two window-sized buffers, 31 MB of GPU memory for 1440 × 900 DIPs at 175 %. Showing the window draws its first frame before it appears, as after the idle release. A minimized window keeps its swap chain (the taskbar thumbnail shows its last frame) until the idle release. - **On screen, every 10 s** `App::manageMemory()` calls `Device::trimPool()`: only what was already released comes back (+10-20 MB of driver pools after browsing or a few minutes of playback); live objects and Direct2D's caches stay, so the next frame costs the same (measured: 2-6 ms first frames, also in the middle of a page transition). `ClearResources` (`Device::trim()`) is never used on screen except once, 6 s after startup (7 MB of commit and 5 MB of GPU memory on Home): it drops the glyph cache, and re-rasterizing a full Songs list took 78 ms and then frames of up to 370 ms. - Pages are destroyed on navigation; history keeps the route and scroll offset, never widgets. A page restores its offset once its content is built (`ScrollPage::contentReady()`); left before that, it reports the offset still pending (`ScrollPage::scrollOffset()`), so the next Back lands at the same place, not at the top. Now Playing drops its backdrop field, lyrics, details and display-size text layouts when it closes (3.40). - When no one sees the main window (minimized, in the tray, mini player), `App::trimMemory()` trims the image cache to 25 %, clears icon masks, calls `Device::trim()` (`ClearResources`, then the flush and `Trim` of `trimPool()`: without the flush `Trim` found the released objects still pending and kept them) and trims the working set; 6 s after startup the last two run once. - **Idle graphics release** (`App::manageMemory()`): when no window of ours has been on screen for 30 s, `Device::release()` drops the D3D/D2D device and everything created on it, and the driver hands back its memory. Every holder of a device-dependent object registers a release hook (`gfx::DeviceHook`, or `addReleaseHook` for the static caches: `ImageCache`, `Icons`, `Canvas`'s shared effects, each `WindowTarget`'s swap chain (and its DirectComposition device / target / visual, which reference the DXGI device), Now Playing's and the lyrics view's baked bitmaps): one object left behind keeps the whole device alive, which the release logs as a warning. The next frame recreates the device (`WindowTarget::begin()` → `Device::ensure()`); a window shown from the tray draws its first frame in `WM_SHOWWINDOW`, before it appears, and a restore draws in `WM_SIZE`. A new device object must get a hook too. - Low memory (`CreateMemoryResourceNotification`): off screen the graphics are released at once; on screen the image cache drops what is not painted and D2D / driver caches are trimmed. - Video mode (3.41): its decoder, GPU surfaces and download exist only while its picture is on screen; they go with the last view, on the idle release and on device loss. - Data: the listening history's index and plays are compacted after a read or an import (no growth slack: 2.4 MB for 30 000 songs); the local library keeps each file's path once (its id → path map became an id → index map); MusicBrainz' in-memory response cache in front of the disk cache holds at most 100 bodies / 4 MB and none above 256 KB (it was 200 / 24 MB; a hit only saves reading a small cached file); DirectWrite reads the embedded fonts in place instead of copying them (0.6 MB). - `SHADETUBE_MEMLOG=1` logs a breakdown every 2 s (`core/MemoryStats`: commit, private working set, heap, mapped, image, GPU segments, image cache, icons, audio buffers). - **Measuring** (`app/MemDemo`, 5.4): `SHADETUBE_MEM_DEMO` scripts a session (routes, scrolling, Now Playing, the tray, the mini player, trims) and appends categorized reports to `logs\memreport.txt`: the private commit split into heaps / thread stacks / other private allocations (the driver's), every heap, every thread's stack, the largest other allocations and mapped views, the default heap by block size, the GPU segments, the image cache by bucket, icons, acrylic, audio buffers, widget counts and the main window's frame times since the previous report. A `-DST_MEMPROFILE=ON` build (`app/MemProfile`, never shipped) adds, with `SHADETUBE_MEMPROFILE=1`, the live `operator new` bytes by allocating function and by call stack (symbols from the PDB: build with `/Z7` + `/DEBUG`). The numbers of section 7 come from these scripts. ### 3.3 Rendering, theme and keyboard focus - `gfx::Device`: D3D11 device → DXGI flip-model swap chain (`FLIP_DISCARD`, waitable) → `ID2D1DeviceContext`. Device loss recreates all device resources, wherever it shows: `D2DERR_RECREATE_TARGET` from `EndDraw`, `DXGI_ERROR_DEVICE_REMOVED` / `_RESET` / `_HUNG` / `DRIVER_INTERNAL_ERROR` from `Present`, `ResizeBuffers`, `CreateSwapChain*` or the composition objects (`Device::lost()` notes it, `Device::recoverIfLost()` recreates the device before the next frame; the log has `GetDeviceRemovedReason`). `WindowTarget::resize()` never throws (a failed `ResizeBuffers` drops the swap chain; the next frame makes a new one) and `begin()` retries once on a new device. A frame that still throws is dropped, not fatal: `Window::render()` abandons the half-drawn target, keeps the window dirty and tries again after 50 ms, doubling up to 2 s while it keeps failing (`Window::failedFrames()`; the log has the first three failures, then every 50th). Dev: `SHADETUBE_GPU_LOSS` simulates a removed device (5.4); `gpuloss_test` covers it. - Invalidation-driven frames: vsync while animating, otherwise the loop sleeps in `MsgWaitForMultipleObjects` (0 % CPU when idle); hidden windows never render. Neither do windows nobody can see, and animations and the caret blink stop there (no wave, no glides): a locked session (`WM_WTSSESSION_CHANGE`), the display turned off (`GUID_CONSOLE_DISPLAY_STATE`), a cloaked window (another virtual desktop; `EVENT_OBJECT_CLOAKED` hook) and a window covered completely by other windows. DXGI never reports a windowed flip-model swap chain as occluded, so `Window::coveredByOthers()` looks at the windows above it in z-order (their `DWMWA_EXTENDED_FRAME_BOUNDS` subtracted from the window's on-screen part; transparent, layered-translucent, tool and popup windows other than the taskbar, cloaked and minimized ones don't cover), at most once a second while drawing and every 250 ms while covered; activation, a click, a move or a resize ends it at once. The last frame stays on the screen, `dirty_` is kept, and the window draws the current state the moment it shows again. Measured (Debug, a near-silent WAV playing, % of one core, before → after): locked 15.2-16.4 → 1.9-4.5, covered by a topmost window 14.4-24.6 → 4.1-5; visible 23-26 both (the wave); the search field focused and idle 1.09 → 0.16, in an inactive window 0.91 → 0.13. `frame::requestNextEvery(n)` asks for every n-th refresh instead (the frame is presented with sync interval n; the visualizer on fast displays, 3.61); a plain `requestNext()` wins. An open overlay whose `OverlayLayer::coversWindow()` is true (a full-window view, faded in) is painted alone: the tree and the overlays below it are skipped. Everything is in DIPs (Per-Monitor V2 DPI aware); the main window's DIP scale is the monitor's DPI times the user's interface scale ([3.25](#325-interface-scale-and-list-density)). - Window placement (`ui::Window` constructor): the first start centers the default 1440 × 900 DIPs on the primary work area, or 92 % of it when that does not fit (1920 × 1080 at 150 % has only 1280 × 688 DIPs); a saved rect (`-1, -1` = none; negative coordinates are a monitor left of / above the primary) is moved and shrunk into the work area of the monitor it is mostly on, the nearest one if that monitor is gone, so the title bar is always reachable. - Frame clock: `frame::now()` is the time the frame will be **shown** at, the next vblank on DWM's refresh grid (`Window::frameTime()`, `DwmGetCompositionTimingInfo`), not when it started: frames start unevenly after the swap chain's wait (2.5 / 5.5 ms apart at 240 Hz) but appear on whole refresh periods, so animations and scrolling advance by the same amount per refresh. Two frames in one period go a period apart; without DWM timing the plain clock is used. `frame::begunAt()` is the real start (profiling). - Scrolling: every scrolling surface shares one smooth-scroll engine (3.28). - `gfx::Theme` loads `assets/tokens/tokens.dark.json` / `tokens.light.json`. The accent is dynamic (extracted from the album art, cross-faded) or fixed (`Settings.accentMode`). Preset and custom themes per mode, the theme's own accent, corner radii and the UI font: 3.35. - Theme mode Dark / Light / System (`Settings.theme`; System follows `AppsUseLightTheme` and is re-read on `WM_SETTINGCHANGE` "ImmersiveColorSet"). Switching is live: `Theme::load()` swaps the palette, re-derives the accent (the light theme darkens it to ≥ 3:1 against `bg.base`) and bumps `Theme::generation()` for caches that bake colors; `App::applyTheme()` refreshes every window frame (DWM dark mode, border/caption color) and the tray menu. - **Mica** (Ayarlar › Görünüm › *Mica arka plan*, `Settings.micaBackdrop`, off by default; main window only). In effect while `ui::Window::backdropAvailability()` allows it: Windows 11 22H2+ (build 22621), transparency effects on (`Personalize\EnableTransparency`), no high contrast; re-checked on `WM_SETTINGCHANGE`. A main window created with the setting on presents through DirectComposition (`WindowTarget::useComposition()`: `CreateSwapChainForComposition`, premultiplied alpha, one `IDCompositionVisual` on the HWND; these objects go with the swap chain on device loss and idle release) and sets `DWMWA_SYSTEMBACKDROP_TYPE = DWMSBT_MAINWINDOW`, which draws Mica behind the entire window. There is no `DwmExtendFrameIntoClientArea` (DWM would then draw its own caption buttons under the title bar) and no caption color while it is on. Theming tools that change every window (Mica For Everyone and the like) extend the frame from outside, and the translucent title bar then shows Windows' buttons next to ours (issue #4); DWM has no getter for the margins, so while Mica is on `Window::checkFrame()` sets them back to 0 (`unextendFrame()`) on activation, on a DPI change and every 2 s (`kFrameGuardTimerId`; a no-op when nobody changed them). Tools that work inside the process cannot be undone that way: Windhawk's Translucent Windows hooks `DwmExtendFrameIntoClientArea` and turns every call into `-1` margins (issue #6). `checkFrame()` sees that through DWM's hit test, which only finds its caption buttons (`DwmDefWindowProc(WM_NCHITTEST)` = `HTCLOSE` at `DWMWA_CAPTION_BUTTON_BOUNDS`) while the frame is extended over them; a maximized window (client inset in `WM_NCCALCSIZE`) gets no answer there, so then the earlier result holds or, first shown maximized, a jump at the function's entry out of the system folder's code (`frameFunctionHooked()`) decides. DWM's buttons then become the window's: `Window::systemCaptionWidth()` gives the title bar their room and it leaves out its own (`TitleBar:: captionWidth()`), `hitTestNc()` answers `HTMINBUTTON` / `HTMAXBUTTON` / `HTCLOSE` there (DWM's hit test, or the button bounds in thirds when maximized) and DefWindowProc runs them as on a standard frame (hover, snap layouts; maximized, DWM shows no hover). `SHADETUBE_FRAME_TEST=extend` simulates such a hook. Painting (`Canvas::translucent()`): the frame is cleared to `Canvas::surface()`, `bg.base` at 55 % (dark) / 50 % (light) (`Palette::bgBackdrop`), instead of `bg.base`. Surfaces that cover content use `Canvas::fillSurface()`, which replaces the pixels instead of blending over them (sticky headers, player bar, connect screen). Content that dissolves into the background uses `Canvas::pushFade()` (artist banner). Content faded as a whole over the surface (a page during a page transition, 3.31) goes into `Canvas::pushSurfaceGroup()`: inside it `fillSurface()` clears to transparent, since the surface is already below the group. Cards, menus, dialogs, tooltips, Now Playing and the lyrics view paint themselves opaque and stay opaque; so does the mini player. A full-surface background must use `fillSurface()` / `surface()`, never an opaque `bg.base` fill. Mica off (setting, transparency effects, high contrast) is live in such a window: opaque frames into the same swap chain, DWM's backdrop removed after the first one is up, and back on the same way. Turning it on in a window that started without it applies at the next start (the row says so): a live window switched from its HWND swap chain to a composition one keeps showing the released swap chain's last frame underneath. Without the setting the window keeps the HWND swap chain and renders exactly as before. - Keyboard focus is drawn by the `Window`, never by widgets: a 2 px accent ring above the tree and overlays, shown only after keyboard use ("focus visible"). Tab / Shift+Tab follow tree order, modal overlays trap focus and give it back when they close, focus survives page rebuilds and the focused widget is scrolled into view. - Text fields (`ui/TextBox`, editing core `ui/TextEdit`; 0.13.0): Ctrl shortcuts are Ctrl without Alt (AltGr is Ctrl+Alt to Windows: AltGr+A types ą instead of selecting all; also in the lyrics editor and the track list). Undo / redo (Ctrl+Z, Ctrl+Y, Ctrl+Shift+Z) with steps grouped like an editor's: a word, a run of Backspaces or Deletes, a paste, a cut, the clear button. The caret, Backspace, Delete and Shift+arrows stop on grapheme clusters (Windows' `icu.dll` when present, built-in rules otherwise: emoji with modifiers / ZWJ, flags, combining marks, Hangul jamo; never inside a surrogate pair). The caret blinks for Windows' caret timeout after the last input, then stays on, and is hidden while the window is inactive. The IME composition and candidate windows sit at the caret (`Widget::caretRect()`, `WM_IME_STARTCOMPOSITION` / `WM_IME_COMPOSITION`). ### 3.4 Playback pipeline 1. A list calls `Player::playContext(tracks, index, context)`. 2. Downloaded tracks and local files play straight from disk (`localFileFor` / local-file resolvers). 3. Otherwise the song cache (3.45) when it holds the track's video in the current quality's format, else `youtube::MatchService::resolve(track)`: the persistent `spotifyId → videoId` cache (`cache\matches.json`, manual picks pinned), else `YoutubeExplode::Music::TrackMatcher::find({title, artists, duration, album})`. Titles and names are compared folded on both sides (`TrackMatcher::normalize`, Windows: NFKD, combining marks dropped, ß / æ / ø / ł / đ / þ / dotless and dotted I spelled out, invariant lowercase, punctuation of any script → spaces), so "ŞARKI" finds "şarki", "Ä" finds "a", Cyrillic / Greek case differences match; SoundCloud's word check uses the same folding. When YouTube refuses the best video (`VideoUnplayable`), only the other candidates that reach the matcher's `minimumScore` (40) are tried (`MatchService::playOrder`), and a stand-in is remembered in `matches.json` only when it is a confident match (score ≥ 60, `keepsMatch`); otherwise it plays this time and the song is matched again next time. Then the manifest → best audio stream (AAC/MP4 preferred; Opus/WebM, decoded built in (3.52), when quality is High; Normal = ≤ 128 kbps AAC; DRC "stable volume" variants only when nothing else exists). Stream URLs are cached until they expire (about 5 h). If YouTube fails and a backup source is set, the stream comes from Piped / Invidious (3.9). 4. `AudioEngine::open()`: `ProgressiveBuffer` (ranged download) → the built-in decoder for Opus / Vorbis in WebM, Matroska and Ogg (3.52), else `MfByteStream` → MF Source Reader → float PCM → [podcast silence trimming, 3.67] → [crossfade mix] → [podcast voice boost] → equalizer → headphone correction (3.66) → volume ramp / loudness gain → look-ahead limiter → WASAPI event-driven, shared (or exclusive, 3.53), on the Windows default device or the one picked in *Ayarlar › Ses*. A fragmented MP4 whose track has an edit list (some Art Tracks' AAC 140, YouTube's media time 1600 at 44.1 kHz, the encoder's priming) is one Media Foundation's MPEG-4 source presents no sample of (the song "ended" at 0:00 before 0.11.0): `audio::Decoder` opens it on a view of the buffer with the edts freed (`audio/Fmp4Index`, `freeFragmentedEditList`; only when there is an edit list, any other file opens as before), drops the samples before the edit and shifts the time stamps and seeks by it, so the song starts on its first real sample, on the presentation timeline (identical to the stream's Opus, measured). Streams, passthrough downloads and the song cache's files go through the same path. 5. The next queue item is resolved at Low priority and preloaded 25 s before the end (75 s when it will be AutoMixed, 3.80; `Settings.preloadNext`, implied by a crossfade) for a gapless handoff; downloads and local files are preloaded straight from disk. The queue is saved to `session.json` and restored at startup. 6. *Wrong match?* lists `MatchService::candidates()`; choosing one pins it in the cache. SponsorBlock (`app/SponsorBlock`, k-anonymity hash-prefix lookups) skips non-music segments of the matched video. 7. **Failures** (`Player::onEngineError`): a stream that fails with a network error (an expired or refused URL) is resolved again with a fresh manifest and continues where it was (twice); a WebM stream the engine can't read at all switches the session to AAC; a song-cache file that fails is dropped and the song resolved again; a local file, a podcast episode after its retries, a station or anything else shows a toast and moves on after 1.5 s (a whole queue failing in a row stops). The engine reports errors only for the track it plays: a preload that fails is dropped without an event and opened anew when its turn comes. An error carrying the *prepared* track's tag therefore means the engine had already moved on to it at the current track's end (gapless or crossfading; `onEnded` comes only once it is heard) and it failed before a sound of it was heard — a network drop or a googlevideo 403 in the last ~25 s, a seek into the last seconds: the player follows it to its slot (`followPrepared`, as `onEnded` does) and handles the failure as the current item's, from its start (it used to stop dead on the finished song). A **device error** (`ErrorKind::Device`: no output device, another app holding it exclusively, unplugged before Windows switched the default) is not the item's: the engine reports it once per outage, tries to open a device every second (and on a device change) and publishes Loading meanwhile, never Playing; the player shows one toast and stays on the item — its position and its song-cache file stay — and it plays on once a device opens. A seek made while the item still resolves (`pendingSeekMs_`) is the position it opens at (an item without a known length yet is not clamped to 0:00; the engine keeps the position within the track). **Sound settings** (*Ayarlar › Ses*, `app/AudioSettings.cpp`; applied by `Player::applyAudioSettings()` or per track): - **Loudness normalisation** (`Settings.normalizeVolume`, target `loudnessTarget` -19 / -14 / -11 LUFS): YouTube reports each stream's `loudnessDb` against its -14 LUFS reference (YoutubeExplode parses it per format, with `playerConfig.audioConfig` as the fallback), so a stream gets `target + 14 - loudnessDb` dB. Local files and downloads use their ReplayGain track gain (`audio/ReplayGain`: ID3v2 TXXX, FLAC Vorbis comments, MP4 freeform atoms, read by the decode thread before the decoder opens; Ogg files: `REPLAYGAIN_TRACK_GAIN`, or Opus' `R128_TRACK_GAIN` + 5 dB, from the comments the built-in decoder reads) plus `target + 18`; no tag = no gain. MP3 downloads carry the stream's loudness as a `REPLAYGAIN_TRACK_GAIN` TXXX frame (`-4 - loudnessDb`), so they play at the same level. Without the peak levels, boosts are capped at +4 dB (+8 dB at the loud target); cuts go down to -20 dB. - **Limiter** (`audio/Limiter`): the whole device block goes through a look-ahead peak limiter (-0.3 dBFS ceiling, 5 ms look-ahead: the needed gain is min-filtered and averaged over the window, ~150 ms release) instead of hard clipping, so EQ boosts, normalisation boosts and hot masters are turned down without overshoot or clicks. Its delay is counted in the engine's "last real frame", so a pause still plays its whole fade-out. - **Equalizer** (`audio/Equalizer`): 10 peaking biquads (31 Hz .. 16 kHz, Q 1.41, double precision) plus a preamp and an automatic headroom cut equal to the largest boost of the combined response. The engine picks up changes through a versioned snapshot (`setEqualizer`) at the next block; coefficients follow the output format. Presets live in `eqPresets()` (ids in `Settings.eqPreset`, names in the settings page). - **Transitions** (*Şarkılar arası geçiş*: *Kapalı / Crossfade / Akıllı / AutoMix*, each with its own description; `Settings.crossfadeSec` 0 = off, 1-12 the length, *Geçiş süresi* below the choice while one is on; `Settings.transition` `"crossfade"` / `"smart"` / `"automix"`, default smart, so older settings keep the smart crossfade they had): `Player::crossfadeInto()` puts the length on the preloaded track's `StreamSource::crossfadeMs` (0 inside an album playing in order, for podcast episodes, repeat-one and any speed but 1x) and `Player::transitionFor()` the kind on `StreamSource::transition` (opened tracks get it too: AutoMix engages their crossover path, 3.80). AutoMix becomes smart for podcast episodes and for a listen-together guest (`Player::setFollowingHost`, set by `app/Together` while a guest's command filter is installed). The engine starts the mix when the current track has that much left and the next one is decoded in the same output format, moves the old track to `fading` and mixes it under the new one with equal-power curves; the transition event and positions follow the new track from the first mixed block. Pause / seek / open / stop during a mix fade both out. *Smart* parts (smart and AutoMix's fallback): a song whose last 20 s went silent (under -50 dBFS for 1.5 s) hands over at once with a 0.5 s fade, and the incoming song's leading silence (up to 5 s) is skipped (`Track::skipSilence`). The plain crossfade does neither. A next track shorter than the fade (or one that ends early) no longer cuts the outgoing one: `advance()` leaves `fading` alone, so it keeps fading under the track after it (or alone, through the zero-fill path, with the visualizer and waveform fed), and the events stay in order (`onEnded(A, B)` before `onEnded(B, 0)` when B ends first; before 0.13 the fading song was dropped with a click, and a crossfade into an empty track cut A's fade and reported `onEnded(A, 0)`, so the Player opened B again); a preloaded track that decoded to nothing (`decoderEnded() && available() == 0`) is never crossed into, so the outgoing song plays to its end and the handoff is a plain one. - **One output rate**: the engine asks the device for its shared-mode mix rate (`WasapiOutput::mixRate`) and every track decodes to it (`Decoder` requests that rate from the Source Reader's resampler, or the built-in decoders' `audio/Resampler`, through a `RatePolicy`; live streams keep theirs). Songs of 44.1 and 48 kHz therefore hand over gaplessly or crossfade without reopening the device. Exclusive mode decodes at the tracks' own rates instead (3.53). - **Playback speed** (`Settings.musicSpeed` / `podcastSpeed`, 0.5-3x, `Player::setSpeed`, the player bar's speed button, the speed shortcuts): `StreamSource::speed` starts a track at its kind's speed and `AudioEngine::setSpeed` changes the current one. `audio/TimeStretch` is a WSOLA stretcher (SoundTouch's method: sequences joined where the cross-correlation of their overlap is highest; sequence and seek lengths follow the tempo) between the track and the mix; runs record the speed, so positions stay in track time. Back at 1x it hands out what it holds and steps aside. AutoMix (3.80) drives it too: a tempo that changes per block, and beat anchors (`setAnchors`) that put a sequence join's content lead on its mean wherever a beat falls inside the sequence, so beats come out where the tempo says (±1 ms instead of WSOLA's ±10 ms). - **Output device** (`Settings.outputDeviceId` / `outputDeviceName`): `WasapiOutput` opens that endpoint while it is active, else the default, and its notifier reopens on the preferred device when it comes back. ### 3.5 Spotify integration The user signs in to **their own** account and ShadeTube reads **their own** data through the endpoints the Spotify web player uses. Audio never comes from Spotify. Flow (`src/spotify/`, `app/LoginWindow`, `app/Source`): 1. **Login**: a WebView2 window opens `accounts.spotify.com`; when Spotify sets the long-lived `sp_dc` cookie it is captured and stored DPAPI-encrypted in the account's `accounts\\spotify.dat` (never in `settings.json`). Several accounts can be signed in and switched without a new login (3.48). 2. **Token** (`Auth`, `Totp`): a RFC 6238 TOTP (CNG HMAC-SHA1) over Spotify's server time, with the secret from a public gist (baked-in fallback), signs `GET open.spotify.com/api/token`. The web-player token is refreshed before it expires (`Session::maybeRefresh`, from the app's housekeeping tick). Failures are told apart (`AuthError`): no answer / 408 / 429 / 5xx is **transient**; HTTP 401 or an anonymous token after a retry with the gist's newest secret means the cookie is **refused** (a made-up `sp_dc` gets 401, a wrong TOTP secret 400: `spotify_test token-probe`). **Renewal** (`spotify/TokenRefresh`): one renewal at a time for every caller (single-flight; callers that asked with the same stale token wait for its result), with an exponential backoff after failures (`core/Backoff`: 5 s doubling to 5 min, ±20 % jitter) that a success, a new account or the network coming back resets. An `Api` call answered with **HTTP 401** renews through it and retries once (`query`, `spclient`, the cover upload), so many requests failing together send one token request; a token issued for another account is never renewed. A refused renewal marks the account **expired** (below). **Connection trouble** (`Session`): a failed connect at startup keeps the saved cookie and the session in `Connecting` with `offline()` set (title bar chip "SPOTIFY · ÇEVRİMDIŞI", Ayarlar "Tekrar dene"), not the connect screen; it is tried again on the same backoff and at once when Windows reports internet access again (`app/NetworkWatch`: `NotifyNetworkConnectivityHintChange`, else `NotifyIpInterfaceChange`). A connect or renewal under way when the network comes back (or "Tekrar dene" is pressed) was possibly sent before it: if it fails, the next try goes at once (the connect) or at the next tick (a renewal) instead of after a new wait. A refused cookie (at a connect or a renewal) marks the account expired: `onExpired` once → a warning toast "Spotify oturumu sona erdi" with "Tekrar bağlan" (opens the login; the same Spotify user gets the account back), the chip, the account menu and Ayarlar say so until then, and nothing more is sent with that cookie. No library is cached on disk, so an offline start shows the open catalog's pages until the connect succeeds. 3. **Data** (`SpotifyApi`): persisted GraphQL queries and mutations on `api-partner.spotify.com/pathfinder/v2/query` (profile, library, playlists, albums, artists, followed shows, show details, search with its per-kind pages (3.54), personalized home, library and playlist-item writes: add / remove / `moveItemsInPlaylist` with a `newPosition` relative to a row uid); the spclient playlist service for create / rename / delete, "Edit details" (`UPDATE_LIST_ATTRIBUTES` with `noValue` to clear the description or the picture) and track counts; a new cover goes to `image-upload.spotify.com/v4/playlist` (raw JPEG -> `uploadToken`) and `/playlist//register-image` (-> `picture`) first; `inspiredby-mix` for radios; `user-profile-view/v3` for public profiles (3.54). The web-player token is rate-limited on `api.spotify.com/v1`, so that API is not used. Home shelves are requested with the UI language's `Accept-Language`. 4. **Session** caches the library snapshot (playlists incl. Liked Songs, saved albums, followed artists) for the sidebar, Home and Library. **Folders** (`spotify/PlaylistTree`): the rootlist brackets them with `spotify:start-group::` / `spotify:end-group:` items (nested to any depth); `parsePlaylistTree()` turns that into folders + playlist → folder, kept next to the flat list in the snapshot. libraryV3 keeps giving the order: `treeRows()` lists a level with each folder where its first (most recent) playlist would be and empty folders last. The sidebar shows them as collapsible rows (open ones in `Settings.expandedFolders`); the Library page as folder cards opening `{Library, "folder:"}`. Each libraryV3 item's `addedAt` / `playedAt` / `pinned` (folders as `folder:`) is kept in `LibrarySnapshot::entries` for the Library's sort orders (3.22); albums and artists are paged like the playlists (50 a page, at most 20 pages). 5. **Source seam** (`app/Source`): pages read Spotify when logged in and the open catalog otherwise (MusicBrainz or YouTube Music, 3.56); detail lookups route by id (`spotify:*` URI → Spotify, `ytm:*` → YouTube Music, MBID → MusicBrainz), so mixed histories keep working. **Hash self-healing** (`spotify/HashRegistry`). Each Pathfinder operation is sent with the SHA-256 of its query document. When Spotify retires a hash the call fails with HTTP 412 "Invalid query hash"; `HashRegistry::heal()` (worker threads only) then scans `open.spotify.com` → the `web-player..js` bundle (and, only when needed, lazily loaded chunks) for `"","query"|"mutation",""`, falling back to the community `spotify-gql-registry`. A learned hash is adopted only for an op whose current hash was rejected, persisted in `spotify-hashes.json`, and scans are throttled to one per op per 10 minutes. An HTTP 400 that names a variable is a request-shape change and needs a code fix in `SpotifyApi.cpp`. Keep the built-in table (`kBuiltins` in `HashRegistry.cpp`) current with `spotify_test hashes`. ### 3.6 Radio, autoplay and blocklist - **Radio** (`app/Radio`): `Api::radioPlaylist(seed)` (the web player's "Go to song radio") → the first 100 tracks → blocklist-filtered → replaces the queue. Track, album and artist seeds are supported; a playlist is seeded with its first playable tracks. Starting the radio of the playing song keeps it playing and replaces what follows. YouTube Music seeds (`yt:` songs, `ytm:` albums / artists / playlists) get YouTube Music's automix queue instead (3.56), with or without a Spotify session; autoplay seeds from them the same way. - **Autoplay / endless playback** (`Settings.endlessPlayback`): when at most one playable item is left and repeat is off (`Player::onQueueLow`), the radio of the current Spotify track is appended (only new, unblocked tracks), one fetch at a time, each seed once per queue generation and a bounded number of seeds per queue. A queue built by the radio builder (context `station:`, 3.78) is extended by its station instead, whatever the setting says. - **Blocklist** (`app/Blacklist`, `blacklist.json`): blocked tracks and artists are never picked by the player on its own (auto-advance, next/previous, shuffle, repeat wrap, prefetch) and are dropped from radio and autoplay; a row the user picks explicitly still plays. Matching: track id, or the same title + first artist with durations within 3 s; artist id, or the same name across catalogs. ### 3.7 Downloads `app/Downloads` is a background queue (one download at a time) writing to `Music\ShadeTube\\\` and recording items and user collections in `downloads.json`. `audio/Downloader` reuses `ProgressiveBuffer` + `Decoder` and encodes **MP3** (320/256/192 kbps) with a Media Foundation Sink Writer (no FFmpeg), prepending an ID3v2.3 tag with the cover; bitrate 0 keeps the original stream as `.m4a` (passthrough). With SponsorBlock on, MP3 downloads are **trimmed**: segments are cut sample-accurately from the decoded PCM with 8 ms raised-cosine fades at every splice and a continuous timeline (cuts that would leave < 10 s are ignored); the count and removed time are stored per item. Passthrough downloads are never trimmed. Downloaded tracks play offline from disk. With `Settings.lyricsInDownloads` (and lyrics on) the lyrics are fetched before the transcode (3.15) and written into the MP3's tag (USLT text, SYLT lines in ms, UTF-16), and synced ones also as `.lrc` next to it (passthrough `.m4a` too). Their times are not shifted by the cuts: lyrics are timed to the song, which is what the trimmed file holds. **Files and records** (`app/DownloadRecords`: the `downloads.json` format and the file rules, standalone and tested). - **Names**: `st::sanitizeFileName` (`core/FileName`, shared with podcast episodes) makes each of Artist / Album / Title: at most 80 UTF-16 units, cut **before** trailing spaces and dots are trimmed (Windows drops them from a created folder, so a path that kept them names a folder that does not exist) and never inside a surrogate pair; characters Windows refuses become `_`, line breaks a space; device names (`CON`, `nul.mp3`, `COM1`, `COM¹`, `LPT9`, `CONIN$`...) get a `_` in front. Records store absolute paths, so files named by older versions keep resolving. 0.12 cut long names inside an emoji: the name on the disk ends in half a surrogate pair, which the UTF-8 record holds as U+FFFD, so the record named no file. At load such a record is matched to its file component by component (`dlrec::findLossyPath`) and the file (with its `.lrc`) is moved to the name the sanitizer gives now. Linux: the same for a name whose bytes aren't valid UTF-8 (another tool's, or a Windows name on a shared drive), which reads back with U+FFFD for each bad sequence. - **One file, two records**: the same song from two catalogs (a Spotify and a MusicBrainz id) names the same file. The second download takes the first one's file instead of downloading over it, and "İndirileni sil" deletes the file only when no other record uses it (`dlrec::fileShared`); the other record keeps playing. - **Queue**: the user's own queued (or half-done) downloads are kept in `downloads.json` as `"queued"` and queued again at the next start; sync downloads in the queue are not kept (the sync queues them again). - **Saving**: `downloads.json` is serialized on the UI thread and written on a worker through `core/SafeFile` (3.14), right away at exit. The exit cancels the active download before the services it uses are freed (3.1); it stays queued. **Download sync** ("Çevrimdışı kullanılabilir"; `app/SyncRules` = rules + pure planning, standalone and tested; `app/DownloadSync` = engine + UI). Liked Songs (Spotify's while logged in, else the local ones), playlists (Spotify or local) and albums (Spotify or MusicBrainz) can be kept downloaded: the download button in a collection header, or the context menus of the sidebar and Library cards. Rules live in `sync.json` with each one's last listing (track ids), error and backoff, plus per-track download attempts. - **Passes** (UI thread; listings on workers): 45 s after startup, then whenever a rule is due (`ruleDue`): never listed, a change seen here (a like / unlike through the library snapshot, a Spotify playlist edit, a local list change; debounced 5 s, at least 1 min between Spotify listings and 5 min for Spotify Liked Songs, which pages every like), tracks still missing 30 min after the last listing, or the periodic relist (playlists 45 min, Spotify Liked Songs 6 h, albums 24 h). "Şimdi senkronize et" forces one. Rules are listed one at a time; Spotify pages go 300 ms apart and collections 1.5 s apart; a failed listing backs off 1 / 5 / 15 / 60 min, and a 429 stops every Spotify rule for at least 10 min. Rules whose source is unavailable (Spotify while logged out) are skipped and keep their track ids. - **Queueing**: a listing's downloadable tracks (not radio / local files / podcast episodes, not blocked) become the rule's track ids; what is neither downloaded nor queued goes to `DownloadManager::enqueueSynced` — after the user's own downloads, marked `"sy"` in `downloads.json`. Failed sync downloads are retried after 1 h, then 6 h, then wait for "Hataları yeniden dene". The storage cap (`Settings.syncCapGb`) counts sync files on disk plus size estimates of the queued ones (duration × bit rate) and leaves out what does not fit. - **Gating**: sync downloads wait in the queue while sync is paused (`syncPaused`) or the connection is metered (WinRT `NetworkInformation` connection cost, checked every minute on a worker) unless `syncOnMetered`. - **Dropping**: after every listing, sync downloads that no rule wants any more are dropped from the queue, and their files are deleted only with `syncRemoveDropped` ("Listeden çıkan şarkıları sil", off by default). A listing that comes back empty after holding tracks never deletes anything. A manual download or a folder add makes a sync download the user's own (`synced = false`): sync never cancels or deletes those. Removing a rule asks whether to keep its songs (they become the user's own downloads) or delete them (unless another rule wants them). - **Excluded songs**: "Senkrondan çıkar" in a song's menu, cancelling a sync download on the Downloads page and "İndirileni sil" take the song out of every rule that keeps it: it is recorded in the rule's `"ex"` list in `sync.json` (`[id, title, artists, unix time]`, newest last; absent before 0.6, so older files load as they are), its sync download is dropped (queued ones cancelled, files deleted; the user's own downloads are left alone) and later listings skip it, so it is never downloaded again for that collection. A song excluded from Liked Songs does not count as a new like. The rule's status line counts them ("2 hariç") and its menu has "Hariç tutulanlar (n)": the newest 12 with "Geri al" each, and "Hepsini geri al"; putting a song back (also "Senkrona geri al" in the song's menu) marks the rule changed so the next pass downloads it. - **UI**: the header toggle shows the progress as an arc around the icon (accent while working, tertiary while waiting) and a check when complete; the Downloads page lists the rules ("Senkronize edilenler": done / total, queued, errors, last sync, why sync waits) instead of one row per queued sync download; Ayarlar › İndirme ve çevrimdışı has the pause, metered, cleanup and storage cap rows. ### 3.8 Local files and listening stats - **Local files** (`app/LocalLibrary`): `local::scan()` walks `Settings.localFolders` on workers (up to 50 000 files), reads tags through the Windows property system (file name "Artist - Title" as fallback) and extracts embedded covers once. The index (`local-library.json`: path, size, mtime, tags) makes rescans incremental; an unreachable folder keeps its tracks. Ids are `local:`. User files are only read, except when the user edits their tags (below). Scanned extensions: `.mp3 .m4a .aac .flac .wav .wma .ogg .oga .opus`. Ogg Opus / Vorbis files have no Windows property handler: their comments, duration and cover come from `audio/XiphTags` (3.52). - **Views** (`app/LocalFilesPage.cpp`): Şarkılar, Albümler, Sanatçılar and **Klasörler**. The view and the open folder are remembered (`Settings.localView`, `localFolder`) and named in the route (`{LocalFiles, "songs" | "albums" | "artists" | "folders" | "folder:"}`, `""` = the remembered one; a tab switch rewrites the current history entry with `Router::retarget`, opening a folder navigates), so Back / Forward walk the folders. Klasörler shows a breadcrumb (the listed folders' parent "Tüm klasörler" only when there are several), the subfolders as cards (song count, the first cover found below) and the folder's own songs in the usual track table; Play / Karıştır and the "⋯" / card menus (play next, queue, add to playlist, export, edit tags, open in Explorer) act on the folder with its subfolders. The tree (`local::buildFolderTree`: natural order, totals, covers) is built on a worker once per library generation (`LocalLibrary::folderTree()`; 50 000 files in 5 000 folders take ~130 ms in a Debug build); while a new one is built the page keeps showing the old one, and cards resolve their songs by path when clicked. - **Tag editor** ("Etiketleri düzenle…" in the song menus of local files, dropped files and downloads, also for a multi-selection or a whole folder; `app/TagEditor` = menu entry + dialog + what follows a write, `audio/TagWriter` = the standalone core, `tags_test`). Fields: title, artist (several joined with "; "), album, album artist, track / disc number, year, genre, cover (a picked JPEG / PNG / WebP... goes through the playlist cover scaling: a centered square JPEG, at most 1000 px / 600 KB; "Kaldır" removes every embedded picture). In a multi-selection, fields whose values differ show "Farklı değerler" and stay as they are unless something is typed in; at most 2 000 files per edit. Reads and writes run on a worker, one file after the other. - **Writable**: MP3 (ID3v2: v2.3 stays v2.3, v2.4 stays v2.4, v2.2 becomes v2.3; every other frame - USLT, SYLT, TXXX ReplayGain, POPM, PRIV, COMM... - is copied byte for byte, a tag-wide unsynchronisation is undone, the extended header dropped; text is Latin-1 when ASCII, else UTF-16 with a BOM; a grown tag gets 2 KB of padding, a shrunk one keeps its size; an ID3v1 tag at the end is updated too, Latin-1 best fit), FLAC (the VORBIS_COMMENT block, other comments and the vendor kept; PICTURE blocks; the padding absorbs the change when it fits so the frames stay put, else the metadata is rewritten with 4 KB of padding; a full DATE gets a YEAR next to it, since Windows' FLAC handler reads only a bare year) and MP4 / M4A (AAC, ALAC: `moov/udta/meta/ilst`, created when missing; other items such as freeform `----` ReplayGain or `©lyr` kept; when moov changes size, a `free` box right behind it absorbs the change, a shrink leaves a `free` box, else `stco` / `co64` entries behind moov move along, and so do the `tfhd` base offsets / `tfra` entries of fragmented files). WAV, WMA, ADTS AAC and Ogg / Opus are not writable: their menu entry is disabled with a tooltip (`MenuItem::tooltip`). - **Safety**: the new file is written next to the original (`~..shadetube.tmp`, hidden), flushed, read back and checked - the edited fields, every frame / block / item that wasn't edited (byte for byte), a SHA-256 of the audio payload (MP3: between the tags; FLAC: the frames; MP4: every mdat) and, for MP4, the first bytes at a sample of chunk offsets - and the original must still have the size and mtime it had when it was read. Only then `ReplaceFileW` swaps it in, with a backup name, so even a failed swap never leaves the original missing (on `ERROR_UNABLE_TO_MOVE_REPLACEMENT_2` the backup is moved back); the backup is then deleted and the original's attributes restored. Any failure deletes the temporary file and leaves the original untouched; the toast says why (read-only file or folder, open in another program without delete sharing, damaged tags, changed meanwhile...). The playing file needs no special case: the engine opens local files with `FILE_SHARE_DELETE` and memory-maps them, and `ReplaceFileW` keeps that mapping on the old data, so playback goes on undisturbed. - **After a write**: the file is re-read with `local::refreshEntry` (exactly what a scan stores: tags through the property system, size, mtime, the cover extracted again into `cache\local-covers` under its new hash, folder art otherwise), `LocalLibrary::updateEntries` puts it in place without a rescan (re-sorted, `local-library.json` saved on a worker), and `Player::updateTrackInfo` / `Library::updateTrackInfo` update the queue, Now Playing, liked songs, local playlists and the history. The next incremental rescan sees the new size and mtime in the index and keeps the entry; a scan that was running during the write is followed by another one. A dropped file's remembered entry is updated too; a download keeps its catalog (Spotify / MusicBrainz) metadata in the app - only its file changes. - **Listening stats** (`app/ListenStats`, `listening.json`): a play accumulates real playback time from position deltas, never more than the wall clock (pauses and seeks do not count). A play is a *stream* at ≥ 30 s, or ≥ 50 % for tracks shorter than 60 s. Aggregates for 7 days / 30 days / all time; the same song from two sources is merged. Writes go to a flushed `.tmp` with the previous file kept as `.old`. The newest 100 000 plays of this PC are kept. Radio stations and podcast episodes (`podcast:` ids) are not recorded. - **Year summary and heatmap**: `summarizeYear()` (minutes, streams, top 5s, months, weekdays, longest streak, artists new that year, the first stream) and `heatmap()` (listening per local hour × weekday, a play split across the hours it spans) work on the local wall clock: `LocalClock` converts through Windows' *dynamic* time zone, so every year uses the DST rules in force then (offsets cached per day). Aggregation runs on the UI thread: summary + year + heatmap take about 7 ms for 300 000 plays in Release (`stats_test` prints the timings). - **Spotify history import** (`app/HistoryImport`, Stats › *İçe aktar*): reads the extended streaming history (`Streaming_History_Audio_*.json`, older `endsong_*.json`) and the account-data history (`StreamingHistory_music_*.json`, older `StreamingHistory.json`), as JSON files or straight from Spotify's ZIP (stored / deflate via the Updater's inflate; no ZIP64). Podcast, audiobook and video rows are skipped; songs without a URI get an `import:` id. `ListenStats::buildImport()` (worker) dedupes the rows against everything known: the same song whose interval overlaps a known play by ≥ 50 % of the shorter one, or that ended within 60 s of it with the same length (the account data has minute precision), is the same play, so re-importing or importing both formats adds nothing and plays heard in ShadeTube are not doubled. Imported plays live in `listening-imported.json` (flat, delta-coded, about 12 bytes a play; at most 2 million), written only by an import, *İçe aktarılanları kaldır* or a clear; the regular 30 s saves never touch it. Plays stored while an import runs are carried over. In memory all histories share one index and one time-ordered play list (imported plays flagged, with their source). Last.fm and ListenBrainz scrobbles come the same way into their own files: 3.55. - **Artwork for names without covers** (imported songs, plain-text credits): the top entries on screen are looked up once through the catalog search (Spotify while logged in, else MusicBrainz, one request at a time) and remembered in `cache\stats-artwork.json` (misses for 30 days). ### 3.9 Backup audio source (Piped / Invidious, SoundCloud) Every YouTube stream URL `MatchService` picks is tried first (1 KB from the middle with googlevideo's `range=`). YouTube now and then refuses a session's URLs (HTTP 403, every song of a run, seen 2026-10-06): a refused URL starts a new YouTube session (`YoutubeClient::resetSession`: fresh visitor data and cookies) and resolves once more, at most every 20 s; so does a fresh URL that failed in the engine. Only then the backup sources are asked. `youtube/AltSource` is used by `MatchService` only when the user enabled it (`Settings.altSource` = `piped` or `invidious`, off by default: the servers see what is played) and the YoutubeExplode path failed. The chosen kind is asked first, then the other: the user's own instance, then the built-in Piped and Invidious instances by health (worked lately > never tried > failed). Health is kept per operation in `cacheltsource-health.json`: two failures in a row leave an instance out for 10 minutes, doubling up to 12 hours, after which it is tried again. Requests use a hard per-request deadline, a 25 s budget per walk and capped bodies. A stream URL must be https on the instance's own (or declared proxy) host or on googlevideo.com, and is returned only after a 16-byte Range probe proved it answers `206` with the expected container; when it fails, the same stream through the other route (proxy <-> googlevideo) is probed. Backup-source stream URLs are cached for 1 h. `youtube/SoundCloud` is the last resort (`Settings.altSoundCloud`, with the backup source on; `resolveForPlayback` only, not downloads): the public web client's `client_id` (scraped from soundcloud.com's scripts), a track search, and only full-length uploads (`policy` ALLOW, a progressive MP3, duration within 3 s, TrackMatcher score >= 70, no other songs named in the title) qualify. A SoundCloud stand-in plays for this time only (empty `Match::videoId`). ### 3.10 Other integrations - **SMTC** (`app/Smtc`, C++/WinRT): media flyout, lock screen, media keys (`RegisterHotKey` only if SMTC fails). - **Scrobbling** (`app/Scrobbler`): Last.fm (user's own API key + secret) and ListenBrainz (user token); rule: track longer than 30 s and min(50 %, 4 min) really listened. Credentials DPAPI-encrypted in `scrobble.dat`. - **Discord Rich Presence** (`app/DiscordRpc`): local IPC pipe, own thread, silent without Discord; off by default. - **Single instance**: a second launch posts `ShadeTube.Activate`; the running app restores itself (or its mini player). A second launch with `--open-link ` (a clicked `shadetube:` invite) hands the link over as `WM_COPYDATA` (3.24). - **Pasted links** (`app/Links` parser, standalone; `app/LinkOpener`): the search box and Ctrl+V outside a text field recognize `open.spotify.com` URLs / `spotify:` URIs (track, album, playlist, artist; `intl-xx`, `embed`, legacy user playlists), YouTube / YouTube Music videos (`watch?v=`, `youtu.be`, `shorts`, `embed`, `live`) and `musicbrainz.org` release groups, releases, artists and recordings. While the text is a link the search page shows a hint row instead of searching; Enter or a click opens it. Albums, playlists and artists navigate; a Spotify track (`Api::track`: the spclient `metadata/4` JSON, base62 id -> hex gid) or a MusicBrainz recording (`mb::recording`) plays in its album from that song and shows the album; a YouTube video becomes a `yt:` track titled from the video (`links::videoSong`: "Artist - Title (Official Video)" -> artist / title) whose video is pinned in `MatchService`, so it never re-matches. Deezer, Apple Music and TIDAL playlists, albums and songs (and Deezer's short links) are imported / opened / played through their match in the catalog (3.60). A `shadetube://jam/` invite joins a listen-together session (3.24; never logged). Spotify shows open in Podcastler and Spotify users their profile page (3.54 Search kinds). Spotify links need a session (logged out: the connect screen); links of those services to anything else (episodes, YouTube channels, `spotify.link` short links) only toast; other text is searched. - **Windows shell** (`app/WinShell`): the process gets the AppUserModelID before any window exists (the Start menu shortcut carries the same id, so the media flyout names the app), `HKCU\Software\Classes\AppUserModelId\` names its notifications, the taskbar button has Previous / Play-Pause / Next thumbnail buttons (glyphs rendered from `assets/icons` for the Windows light / dark mode) and the jump list has the same tasks plus the mini player. A task runs `ShadeTube.exe --command `, which a running instance receives as the registered `ShadeTube.Command` message. Sandbox profiles leave the machine-wide parts alone unless `SHADETUBE_AUMID` names a test id. - **Taskbar progress** (`app/WinShell`, `ThumbBar::setProgress`): the playing song's position on the taskbar button: normal while playing, paused (yellow) with a position, indeterminate while the first audio is on its way, error (red) for 4 s after a playback error, none for idle, radio stations and when `Settings.taskbarProgress` is off. `winshell::progressFor()` is the pure mapping (tested); `App::syncThumbBar()` feeds it on every player change and from the 1 s tick, unchanged values cost no taskbar call, and it is re-applied when the taskbar button is recreated. ### 3.10.1 Keyboard shortcuts, command palette and startup - **Shortcut registry** (`app/Shortcuts`, standalone): the action table (stable ids stored in settings, a category, a default combo, flags: `kGlobal` may also get a system-wide key, `kGlobalOnly`, `kMini` works in the mini player, `kInText` also while a text field has focus, `kRepeat` a held key repeats it), combos in a layout-independent text form (`"Ctrl+Shift+Right"`, `"Ctrl+Comma"`, `"Oem4"`) and the bindings: `Settings::shortcuts` maps an id to a combo (missing = default, `""` = unbound) and `"global:"` to a global one (no defaults). One combo triggers one action per scope; `assign()` takes it from the previous owner, `normalize()` cleans a hand-edited file at startup. `fallback()`: a press nothing is bound to also counts as another combo, so the zoom keys work on every layout: the numeric keypad's + / - / 0 as Plus / Minus / 0, and the key that types "+" / "=", "-" or "0" on the current layout as Plus, Minus or 0 without Shift (Turkish Q has no Plus key: Ctrl+Shift+4 types "+"; US: Ctrl+Shift+=). - **Dispatch** (`app/Commands`): `App::handleKey` keeps only Esc (leave Now Playing) and the browser keys hard-coded; every other key the widgets did not take goes through `commands::dispatchKey` (the mini player's keys too, `kMini` actions only). Handlers are built in (player, router, ctx hooks such as `toggleLyricsFullscreen` / `lyricsOffsetBy`, which are skipped while unset); App adds the ones that need its windows (`now-playing`, `mini-player`, `show-window`). **Global hotkeys** are `RegisterHotKey` on the main window (ids `0x200 + index`; SMTC keeps the media keys) and re-registered after every change; a combo another app holds is reported in *Settings › Keyboard*. - **Settings › Keyboard** (`app/SystemSettings.cpp`): one row per action with a recorder (click / Enter, then the key chord; Esc cancels, Backspace unbinds; reserved keys, Win combos in-app and plain keys as global hotkeys are refused with a reason), reset per row and for all. - **Command palette** (`app/CommandPalette`, Ctrl+K): commands (shortcut actions with their keys, the settings cards through `Route{Settings, }`, see 3.26), themes, a few app commands), the library snapshot and, 300 ms after the last keystroke, `source::search` on a worker. `shortcuts::fuzzyScore` ranks (exact > prefix > word start > substring > subsequence; `foldForSearch` makes it accent / case / I-ı insensitive); recent picks are kept in `palette-recent.json`. - **Start with Windows** (`app/Autostart`, standalone): the HKCU `Run` value `ShadeTube` = `"" --autostart`, pointed at the installed copy when there is one. `commands::initSystemFeatures()` re-syncs it at every start (moved portable copy, new install), the uninstaller removes it, and turning the option on clears Windows' own *Startup apps* switch (`Explorer\StartupApproved\Run`) when it had been turned off there. `--autostart` with *Start in the tray* never shows the main window (the tray icon arrives with the taskbar; after 30 s without one the window is shown minimized); a second `--autostart` launch exits silently. Sandbox profiles never touch the real value unless `SHADETUBE_RUN_KEY` names a test key. ### 3.11 Installer and updater - **Installer** (`app/Installer`, in `st_install` with the updater and `app/Autostart`): the per-user install the setup (3.57) runs: the exe in `%LOCALAPPDATA%\Programs\ShadeTube` (or another folder), a Start menu shortcut, optionally one on the desktop, and `HKCU\…\Uninstall\ShadeTube` (no admin rights). The app no longer installs itself: *Settings › About* shows the installed copy (and *Uygulamayı kaldır*) only when there is one, a portable copy offers nothing. Windows' *Installed apps* runs `ShadeTube.exe --uninstall` (the quiet uninstall string adds `--quiet`); files still in use are deleted by a detached helper once the process has exited. The installed copy refreshes its `DisplayVersion` / `EstimatedSize` at every start (after an in-app update). - **Updater** (`app/Updater`, UI in `AboutSettings.cpp`): at most once a day, ~20 s after startup, it queries `api.github.com/repos/shadesofdeath/ShadeTube/releases/latest`. *Download and install* downloads the asset (`ShadeTube--win64.zip`, else any ShadeTube zip or exe, never the setup: a name with `setup` / `installer`; an installed and a portable copy both update from the zip) in ranged chunks, checks its SHA-256 against GitHub's asset digest and any `sha256: ` line in the release notes, extracts `ShadeTube.exe` with a built-in ZIP reader, verifies it (PE x64 GUI, `ProductName` "ShadeTube", `ProductVersion` == the release tag's version) and swaps it in (the old exe is parked as `ShadeTube.old.exe`, rolled back on failure). Leftovers are recorded in `update-leftovers.txt` before they exist and removed on the next start. The app restarts with the queue kept. ### 3.12 Crash reports `core/CrashHandler` (installed first thing in `wWinMain`) writes a minidump for unhandled SEH exceptions, `std::terminate`, pure virtual calls and invalid CRT parameters from a thread created up front (so stack overflows are reported too). Dumps go to `crashes\ShadeTube--.dmp`, the newest 5 are kept, nothing is uploaded. The next launch shows a one-time notice; *Settings › Library and storage* opens the folder. Before the dump (Linux: the text report) the **log's waiting lines** are written: `core/Log` collects DBG / INF lines in a fixed 16 KB buffer and writes them together (at a WRN / ERR line, when the buffer is full, at the first line a second after the oldest waiting one, at exit), and `log::crashFlush()` writes what is still waiting without a lock or an allocation (Linux: `write(2)` from that buffer, async-signal-safe), so the lead-up of a crash is in `shadetube.log`. ### 3.13 Localization (i18n) - `core/I18n`: the **Turkish source text is the key**. `tr(L"Ayarlar")` returns the text from `assets/i18n/.json` for the UI language, or the key itself (Turkish has no file; missing texts are logged once). Languages: tr, en, de, es, fr, pt (Brazil), ru, uk, id, ja, ko. - The language is fixed per process (`Settings.language`; empty = Windows' display language if supported, else English); a change applies after a restart (the *Restart* button relaunches with `--restart-after `). - Values go through `{}` placeholders, never concatenation: `i18n::format(tr(L"{} şarkı"), {count})`. Counts use `plural(L"{} şarkı", n)`, whose translation may be an object of CLDR forms: `one`/`other` (en, de, es, fr, pt), `one`/`few`/`many` (ru, uk), only `other` (id, ja, ko); every form keeps the key's number of `{}`. - Dates, digit grouping (`monthAbbrev()`, `number()`) and `toUpperTr` casing follow the UI locale via Windows. - `tools/i18n_check.py`: ```bat python tools\i18n_check.py :: keys in use + Turkish literals not wrapped in tr()/plural() python tools\i18n_check.py --lang de :: one language: missing / unused keys, placeholders, plural forms python tools\i18n_check.py --all --strict :: every language; exit code 1 on any problem python tools\i18n_check.py --dump assets\i18n\_keys.json :: every key with its call sites (for translators) ``` - **Testing a translation without rebuilding**: set `SHADETUBE_I18N_DIR` to a folder with `.json`; it is read instead of the embedded copy (the log says so). - Adding a language: `kLanguages` and the plural `category()` in `I18n.cpp`, `LANGS` and `PLURAL_FORMS` in `i18n_check.py`, plus the new JSON file. ### 3.14 User data Everything lives under `%LOCALAPPDATA%\ShadeTube` (or `SHADETUBE_DATA_DIR`): `settings.json`, `accounts.json` and `accounts\\` (one folder per Spotify account, 3.48: `spotify.dat` (DPAPI), its login's `webview2\`, and its `listening.json`, `listening-imported.json`, `listening-lastfm.json`, `listening-listenbrainz.json` (3.55), `blacklist.json`, `new-releases.json`, `smart-lists.json`, `library-recents.json`, `rule-lists.json`, `rule-sources.json` + `rule-sources\` (3.64), `home-layout.json` (3.69) and `snoozed.json` (3.71), which sit in the root itself while there is no account), `bpm.json` (the songs' tempo, per PC, 3.65), `scrobble.dat` and `remote.dat` (DPAPI), `library.json`, `session.json`, `downloads.json`, `sync.json`, `local-library.json`, `dropped-files.json`, `podcasts.json`, `radio.json`, `recent-searches.json`, `palette-recent.json`, `lyrics-offsets.json` (timing offsets and lyrics picks; `lyrics\` holds picked .lrc / .txt copies, 3.46), `jam.json` (listen together: the device id, a guest's saved playback settings), `jam-own-session.json` (a guest's own queue), `jam-host.dat` / `jam-guest.dat` (a session to resume, DPAPI, 3.51), `blends.dat` (DPAPI, 3.50), `recognized.json` (recognized songs and the listening source, 3.59), `spotify-hashes.json`, `update-leftovers.txt`, `playlist-covers\` (local playlists' own pictures), `themes\` (custom color themes, 3.35 Theme studio), `shell\` (the notification icon, the song notification's cover `now-playing-{0,1}.png`, 3.49), `cache\` (images, `matches.json`, lyrics, credits, `mb`, `ytmusic`, `local-covers`, `dropped-covers`, `podcasts`, `stats-artwork.json`, `officialvideos.json`, `audio` = the song cache, 3.45), `logs\shadetube.log` and `crashes\`. Downloads go to `Music\ShadeTube` by default (podcast episodes to its `Podcasts` folder). **Saving, power cuts and damaged files** (`core/SafeFile`). Every file above that holds the user's data is written the same way: a `.tmp` next to it, flushed to the disk (`FlushFileBuffers`, the close checked), the current file renamed to `.old`, then the `.tmp` renamed in (`MoveFileEx` `REPLACE_EXISTING | WRITE_THROUGH`, retried briefly when a scanner holds the file); a failed step leaves the current file in place. Saves taken on the UI thread and written on a worker carry a ticket (`safefile::ticket()`), so an older save never lands after a newer one (the exit's, an account switch's). `library.json`, saved after every song start, is copied on the UI thread and serialized and written on a worker (10 000 liked songs in a Debug build: the copy 33 ms; serializing 876 ms and the flushed write 8 ms, which 0.12 did on the UI thread); `downloads.json` is serialized on the UI thread and written on a worker. Reading (`safefile::read` / `readJson`): a file that does not parse (cut short, zero-filled, not JSON, the wrong shape) is moved aside as `.corrupt` (`.corrupt-2`, ...) and **never saved over**; `.old` loads instead. A missing file falls back to a complete `.tmp` (a power cut between the two renames), then `.old`. A copy loaded from `.tmp` / `.old` is written back as the file at once (the `.old` stays). A file that cannot be opened at all (another program holds it) is left alone for the session: saves to it are refused. The user is told once, in one toast at the next housekeeping tick (`App::reportDamagedFiles`): "Bozuk bir kayıt dosyası bulundu (…); son sağlam kopyası yüklendi." or, with no earlier copy, "Bir kayıt dosyası okunamadı (…). Bozuk dosya silinmedi, yanında saklandı.". Credentials and room keys (`spotify.dat`, `scrobble.dat`, `remote.dat`, `jam-*.dat`), lyrics files and caches are written without an `.old` copy. `listening*.json` keep their own reader (a broken file is kept as `.bak`, 3.8) and write through the same writer; `blacklist.json` still keeps a readable file with damaged entries as `.bad` before saving what could be read. ### 3.15 Drag and drop `app/DragDrop` (UI thread): - **Inside the app**: a `TrackTable` row pressed and moved past 6 DIPs becomes a drag of that row, or of the whole selection when the row is part of it (a plain click on a selected row narrows the selection on release instead). A non-hit-testable overlay ghost (count + first title) follows the pointer; the widget under it is asked through `DropTarget` (`dragOver` / `dragLeave` / `drop`, window DIPs). Targets: the **sidebar** (Liked Songs → `Library::likeAll`; an editable Spotify playlist or a local playlist → `addToPlaylistWithToast`; a closed folder opens after 700 ms under the pointer; the list scrolls near its edges), the **queue panel** (an insertion line; `Player::insertAt`) and the **table itself** when it is a playlist the user may edit, in custom order, unfiltered and without "Geliştir" recommendations: its own rows move in front of the row under the insertion line (the page scrolls near its edges). The page reorders at once (`app/PlaylistEditing::moveOrder`); a local list stores the new order, a Spotify list writes `moveItemsInPlaylist` (uids + a position before / after a row that stays, one move at a time) and puts the rows back with a toast when that fails. Escape, the source table going away or a release the table never saw cancel it. - **From Explorer**: an OLE `IDropTarget` on the main window (`OleInitialize` + `RegisterDragDrop`, revoked on `WM_DESTROY`) takes `CF_HDROP` lists with at least one audio file or folder. Dropped on the queue panel they are queued at that point, anywhere else they play at once (context "Bırakılan dosyalar"). `app/DroppedFiles::collect()` reads them on a worker: folders through `local::scan` (same walk rules, tags and covers), loose files through `local::readFile`, at most 2 000 per drop, sorted like the library. Their ids are the local library's (`local:`); `dropped-files.json` (the local index format, newest 5 000) and a player resolver asked before the local library's keep them playable after a restart (restored queue, history). A single dropped folder the library doesn't cover yet gets an "add to Yerel dosyalar" toast action. A drop that includes a playlist file (M3U, CSV, XSPF, JSON) imports it instead, wherever it lands (the ghost says "Listeyi içe aktar"; 3.19). ### 3.16 Lyrics - **Sources** (`lyrics::fetch`, worker thread; the query comes from `app/LyricsService` `lyricsQueryFor`): for an item that plays from disk (a local file or a download) its own synced lyrics win — a sidecar `.lrc` (UTF-8 / UTF-16 / ANSI), else the file's tags (MP3: ID3v2.3 / 2.4 `SYLT`, then `USLT`, which may hold LRC, read by our own parser; other formats: `System.Music.Lyrics`). Then LRCLIB, then — for a `spotify:track:` while logged in — Spotify's lyrics service (`spclient /color-lyrics/v2/track/`, `Api::trackLyrics`) when LRCLIB has nothing or only unsynced lyrics. An unsynced local text beats an unsynced online one. Spotify answering 429 / 403 pauses that provider for 10 / 30 minutes. The user's own pick ("Yanlış sözler mi?", `Query::choice`) comes before all of this (3.46). The online part is a list of sources in the user's order, word-by-word ones among them (Better Lyrics, Apple Music, KuGou, NetEase; 3.81). - **Cache** (`cache\lyrics\.json`): the online answer plus the providers already asked (`tried`); a definitive "none" is kept 7 days, a transient failure is never cached, and a provider that wasn't asked yet (the user logged in later) still is. Enhanced-LRC word times are kept (`words`). - **Timeline**: lyrics are timed to the song. A matched music video's SponsorBlock segments (intro skits, sponsor spots) are not in it, so the lyrics' clock is the player position minus the skipped segments before it (`lyrics::songTime`, provided by `App` through `setLyricsExtraProvider`); a click on a line seeks back through `lyrics::mediaTime`. Then the per-track offset applies (`lyrics-offsets.json`, + = later, ±30 s, 250 ms steps: `ctx().lyricsOffsetBy`, the −/+ buttons of Now Playing and the full-screen view, − / + keys there). - **Full-screen lyrics** (`app/LyricsFullscreen`, `ctx().toggleLyricsFullscreen`): a modal overlay over the whole window (its top strip is a caption area: the window still moves) on Now Playing's drifting cover backdrop (3.40). The active line fills with the accent as it is sung, behind a soft edge (3.62): per word with word times, else across the line until the next one (capped by the line's length). Controls fade after 2.5 s without mouse movement; everything it holds goes with it when it closes. Not offered for live radio. ### 3.17 Podcasts `app/Podcasts` (standalone: directory client, RSS parsing, episode model, downloads, store; `podcasts_test`) and `app/PodcastsPage.cpp` (the Podcastler pages and the wiring). Open sources only: Spotify's own podcasts (the shows the user follows there, search results) are resolved to their public feeds (3.54), never played from Spotify: - **Directory**: Apple's `itunes.apple.com/search` (media=podcast) and `/lookup` (a show's feed URL); the top shows of the Windows home location from `rss.applemarketingtools.com` (the legacy `itunes.apple.com//rss/toppodcasts` as a fallback). Answers are cached in memory for 10 minutes. - **Feeds**: RSS 2.0 + the iTunes namespace through a small XML reader (CDATA, entities, BOMs, UTF-16 and Windows-1252 documents, namespace prefixes renamed to the usual ones); show notes become text; at most 3000 episodes, newest first. Parsed feeds are kept in `cache\podcasts\.json` and fetched again after 30 minutes (show page) or 3 hours (subscriptions: refreshed in the background one at a time, checked every 10 minutes from a minute after startup). A feed that fails falls back to its cached copy. - **Episodes** are `catalog::Track`s with the id `podcast:<16 hex>` (FNV-1a of feed URL + guid; `catalog/TrackKind.h` `isPodcastId`). They skip YouTube matching, *Wrong match?*, SponsorBlock, lyrics (Now Playing's Hakkında tab shows the show notes; the first tab is the episode's transcript, *Döküm*, 3.67), scrobbling, the play history, listening stats, the song downloads, likes and radio / autoplay seeds. - **Playback**: `Player::directStreamFor` hands the player the enclosure URL; its `resolve` step (worker) follows the analytics redirects once with a two-byte range request, so the progressive buffer talks straight to the audio host and knows the length and type. The stream sends the podcast client's User-Agent, as downloads do (`DirectStream::userAgent` → `StreamSource::userAgent` → `ProgressiveBuffer::setUserAgent`, also for a cast device's feed): Buzzsprout's CDN answers 403 to the engine's browser-like default (episodes failed to stream before 0.13.0). `Player::startPositionFor` resumes an episode 3 s before where it was left. The position is recorded on every player change and housekeeping tick; an episode heard to 95 % or into its last 30 s is *played* (and starts from the beginning next time). - **Downloads**: one at a time in the background to `\Podcasts\\ .<ext>`, as published (no transcoding), through `<file>.part` with HTTP range resume. Downloaded episodes play from disk (a `localFileResolvers` entry); deleting one removes the file (and the show folder once empty). - **Store** (`podcasts.json`): subscriptions (newest episode date seen, the new-episode count behind the sidebar badge, whether it was added by URL), per-episode state (position, measured length, played, downloaded file) for at most 4000 episodes (downloads are never dropped) and the episodes of the playing queue, so a restored session resumes them. Saved at most every 30 s while playing and on exit. - **Network**: anything the directory or a feed supplies must be on the public internet; only a feed the user added by its RSS address (a self-hosted server) may be on the local network, and so may its audio. Redirects are followed by hand (`WINHTTP_DISABLE_REDIRECTS`, at most 10 hops) and every hop's host is resolved and checked, so a public URL can't redirect into the local network (`network_test`). Covers (`gfx/ImageCache`) and every other `http::getLimited` caller get the same per-hop check through `Limits::allowUrl` (usually `http::publicUrl`); there an https → http redirect is refused too. - **Podcasting 2.0 extras** (3.67): an item's `<podcast:chapters>` (JSON chapters) and up to 4 `<podcast:transcript>` links are kept on the `Episode` (`chaptersUrl`, `transcripts`) and in `podcasts.json`; the store's `shows` object holds per-show speech settings and the time silence trimming saved (at most 2000 shows). - **Routes** `Route{RouteKind::Podcasts, id}`: `""` (home), `search:<text>`, `feed:<url>`, `apple:<directory id>`, `new` (new episodes of the subscriptions), `downloads`, `spotify` (the Spotify import preview) and `spotify:show:<id>` (a Spotify show: its matched feed or why it can't play; 3.54). ### 3.18 Internet radio `app/InternetRadio` (standalone: radio-browser.info client, station model, `radio.json` store; `radio_test`) and `app/RadioPage.cpp` (the Radyo pages, the station widgets and the wiring); the audio side is `audio/LiveStream`, `audio/LiveParsers`, `audio/LiveDecoder` and `audio/HttpStream` (`liveaudio_test`). - **Directory**: radio-browser.info as its API docs ask: the server list from `all.api.radio-browser.info` (`json/servers`, else a DNS lookup, else a built-in list) shuffled once, a failing server skipped for a few minutes, a descriptive User-Agent and one `json/url/<uuid>` click per started station. Requests run on workers with deadlines, cancellation, capped bodies and a 10-minute cache. Routes `Route{RouteKind::Radio, id}`: `""`, `tag:<tag>`, `country:<CC>`, `top`, `votes`, `favorites`, `recent`, `genres`, `search:<name>`. - **Stations** play as `catalog::Track`s with the id `radio:<stationuuid>` through `Player::liveStreamFor`: no duration, no seeking, no prefetch or crossfade. Only codecs the engine plays are listed (MP3, AAC / HE-AAC, Ogg Opus, Ogg Vorbis, HLS). `radio.json` keeps favorites, recently played and the stations of the playing list, so a restored queue still resolves. - **Live streams** (`audio/LiveStream`, one thread per stream): playlists (`.pls` / `.m3u` / `.asx`, nested, redirects), ICY bodies with the interleaved metadata stripped (StreamTitle kept) or HLS (master and media playlists, MPEG-TS / packed audio / fMP4 segments, AES-128) are split into compressed frames in a bounded queue (60 s / 4 MB; full = TCP back-pressure). The engine starts after ~2 s of margin, reconnects with backoff (0.5 .. 8 s) and reports titles when the audio they start with becomes audible. Paused, only the newest 4 s are kept and the connection closes after a minute; resuming plays live again. Every request goes to public hosts only (tests may allow the local network). ### 3.19 Smart shuffle and "Geliştir" `app/SmartMix` (standalone planning; `smartshuffle_test`) and `app/SmartShuffle` (recommendations, the player hook, the menus and the settings row). Recommendations are ordinary `catalog::Track`s with `recommended` set; the player keeps the flag (session.json `"rec"`), the badges (`smartshuffle::drawBadge`) and menus read it. - **Placement** (`smartmix`): a recommendation comes after 3-4 of the collection's own songs (seeded, so the same seed places them the same way), never two in a row, never right after the playing song (that slot may be prepared for a gapless handoff / crossfade), only within the next `kWindow` (24) queue slots, and a stretch whose recommendations are already close enough gets nothing new, so planning again is a no-op. A recommendation is never a song of the collection (same id, or the same folded title + first artist: `trackKey` drops "(...)", "[...]" and " - ..." suffixes and folds any script and the Turkish I), never already queued, never blocked, always playable. - **Smart shuffle** (`Settings.smartShuffle` with shuffle on; the shuffle button cycles off → shuffle → smart shuffle, the `smart-shuffle` command toggles it): a `playerChangedHooks` entry posts one planning pass per event, which asks for the queue collection's recommendations and inserts them with `Player::insertAt` (from the last point, so the indices stay valid). Leaving smart shuffle calls `Player::dropRecommendations()`, which removes the upcoming ones from both the order and `items_` (a reshuffle doesn't bring them back). - **"Geliştir"** (`Settings.enhancedCollections`: "liked" or a playlist id): the collection page interleaves up to 30 recommendations into its own songs (`smartmix::interleave`); recommended rows are tinted, badged and get "+" (add to the list: Liked Songs, a local playlist or an editable Spotify playlist) and "×" (hide for this session) in place of the heart. Playing the list plays them in order. The track menus (table, queue, player bar) offer "Bu öneriyi listeye ekle" and "Önerileri gösterme"; anything else the menu does with a recommendation (queue, playlist, download, drag) makes it an ordinary song. - **Sources** (`recommend()`, a worker per collection, cached 30 minutes, at most 12 collections): Spotify's song radios of up to 3 of the collection's Spotify songs (logged in; a 429 pauses them for 10 minutes); below 20 candidates the popular recordings of ListenBrainz's similar artists for its 2 most frequent MusicBrainz artists; then local-library songs by its artists. ### 3.20 Smart lists `app/SmartLists` (standalone, pure: the rules; `smartlists_test`) and `app/SmartListsPage` (the app side: schedule, recommendations, cache, covers, the rows and the page). "Senin için listeler" are built on this PC from the listening history (`ListenStats`: this PC's plays and the imported Spotify history, streams only) and the liked songs: - **Lists**: *Günün karışımı 1–3* (a lead artist the user plays now + the artists heard with it in the same listening sessions of the last two years — pairs within a 30-minute session and 5 distinct artists, normalised by plays —, their familiar songs by a day-seeded weighted pick, at most 12 per artist, spread so one artist rarely plays twice in a row), *Bu ayın favorileri* (2+ streams in 30 days), *Yeni keşiflerin* (first heard in 30 days, streamed again), *Tekrar keşfet* (4+ streams, none in 90 days; a daily weighted pick), *Unutulan beğeniler* (liked, at most one stream and none in 60 days; daily order), *Tüm zamanların en iyileri* (every stream, half-life one year) and *<year> en iyileri* for the six newest years with 10+ songs. A list below its minimum is hidden. Podcast and radio ids never appear; songs are the history's distinct tracks (merged by name + first artist). - **Freshness**: orders that are not rankings are seeded with the local day, so a list is stable for the day. A build runs on a worker from a copy of the history on the first use of the day (Home / Library / the page / the Stats year view call `smart::ensure()`), after a login / logout, and when the history changed at most every 20 minutes; the blocklist is applied (and re-applied on change) on the UI thread. Build time: ~0.6 s for 300 000 plays in Debug. - **Fresh songs** in the mixes (one after every two familiar ones, up to 15): logged in, Spotify's radio of the mix's lead song (`radioPlaylist` + its first 50 tracks); logged out, ListenBrainz's similar artists of an MBID lead and their popular songs. Logged in, the liked songs are Spotify's newest 500 (5 pages). Both are fetched once a day (per lead) and kept, with the lists, in `smart-lists.json`, so a restart the same day shows them at once. - **UI**: a generated cover (up to four distinct covers of the list's songs above a band in the list's tile color with an accent rule, the kind in mono and a short name), the "Senin için listeler" row on Home and on the Library page's playlists tab (a self-updating section, hidden while there is none), the list page `Route{RouteKind::SmartList, id}` (`#play` appended starts it; play / shuffle / add to playlist / queue / "Çalma listesi olarak kaydet" through `promptNewPlaylist`, i.e. a Spotify playlist when logged in), command palette entries and a "Listenin tamamı" link on the Stats year view. Songs without covers (imported history) take them from the Stats page's artwork cache (`enrichTrackArtwork`, defined in `StatsPage.cpp`). ### 3.21 Playlist import and export `app/PlaylistIO` (standalone: the four formats, CSV dialects, text decoding; `collections_test`) and `app/PlaylistTransfer` (the flows, dialogs and lookups; UI thread with workers). - **Export** ("Dışa aktar…" in a collection header's menu, the sidebar and Library card menus, "Sırayı dışa aktar…" in the queue): Liked Songs (Spotify's or the local ones), Spotify and local playlists, albums (Spotify or MusicBrainz) and the queue. Spotify lists are paged on a worker 250 ms apart; stations and podcast episodes are left out. Each song gets its file when there is one (a download, a local or dropped file) and its matched YouTube video when the match cache knows it. An `IFileSaveDialog` (Music folder, the list's name, the last format used) picks the file and the format: **M3U8** (players such as VLC / foobar2000; a location per song: the file, else a Spotify / MusicBrainz / YouTube URL, else a YouTube Music search URL), **CSV** (UTF-8 BOM, CRLF, one column per field; cells starting with `= + - @` get a `'` so spreadsheets don't run them), **XSPF**, or **ShadeTube JSON** (`"shadetube.playlist"` v1, every field, round-trips exactly). A toast offers "Dosyayı göster". - **Import** ("İçe aktar" in the Library header, the sidebar "+" menu, the palette's "Çalma listesi içe aktar", a pasted YouTube playlist link, a playlist file dropped on the window): files in those four formats plus the CSV of Exportify, TuneMyMusic and Soundiiz (header mapped by name, delimiter and encoding detected; a headerless file is read as "Artist - Title" lines), and YouTube / YouTube Music playlists (`links::Kind::YouTubePlaylist`; the videos through YoutubeExplode, at most 5 000). Every row becomes a song with the best id it names (Spotify, MusicBrainz, `yt:<video>` with that video pinned as its source, a local file read through the local library's tag reader and remembered like a dropped file, else `import:<hash>` matched by name like the history import); songs named only by an id get their title from Spotify / YouTube / MusicBrainz (at most 300 lookups); Deezer, Apple Music and TIDAL lists are read and their songs matched in the active catalog first (3.60). A preview names the playlist and counts the songs, local files, videos and the rows that name no song (the first 6 with their line numbers); "İçe aktar" creates a **local** playlist and opens it. Logged in, "Spotify'da da oluştur" also creates a Spotify playlist with the songs that have Spotify ids (100 per request). Reading and resolving run on a worker (`collections_test` times 10 000 songs per format: about 0.25 - 1.2 s written and read back in a Debug build). ### 3.22 Library views, sort and filter `app/LibrarySort` (standalone, pure: sort keys, folders, filter, the "played" record; `library_test`) and `app/LibraryView` (the grid / list widget, the player hook); the page is `LibraryPage` in `BrowsePages.cpp`. - **Views**: *Izgara* (the MediaCard look) or *Liste* (64 DIP rows, 48 DIP covers, "Çalma listesi · owner · n şarkı" / "Albüm · artist · year" / "Sanatçı", a right-hand date for the time sorts, pin and "downloaded" marks, the playing collection in the accent). Both are painted from the page's cells by one widget, so 10 000 items cost no widgets; hover / focus show the play button, a click opens, the play button plays (or pauses what plays), the menus are the cards', and a playlist row takes dragged songs like the sidebar (`dragdrop::tracksForRow` / `dropOnRow`). One Tab stop: arrows (two-dimensional in the grid), PageUp / PageDown, Home / End, Enter opens, Shift+Enter plays, menu key. Per tab in `Settings.libraryView` / `librarySort` (`playlists` / `albums` / `artists`). - **Sorts** (pinned items always first): *Son çalınanlar* — the latest of "played here" (`library-recents.json`: the player context `playlist:<id>` / `album:<id>` / `artist:<id>` / `liked` when one of its songs starts; for albums and artists also their newest stream in `ListenStats`, imported Spotify history included), Spotify's `playedAt` and the added time; local playlists also count the last song added. A Spotify snapshot without `playedAt` counts only the plays here (an added date says nothing about plays on other devices). *Son eklenenler* — libraryV3 `addedAt`, a local playlist's creation. *Alfabetik* — the UI locale's collation (Windows NLS, case-insensitive, digits as numbers). *Oluşturan* (playlists: owner) / *Sanatçı* (albums: first artist, then release date). Missing values sort after the known ones in source order (libraryV3's order logged in, the stored order of local lists: newest first), so local albums / artists under *Son eklenenler* keep their saved order. Ties keep the source order. *Geçmiş* keeps its natural order (newest first) and only filters. The page freezes the "played" data when it is built, so what plays meanwhile doesn't move rows under the pointer. - **Folders**: under the time sorts a folder sits where its first playlist in that order would be (empty folders last); under *Alfabetik* / *Oluşturan* folders come first, alphabetically. - **Filter** ("Kitaplıkta ara"): everything under the shown folder (folders too), ranked by `shortcuts::fuzzyScore` (accent / case / I-ı insensitive; one or two letters only at word starts; a creator match counts less), ties in the sort's order. Ctrl+F stays the global "Ara" shortcut. Timing (`library_test`, 10 000 items, Debug): model 3 ms, time sorts 3 ms, alphabetical 31 ms (collation keys made once), a filter 20–70 ms. ### 3.23 Phone remote control *Ayarlar › Telefondan kumanda* (`Settings.remoteEnabled`, off by default; `remotePort`, `remoteAddress`): the phone's browser controls the app over the LAN, nothing to install. `app/RemoteControl.cpp` is the app side (settings section, QR code, commands, state); the server parts are standalone and tested (`remote_test`): `RemoteHttp` (HTTP/1.1 parser, responses, SSE framing), `RemoteAuth` (pairing secret, device tokens, throttle), `RemoteApi` (routes), `RemoteState` (JSON), `RemoteServer` (sockets, adapter addresses). - **Server** (`st-remote` thread, started / stopped by the toggle, stopped at exit by a `persistHooks` entry): Winsock IPv4 on all interfaces (`SHADETUBE_REMOTE_BIND` narrows it), `SO_EXCLUSIVEADDRUSE`, the configured port (default 48484) or the next free one of 10; non-blocking sockets + `WSAPoll`, woken by a datagram to its own UDP socket on 127.0.0.1. HTTP/1.1 keep-alive and pipelining (one request at a time per connection), at most 32 connections and 8 event streams; request line + headers ≤ 8 KB / 48 headers, target ≤ 2 KB, bodies ≤ 16 KB with Content-Length only (chunked: 501), malformed input or a TLS hello: 400 at once; a request that doesn't arrive whole within 10 s: 408, idle connections close after 30 s, an API answer the app doesn't give within 25 s: 504, a stream that stops reading (512 KB backlog) is dropped. The Host header must be an IPv4 literal or `localhost` (DNS rebinding). The first `listen` on all interfaces makes Windows Firewall ask (the section says to allow private networks). - **Pairing**: `remote.dat` (DPAPI) holds a 128-bit pairing secret and the devices. The QR code (`external/qrcodegen`, ECC M, drawn dark on white in both themes with a 4-module quiet zone, every module a whole number of device pixels on pixel edges) encodes `http://<LAN IPv4>:<port>/#p=<secret>`; the fragment never reaches the server or a Referer. The page posts it once to `/api/pair` and gets its own 256-bit device token (kept in `localStorage`); only the token's SHA-256 is stored, compared in constant time against every device. The secret can also be typed on the page. "Yeni bağlantı kodu" rotates the secret (paired phones stay); "Bağlantıyı kes" revokes one device and drops its streams; a phone can forget itself (`/api/unpair`). Names come from the User-Agent ("iPhone · Safari"); at most 16 devices; last-seen times are saved every 5 minutes. A new pairing toasts (important: a tray notification when hidden). Bad tokens and bad secrets are counted per address: 8 within a minute block it for 30 s, doubling up to 15 minutes (429 + Retry-After). - **Address**: `RemoteServer::lanAddresses()` lists up IPv4 adapters (no loopback / 169.254.x) and ranks them: Wi-Fi and Ethernet with a default gateway first, virtual ones (Hyper-V, WSL, VMware, VirtualBox, VPNs, Tailscale…) last; with several the section offers a picker (`remoteAddress`, "" = automatic). - **Page** (`assets/remote/`, served from the embedded resources by a fixed table: `/`, `/app.js`, `/app.css`, `/fonts/*.ttf`, `/icons/<name>.svg` from `icons/24`, `/logo.svg`; strict CSP, ETags): `/theme.css` turns `tokens.dark.json` / `tokens.light.json` into CSS variables (colors, radii, shadows, motion) with `prefers-color-scheme`, the app's fonts and icons (as CSS masks) are the app's own, and every text comes from `/api/i18n` (`tr()` on the UI thread). Tabs: Now playing (cover, title, artist / album links, seek, lyrics line, shuffle / previous / play / next / repeat, like, volume), Queue (tap to play, remove), Search (`source::search` + the library's playlists matched with `shortcuts::fuzzyScore`; songs / albums / playlists / artists), Library; albums, playlists (Spotify pages: up to 300 songs) and artists open over the tab (`#album=<id>`… in the address, so back and reload work). A song's menu: play, play next, add to queue, go to album / artist. - **Live state**: Server-Sent Events read with `fetch` (the token stays in a header): `state` (track, status, position, shuffle / repeat, like, volume, the app's accent as both themes show it), `queue` (the playing slot and the next 100 with their play-order indices) on every `playerChangedHooks` event (coalesced per UI turn, unchanged queues not resent), and `pos` once a second only while a stream is open (the server's tick, posted to the UI thread; it also catches changes without a player event: the volume knob, the accent fade, likes made elsewhere). `pos` carries the synced lyrics line at `lyricsClockMs()` (fetched once per track while a phone is looking). New streams start with the newest `state` / `queue`; the page extrapolates the position between ticks, reconnects with a backoff, closes the stream while hidden and polls `/api/state` where streaming bodies are missing. - **Commands** (`POST /api/cmd`, JSON, posted to the UI thread) take the app's own paths: `commands::run` for play / pause, next, previous and like; `smartshuffle::cycleMode` and `Player::cycleRepeat` like the player bar; `seek`, `volume` (+ `onChanged` like the volume shortcuts); `jump` / `remove` like the queue panel, refused with 409 when the slot no longer holds the named song; `playList` / `playNext` / `enqueue` on a list the phone got (search, album, playlist, artist answers are kept as handles, the newest 16) with the collection page's contexts (`album:<id>`, `playlist:<id>`, `liked`, `search`). - **Covers**: http(s) images load straight from their hosts; a `file:///` cover the app extracted itself (local files, downloads, local playlists) is registered under a hash handle and served by `/api/cover/<handle>` with the token (read on a worker, ≤ 8 MB, image types only); the page fetches it with the header and shows a blob URL. ### 3.24 Listen together (Jam) "Birlikte dinle": friends hear the same song at the same moment, without a Spotify account and without a server of ours. Standalone core (`app/Jam*`, `jam_test`): `JamMqtt` (MQTT 3.1.1 codec + client), `JamCrypto` (CNG), `JamInvite` (invite links, topics, the URL protocol key), `JamProtocol` (envelopes, replay windows, the session state, requests, the invite hand-off), `JamSync` (clock estimator, guest reconciliation). App side: `app/Together` (the session on the UI thread, player hooks, palette commands) and `app/TogetherPanel.cpp` (side panel, settings rows). - **Transport**: MQTT over secure WebSocket (WinHTTP's WebSocket API, subprotocol `mqtt`, the app-wide proxy (3.68), IPv6 fast fallback) to public brokers: `wss://broker.emqx.io:8084/mqtt`, `wss://test.mosquitto.org:8081/mqtt`, `wss://broker.hivemq.com:8884/mqtt` (all three passed `jam_test live` on 2026-11-11 through WinHTTP; HiveMQ's first connect took ~9 s there, its IPv6 addresses don't answer). QoS 0 only: CONNECT (clean session, 20 s keep-alive, a last will per connection), SUBSCRIBE, PUBLISH (retained for the state), PINGREQ, DISCONNECT. The client has its own thread (+ a receive thread per connection), reconnects with backoff (1 s doubling to 30 s) and moves to the next broker after two failed attempts. A planned close sends DISCONNECT, a WebSocket close and waits for the broker to hang up, so the last messages (end, goodbye) arrive. Order: the invite's broker, `Settings::jamBroker` (the user's own, `wss://` or `ws://`), the built-in list (`jam::brokerOrder`). The broker the host is connected to goes into the invite; when it fails, the host fails over in that order and re-publishes; a guest that finds no session within 15 s or hears nothing from the host for 35 s tries the next one; "Başka sunucuya taşı" leaves a retained state with `movedTo` (and a `move` message) on the old broker. - **Room and encryption**: room id = 128 random bits, key = 256 random bits; both exist only in the invite `shadetube://jam/<base64url(1 | flags | room | key | broker host:port/path)>` (~115 characters). Topics: `shadetube/jam/v1/<hex SHA-256(room id)>/{state,h,g}` (retained host state, host messages, guest messages). Every payload is AES-256-GCM (random 96-bit nonce, the topic as associated data) of `{v, t, d, s, b}`: type, the sender's device id (random, `jam.json`), a sequence number and the body. Receivers keep a 64-entry replay window per device; sequence numbers are `(epoch << 24) | counter` with a new epoch (unix second) per connection, and each connection's last will takes `epoch << 24 | 2^23`, so a will the broker delivers after the device reconnected is refused. Keys and links are never logged (logs name rooms by `jam::roomTag`, 8 hex digits of the topic hash). - **Host**: publishes the state on every player change (coalesced 150 ms), at least every 30 s and when the real position drifts 400 ms from the published one: the current item + the next 50 in play order (id, title, artists, album, length, cover, the exact YouTube video it plays, who added it, kind), position + the host's steady clock, playing / status, guest permission, members, bans, a revision. Items it plays from disk are `File` (guests use the host's video when the match cache knows one, else look them up by title / artist / length); podcast episodes and radio stations are shared with 0.11.0+ guests (3.51) and `Unsupported` for older ones (they pause and the panel says why). Guests' `req`s: `add` always (the song goes after the songs guests added before, marked "+ NAME" in the queue panel); play, pause, next, previous, seek and jump only with "Misafirler çalmayı kontrol edebilir". Presence: hello (name + the guest's ECDH public key), heartbeats every 10 s, the last will; 35 s of silence = offline, offline members leave the list after 3 min; at most 10 people. "Çıkar" bans the device (ignored by the host, listed in the state, the guest leaves). "Yeni bağlantı" moves the session to a new room + key: each online guest gets the new link sealed with SHA-256(ECDH(host ephemeral, guest key) || label), the old room's retained state is cleared; a removed device reads the old room but can't open the hand-offs. Both ends play songs at 1x during a session (episodes: the host's speed, 3.51). Closing the host's app keeps the session for a restart (3.51). - **Guest**: on joining, `session.json` is copied to `jam-own-session.json` and shuffle / repeat / speed go to `jam.json`; leaving, being removed, the host ending the session or the next start after a crash put them back (`Player::restoreSession` stops what plays first). Following runs four times a second (`jam::decide`): the host's queue is loaded at the host's position (`Player::playContextAt`, the host's videos pinned with `MatchService::pinForSession`, so the guest's own downloads / matches of a song are not used), an item that became current is jumped to (gapless when prepared), changed upcoming items are replaced, play / pause follow. Position: host clock = guest clock + offset from pings (NTP formula, median of the faster half of the last 9 samples); the drift is re-sought past 1 s (at most every 3 s), and a steady offset over 250 ms gets up to three fine corrections per song; seeks and loads aim ahead by learned leads. Items that fail twice are held until the host moves on; SponsorBlock is off for guests (the host's skips arrive as its position). The player's commands go through `Player::commandFilter`: playing or queuing a song becomes an `add` request (a toast says so), transport becomes a request or is refused, queue edits / shuffle / repeat / speed / "Yanlış eşleşme?" are refused; the player bar disables what a guest can't use (its tooltip says why); volume stays local. - **UI**: a side panel in the queue's slot (`JamPanel`; the player bar's button, the `listen-together` action, `--route jam`): start / join, the invite link + copy + new link, participants (remove), the permission, the broker and link state, the guest's sync state ("Eşit · ±0,03 sn"), leave / end. The player bar shows "Birlikte dinleniyor · <host>" (guests) or "… · n kişi" (host). Invite links open from the search box, Ctrl+V, the "Katıl" dialog, `--open-link` and the `shadetube:` URL protocol: `HKCU\Software\Classes\shadetube` → `"<exe>" --open-link "%1"`, written at startup for the real profile only (sandbox profiles leave it alone unless `SHADETUBE_PROTOCOL_KEY` names a test key) and removed by the uninstaller; a second launch hands the link to the running instance as `WM_COPYDATA`. Ayarlar › Birlikte dinle (`settings:jam`): the display name (`Settings::jamName`; default: the Spotify display name, else the Windows user's first name) and the own broker (`Settings::jamBroker`). - **Measured** (two sandbox instances on one PC, EMQX, Debug): ~0.7-1.3 s to connect, guest requests reach the host in ~100-250 ms, clock offset within a few ms, drift after the first correction +20 .. +50 ms (-110 ms after a resume). ### 3.25 Interface scale and list density - **Interface scale** ("Arayüz ölçeği", `app/Display`): `Settings::uiZoom` in percent, one of 80 / 90 / 100 / 110 / 125 / 150 (a hand-edited value snaps to the nearest). `ui::Window::setZoom()` multiplies the window target's DPI by it, so the DIP → pixel scale (`Window::scale()`) is the monitor's DPI / 96 × zoom: the window keeps its size in pixels and the client area becomes that many fewer / more DIPs, so everything reflows and renders crisp (Direct2D draws at the target DPI, text layouts are DIP-based, icon masks are dropped and rasterised again at the new pixel sizes, images are requested at the new pixel sizes). Mouse input, `WM_NCHITTEST` (caption, snap layouts' maximize button) and drag and drop divide by the same scale; the resize borders stay system metrics. The minimum track size is the 960 × 600 DIP minimum at the zoomed scale, capped at the monitor's work area. `WM_DPICHANGED` keeps the zoom (only the DPI part changes). The saved window size stays in monitor DIPs (`Window::dpiScale()`), independent of the zoom. The mini player follows it too: its DIP sizes are multiplied by it (3.39). - Changed by the `zoom-in` / `zoom-out` / `zoom-reset` actions (Ctrl+Plus / Ctrl+Minus / Ctrl+0, also while typing; the keypad's + / - / 0 and the layout's "+" key through `shortcuts::fallback`, 3.10.1), Ctrl + mouse wheel (`Window::onCtrlWheel`; notches add up to a step, so a touchpad pinch works too) and Ayarlar › Görünüm (a segmented control that keeps its row in view after the page reflows). The keys and the wheel show a short badge under the title bar ("ARAYÜZ ÖLÇEĞİ %110", an overlay updated in place; no fades with "Hareketi azalt"). - **List density** ("Liste yoğunluğu": Rahat / Sıkı, `Settings::compactLists`, also the `compact-lists` action in the palette): `TrackTable::rowMetrics()` is read at every layout and paint, so every track list follows (playlists, albums, Liked Songs, history, search, artist top songs, local files, smart lists, downloads): Rahat = the spec's 56 DIP row (art 40, title 14/600, artist 12), Sıkı = 40 DIP (art 28, title 13/600, artist 11). Virtualization, hit tests, drag and drop, the reorder line and the keyboard cursor all use the runtime row height; the cached row texts are rebuilt for the other styles. The queue panel's upcoming rows go from 52 to 40 DIP (art 36 → 28), the Library's list rows from 64 to 48 (art 48 → 36). A change calls `Window::relayoutAll()` (every widget lays out again, also those whose size did not change). - `settings.json`: `"uiZoom": 100`, `"compactLists": false`. Dev: write them into a sandbox profile's settings file before a `--screenshot` run; `SHADETUBE_KEYS_DEMO` (5.4) presses the zoom keys / runs actions live. ### 3.26 Settings page `app/SettingsPage.cpp` builds *Ayarlar* as a compact list of collapsible category cards (`app/SettingsCards`); the rows come from `SettingsWidgets.h` (`SettingRow`, `settingsToggle`, `Segmented`, `settingsSubheading`) and from the feature files' `build*Rows()` hooks. - **Cards** (`SettingsCard`), in page order with their ids: Spotify hesabı `spotify`, Bağlantılar `connections`, Oynatma `playback`, Ses `audio`, Görünüm `appearance`, Pencere ve sistem `window`, Klavye kısayolları `keyboard`, İndirme ve çevrimdışı `downloads`, Yerel müzik `local`, Kitaplık ve depolama `storage`, Telefondan kumanda `remote`, Birlikte dinle `jam`, Kara liste `blocklist`, Hakkında `about`. A card is a `bg.raised` surface (radius `radiusSurface`, `hairline.default` border); its header (icon tile, title, one-line summary, chevron) is one Tab stop that opens / closes it on click, Enter or Space. The height eases over `motion::medium` (instant with *Hareketi azalt*): it starts with `ScrollView::contentChanged()`, then the card re-measures itself every frame (`requestLayout()` from `layout()`, also when scrolled out of view); when it ends a closed body is hidden, so its controls leave the Tab order (collapsing around the keyboard focus moves it to the header). A card the user opens is then revealed with `ScrollView::revealRect` (header plus as much of the body as fits). - **State**: all cards start closed. The open ones are remembered for the run (`openCards()`): across `rebuilder()` rebuilds, navigation and Back / Forward (a card a deep link opened is closed again when history restores the scroll offset measured without it). *Tümünü aç / Tümünü kapat* next to the title opens or closes them all. - **Deep links**: `Route{Settings, <card id>}` (`--route settings:<id>`, the command palette) opens that card and jumps to it at the first paint; selecting the same link again re-opens and re-scrolls instead of going to the top. The ids are those of the former section headers, so older links keep working. - **Search**: the box next to the title is built once (`buildFrame()`), so it keeps its text and focus across rebuilds. Typing filters live (`SettingsSearch`): the query is folded (`foldForSearch`: case, accents, Turkish İ/ı) and every word must occur in a row's text in the UI language. A row is a `SettingsSearchable` (`searchText()`: `SettingRow` gives title + description; `AboutRow`, `ShortcutRow` (name + keys), `ScanRow` and `PairingCard` implement it too); the filter walks each card's body: matching rows stay and get a 2 px accent bar on an `accent.tint06` wash, a `ui::Label` is a sub-heading that stays with its group (a matching heading keeps the whole group), nested columns are filtered recursively, any other widget (equalizer, QR card, spacers) goes with the row or heading above it. A card whose title matches stays whole; one whose summary matches only when none of its rows does; cards without a match hide; "Sonuç yok" when nothing is left. The cards found are open for the search only (their headers still toggle them); Esc or the clear button restores the cards as they were, a second Esc leaves the box. A rebuild while searching re-applies the filter. **New rows are found automatically** when they are `SettingRow`s / `settingsToggle`s; a custom row widget with its own texts should implement `SettingsSearchable`. - **Ctrl+F** (the `search` action) calls `Page::focusSearch()` on the current page first: the Settings page focuses its box (unless Now Playing covers it); every other page keeps opening the Search page. - **Row anatomy** (0.11.0 polish): a `SettingRow` is the title (`body`, 14/600) at 18 DIP and the description (`secondary`, 13, fg.secondary) at 40, wrapped in the width the control leaves (48 DIP gap); a hairline.subtle below; at least 64 high. Every control ends on the row's right edge, vertically centered: a toggle 22 high, anything else 40. A `Segmented` is laid out at its natural width (it used to be centered in its designed width and ended up to 25 DIP short of the toggles above and below); text fields are 320 wide; a picker is a Secondary *dropdown* (`Button::setDropdown`: the value on the left, the chevron at the right end, like the title bar's account chip; language, lyrics translation, font, equalizer preset, output device, the remote's address); the accent swatches' last ring ends on the edge too. Sub-headings (`settingsSubheading`) are 13/600 fg.secondary, 20 above, 4 below. Status lines under a control (exclusive mode, the song cache) stay in the description, not in extra rows. ### 3.27 Sidebar width, icon rail and the accent in the chrome - **Width** (`app/Shell`): `SidebarEdge` is a 6 DIP strip centered on the sidebar's hairline (above the sidebar and the page, `IDC_SIZEWE`); hover lights the hairline in the accent, a drag resizes live (`Shell::dragSidebar`), a double click goes back to 240 DIPs. The expanded width is 200-420 DIPs and never leaves the page less than 400 DIPs (a narrow window, or the queue / friend / jam panel open, shows it narrower without changing the saved value). `Settings.sidebarWidth` (DIPs) and `sidebarCollapsed` are written when a drag ends or the mode changes. The edge is not a drop target and the playlist rows end 8 DIPs before it, so song drags onto playlists are unaffected. Now Playing and the connect screen hide it with the sidebar. - **Icon rail**: a drag below 150 DIPs snaps the sidebar into a 72 DIP rail (from the rail, past 160 DIPs expands it again: the gap keeps it from flickering); Ctrl+B (`toggle-sidebar`, *Ayarlar › Klavye*) toggles it. A drag that ends in the rail keeps the width it started with for the next expand. The collapse animates the width (`Shell::railAnim_`, 240 ms; instant with reduce motion): nav items fade their names and center their icons (`ButtonKind::Nav` does this by its own width), the section label fades, "+" centers, and half way the playlist rows become 40 DIP cover tiles (`SidebarRow` compact: Liked Songs as the accent heart tile, folders as the folder placeholder with an open / closed chevron, the playing collection's equalizer as a corner badge). In the rail names are tooltips, the podcast / new-release counts become accent dots, and the tiles stay drop targets (a resting drag still opens a folder). - **Accent in the chrome**: the title-bar mark is drawn from `logo/logo-mark.svg` with its own accent (`#DDFF47`, `winshell::kLogoAccent`) swapped for `accent().base` (`Icons::drawRecolored`: the SVG document is parsed once and its fills are set when the color changes, so the 600 ms cross-fade costs no rasterization). The close caption button's hover is the accent (pressed: `accent.pressed`) with an ink or white glyph, whichever contrasts more; the tokens' `chrome.closeHover` red is no longer used. - **One-color tray icon** (`Settings::trayIconMono`, *Ayarlar → Pencere ve sistem*; issue #5): `winshell::trayMarkIcon` draws the mark as a flat glyph (the bright half filled with the center's notch, the dark half as the ring, a larger dot) in `glyphColor(systemUsesLightTheme())`, white on a dark taskbar like Windows' own icons; the tray redraws it on `WM_SETTINGCHANGE` "ImmersiveColorSet" when the taskbar's mode changed. The accent doesn't apply to it. - **Window and tray icons** (`winshell::renderAppIcon` / `appIcon` / `WindowIcon`, `Tray::setAccent`): the design's app icon (the mark on its dark tile) rendered with the requested accent (`Theme::requestedAccent()`: the cover's or the fixed color before the light theme darkens it, since Windows draws these on its own surfaces) into 32-bit icons: `WM_SETICON` big + small at `SM_CXICON` / `SM_CXSMICON` of the window's DPI (title bar, taskbar button, Alt+Tab; again after `WM_DPICHANGED`) and the tray icon at its small-icon size (`NIM_MODIFY`). The logo's own color (no accent requested) uses the `.ico` itself. `App::syncAccentIcons()` follows the accent's target, not the cross-fade: at most every 400 ms and only when the color changed; replaced icons are destroyed (`winshell_test` checks for leaked handles). The exe's icon (Explorer, pinned shortcuts) stays the static `assets/app.ico`; a pinned taskbar button may show the shortcut's icon instead of the window's. The mini player is a tool window without an icon. - **Side panels** (the queue, the friend activity, *Birlikte dinle*; 0.11.0 polish): one header: the title (`type::title`) at 20 DIP, 36 high, 20 DIP padding; 32 DIP icon buttons 4 apart at y 22 ending 20 DIP from the right edge: the panel's actions, then *Kapat* last (the queue had no close button and its two actions sat 6 DIP further right). The toggle that opens a panel is lit while it is open (the player bar's queue button now too, like the title bar's friend button). Opening: the page takes its new width at once and the panel fades in sliding 16 DIP from the right (240 ms, decelerate); closing: it fades out drifting 8 DIP right over the widened page (140 ms, accelerate; `Shell::paintSidePanel`, the closed panel painted hidden over a `fillSurface`); none with Hareketi azalt or Windows' animation effects off. Switching panels or opening Now Playing doesn't animate them. - **Title bar**: in Now Playing the "ŞİMDİ ÇALIYOR · <kaynak>" label starts 16 DIP after *Küçült*, whatever its language ("Einklappen" and "Свернуть" ran into it). Without Spotify the account chip's menu also picks the open catalog (YouTube Music / MusicBrainz, checked), as Ayarlar › Spotify hesabı does. - **Connect screen**: two columns that never overlap at any window size or zoom (margins and gap follow the width, the hero 55 %); the hero takes the largest display size (64 → 36) at which both lines fit; steps wrap to three lines; the content is centered vertically, and on short windows (150 % zoom) the brand lockup gives way, since the title bar names the app. At 960 DIP and 150 % the hero used to run into the steps. ### 3.28 Smooth scrolling `ui/ScrollPhysics` (standalone, times passed in, tested by `scroll_test`) is the one engine behind every scrolling surface; `ui::SmoothScroll` (`ui/Anim.h`) puts it on the frame clock: `value()` advances it to `frame::now()` and asks for the next frame only while it moves (idle and 0 % CPU once settled, like `Anim`); input is stamped with the real time of the event. - **Model**: the offset follows a target through a critically damped spring, solved in closed form for the elapsed time (the same motion at 60, 144, 240 Hz or with uneven frames). Input moves the target; position and velocity carry over, so a new notch never restarts a curve or jerks the speed. From rest it never overshoots; a position past a bound (only possible after a reversal or a change of feel) stops there with its velocity dropped. Bounds that shrink (content got shorter, a Settings card collapsing) clamp the offset without a bounce. - **Feels** (stiffness ω, time to 95 %): `Wheel` 27/s (~180 ms) for notched wheels, `Precision` 120/s (~40 ms, ~1 frame of lag) for touchpads and high-resolution wheels, `Glide` 22/s (~215 ms) for keys, scrollbar track clicks, `scrollTo(y, true)` and focus reveal, `Follow` 11/s (~430 ms) for the lyrics following the active line. - **Wheel**: `Window` passes `WM_MOUSEWHEEL` deltas as notches (delta / 120). A delta that is not a whole notch marks a precision device for 400 ms after its last delta: its deltas move the target 1:1 (the spring only smooths their rhythm; Windows' own touchpad inertia arrives as more deltas). Whole notches accumulate on the in-flight target; reversing mid-glide starts from the current position. Notches less than 80 ms apart in one direction build a streak: after 3 plain ones each adds 0.12× to the step, up to 2.5× (a long page crosses quickly, unhurried scrolling never accelerates). A notch is `notchDip` (ScrollView 120 DIP, panels their own) at Windows' default 3 lines, scaled by `SPI_GETWHEELSCROLLLINES` (read per event; "one screen at a time" = 90 % of the view). `WM_MOUSEHWHEEL` arrives as `dx`: a vertical `ScrollView` leaves horizontal-only input to its parents (there are no horizontal scrollers; one would take `dx`, or `dy` with `MouseEvent::shift`, through the same physics). - **Keys**: `ScrollView::onKeyDown` takes PageUp / PageDown (90 % of the view below `topInset`), Home / End and Up / Down (a line, `notchDip / 3`) when the focused widget inside leaves them (lists and fields keep theirs); keys nobody took go to the scroll view last clicked in, else the one under the pointer, else the biggest one on screen (`Window::scrollByKey`, after the global shortcuts, never behind a modal overlay). Key repeat retargets the glide. - **Immediate**: thumb drag (1:1), drag-and-drop autoscroll and restoring a page's offset jump (`snap` / `scrollTo(y, false)`). The history keeps where a glide in flight was heading (`ScrollPage::scrollOffset()` = target). - **Reduce motion** ("Hareketi azalt"): every move lands at once. - **Surfaces**: `ScrollView` (every page, the sidebar list, Jam panel, podcasts / radio dialogs), the queue panel, the friend activity panel, the command palette list, Now Playing's and the full-screen lyrics. The equalizer's wheel adds touchpad deltas up to a notch before it steps 0.5 dB. - **Consumers**: `revealRect` / `scrollIntoView` use the target, sticky headers read the offset in `paint()`, lazy loading (`TrackTable::onNearEnd`) is driven by what is painted, `onScroll` fires with the offset on every frame it changed. When a glide settles the pointer's position is re-sent as a mouse move (`Window::refreshHover`), so rows that slid under a still pointer get their hover. - **Painting** stays cheap while scrolling: `Widget::paintChildren` skips children outside the clip, `hitTest` children outside the point, and the long lists paint only their visible rows (`TrackTable`, `LibraryView`, the queue). Measured with `SHADETUBE_SCROLL_DEMO` on Stats with 25 000 imported plays (Release, 240 Hz): 97 % of frames on consecutive vblanks, frame CPU up to the page's paint 1.3 ms median / 3.9 ms p99. ### 3.29 Player bar `app/Shell.cpp` (`PlayerBar`, 88 DIP), the controls in `ui/Controls`, the shared pieces in `app/Components`. - **Layout**: track info on the left (art 56, title, artist, heart after the title), on the right the session pill / jam, sleep timer, video (songs only, 3.41), the visualizer (3.61; only while the center column keeps 380 DIP with it), lyrics, queue, volume knob, mini player and full screen (vertically centered). The center column holds the transport row (shuffle · prev · play 40 · next · repeat, center y 33) over the seek row (center y 69: elapsed · wave · total, mono 11, elapsed `fg.secondary`, total `fg.tertiary`). The column is 40 % of the bar (380..640 DIP) but narrows to keep ~140 DIP of title and the right group free (about 316 DIP at the 960 DIP minimum window). A `hairline.subtle` marks the bar's top edge. Now Playing covers the bar with its own controls (3.40). After the artist line: smart shuffle's *ÖNERİLEN* badge and, while an AutoMix overlap plays (3.80, `Player::automixing()`), an accent *AUTOMIX* badge (the shuffle glyph; the feature's name in every language). - **Thin outline icons**: the bar uses the app's one icon set (3.43; in 0.9.0 it had its own `<name>-thin` files, now aliases of the plain names): next / prev as an outlined triangle + bar, the liked heart `heart-filled` in the accent. - **Play button** (`ui::PlayButton::Look::Outline`; `Look::Accent`, the filled accent circle of page headers, draws the same outline glyph in `accent.onAccent`, 1.15 × its icon size, stroke 7.5 % of the glyph): a 1.25 DIP `fg.primary` ring around an outline glyph drawn in code (`Canvas::polyline`, round joins). The play triangle is cut into a quad and a triangle that move into the two pause bars (240 ms, eased, continuous); while they part, the cut edges fade in and the outline between them fades out. Hover: ring and glyph accent over `accent.tint12`; press: the spring scale; loading: an accent arc runs around a `hairline.control` ring with the glyph dimmed; disabled (a listen-together guest): 38 %. - **Seek wave** (`ui::Slider::Look::Wave`, drawn by `ui::drawWaveLine`): the played part is a 1.75 DIP accent sine wave (amplitude 3, wavelength 26 DIP) tapered to the line at both ends, flowing right one wavelength per 1.9 s; the rest is a `hairline.strong` line with the buffered part in `fg.tertiary`. The wave flows only in `Status::Playing`: paused, stopped, resolving and buffering settle it into a straight line (420 ms) and back. The playhead is a 3 × 12 accent pill that grows to 4 × 18 on hover, drag and keyboard focus (the focus ring circles it); the hover time shows in a small box just above the wave. Seeking, keyboard steps (5 s) and the time labels work as before. A live stream is all "now": a wave end to end, no playhead, the "CANLI" badge after it; a listen-together guest without control sees it at 38 % without a playhead. The mini player's wide and square modes use the same seek wave; its strip a plain progress line (3.39). - **Frame budget**: while the wave flows the bar asks for a repaint every `ui::kWaveFrameMs` (25 ms: with the wait for vsync every second 60 Hz frame, ~30 fps; each one a full-window frame) only when it can be seen: hidden and minimized windows never render (3.3; the mini player alone then renders its own small window) and the full-screen lyrics, which cover the bar, keep their own rate. Otherwise playing repaints 4 times a second (time label) and a paused player schedules nothing. Reduce motion: a still wave (a straight line when paused) and no fast repaints. Measured (Release, 1440 × 900 DIP window at 175 %, Ayarlar page, a local file, frames counted per 2 s): flowing 32 fps and about 4-7 % of one core; reduce motion 4 fps and about 0.5-1.4 %; paused 0 frames and 0 %. - **Track change** (`TrackSwap`, `FadingArt`): when another track starts, the old cover, title and artist slide 10 DIP out (up for a later slot of the queue, down for an earlier one) and fade while the new ones slide in (`motion::slow`; the heart slides from the old title's end to the new one's); a cover that is not loaded yet starts as the placeholder and cross-fades in when it arrives. The first track, a cleared player and metadata changes of the same track (tags, a station's song title) change in place; reduce motion makes it instant. The mini player does the same. ### 3.30 Song preview Press and hold a song (or a card's cover) to hear about 20 s of it without touching what plays or the queue. `app/PreviewSession` (the state machine, standalone: `preview_test`), `app/Preview` (input, overlay, lookups, settings), `ui/HoldGesture` + `ui::Window::onHold` (the gesture), `Player::startPreview` and the engine's preview voice (`AudioEngine::openPreview`). - **Triggers**: a press and hold (`preview::kHoldMs` 350 ms; a plain left press a widget took: Ctrl / Shift / Alt presses and double clicks never start one, moving past the drag threshold `dragdrop::kThreshold` cancels it) on a track row (`TrackTable`: not on its heart, artist link, number or "+" / "×"), a card's cover (`MediaCard` whose page set `previewTarget`, not its play button), a Library cell (the grid's cover, a list row), an upcoming queue row (recommendations too), Home's hero cover, quick-access tiles, shelf cards, popular tiles and release rows (a collection from `home::Item::context`: `preview::contextTarget`), Stats' song rows, Yerel dosyalar' album / artist cards (their first song). The track menu's "Önizle" (one song, not the one that plays; "Önizlemeyi durdur" while it previews) and the `preview` action (default **P**, Ayarlar › Klavye) for the keyboard-focused row / card (a clicked row has the focus) start one too. Widgets opt in as a `PreviewSource` (`previewAt(windowPos, keyboard)`); the window asks the innermost one above the pressed widget when the press has rested. A hold the app takes owns the rest of the gesture: the widget's press ends at once with a release outside every widget (its press micro-animation eases back; no click, so no `pagetx::arm` / navigation, no drop, no drag later) and it sees no more moves; the window keeps the mouse capture for the hold's own release, and the overlay draws the pressed look. The release, Esc or a lost capture (Alt+Tab) stops the preview; Esc's release is still swallowed. A menu / key preview runs until the limit, Esc, the key or its menu item again, or a playback command. - **Collections**: an album (`source::album`: its most listened song when ListenBrainz counts came with it, else the first), an artist (the first of its top songs), a Spotify playlist / Liked Songs (`Api::playlistTracks`, first 20 rows), a local playlist / Liked Songs logged out (the library). Songs found are cached for the run. - **Session** (`preview::Session`, times passed in): Idle → Looking (a collection) → Resolving → Playing, or a Hint: the song already plays ("Şu an bu şarkı çalıyor", nothing starts), nothing to preview, it failed. The limit (`kLimitMs` 20 s) counts from the first sound; no sound within 12 s gives up; a hint stays until the release (hold) or 1.8 s (menu / key). A new preview stops the last first; every `Port::start` is matched by one `Port::stop` unless the player ended or failed it itself. Stations and podcast episodes are not previewed (the press stays a press). - **Audio**: resolved like a queue item (a download, a local file, YouTube with the backup source and SoundCloud) on a worker. It starts at `preview::startPoint`: 35 % in (the top for songs up to 30 s or of unknown length), early enough for the 20 s, moved past a SponsorBlock segment the session already knows for that video (`SponsorBlock::knownSegments`: the current video or the small cache of earlier lookups; no lookup is made). The engine's preview voice is a second `Track` mixed in after the current track's block and before the limiter: its own equalizer state, its loudness gain, the volume, the limiter and the device of everything else. With 0.5 s decoded it fades in (350 ms, equal power) while the current track fades out (250 ms) and is then **held**: it is no longer read, so its position, state, playback speed (the stretcher keeps what it holds) and preloaded next track stay; a crossfade in progress drops its outgoing track, as a pause does. Stopping fades the preview out (250 ms) and the current track back in (400 ms) from where it fell silent. A paused or empty player stays so; a live stream keeps running muted and comes back live. A preview stopped before its sound never touched the current track (no blip). It decodes at the rate the device runs at (a station may have opened it at its own); a mismatch later fails it. A replaced audible preview fades out under the new one. - **Nothing else moves**: `Player`'s queue, current item, `status()`, `positionMs()` and notifications are untouched, so history, listening stats, scrobbling, SMTC, Discord, smart shuffle and the recently played lists never see the preview. The player bar alone shows it (`PlayerBar`, `Player::previewHoldsCurrent()`): the play button's play glyph and a still wave while the preview holds the current song (not with `keepMainRunning`). A command that changes what is heard (play / pause, next / previous, seek, jump, speed, a new queue, "Yanlış eşleşme?"; `Player::endsPreview`, outside an `Unfiltered` scope) ends the preview first, then applies: Space pauses what was playing before the preview. Queue edits (endless playback appending, smart shuffle, "Sıraya ekle") leave it playing. - **Listen together (decision)**: previews stay local and are allowed for hosts and guests. During a session the current song keeps running muted under the preview (`startPreview(..., keepMainRunning)`), so the host's published position never drifts and a guest keeps following; afterwards it comes back at the session's position, not where it fell silent. - **Touch**: while the mode is "hold", Windows' press-and-hold right-click is off for the main window (`MicrosoftTabletPenServiceProperty` = `TABLET_DISABLE_PRESSANDHOLD`), so a held finger previews; the menu stays on the menu key / Shift+F10, "Yalnızca menü" gives the gesture back. Not tried on touch hardware. - **Overlay**: a non-modal, never hit-tested overlay (`ui::OverlayLayer`): a 300 × 60 card drawn like the toasts (`ui::paintOverlaySurface`, `Elevation::Toast`, its own `ui::Acrylic` material captured in `prepareBackdrop`; `gfx::radii()`) with the cover, the title, "ÖNİZLEME" in the accent's mono label and the artist, and a thin ring (1.25 DIP `hairline.control`, 1.5 DIP accent arc) that spins while the song is looked up / buffered and fills clockwise from 12 o'clock over the 20 s; a hint replaces the second line. The pressed row / cover gets a 1 DIP accent outline over `accent.tint06`. It sits just above a pressed row (below it near the title bar) and above the pointer on covers and tiles; fades in with a 6 DIP rise (`motion::fast`) and out (`motion::normal`) through `ui::overlay::duration` (no rise and a still arc with reduce motion / Windows' animations off). While shown it repaints every 33 ms (spinning) / 100 ms (filling). - **Settings**: `Settings.previewMode` `"hold"` (default) | `"menu"` (menu item and key only) | `"off"`, Ayarlar › Oynatma › Şarkı önizleme. - **Safety**: a 50 ms tick runs only while a preview is active; a hold whose button is physically up for 300 ms without the release reaching the window lets go (`Window::cancelHold`). `Window`'s destructor drops `onHoldEnd` before the tree goes (the capture released by dying widgets must not reach the app). - **Measured** (Debug, sandbox): a local file is audible 10-20 ms after the hold fires (~370 ms after the press); a MusicBrainz album tile: lookup 1.3-4 s, YouTube resolve ~2.5 s, first sound 5-9 s after the press, the current song playing on until then. - Dev: `SHADETUBE_PREVIEW_DEMO` (5.4) presses, holds and releases at window DIPs; the log's `preview` lines give each transition with its time and the current song's state and position. ### 3.31 Page transitions `app/PageTransition` (drawn by `PageHost` in `app/Shell`) on `ui/PageMotion` (the timeline and the cover's flight, standalone, all times passed in; `pagetx_test`). The Router tells how the page changed (`Router::lastChange()`: from, to, Push / Back / Forward / Replace). - **Pages**: Push and Forward: the outgoing page fades out over the first 40 % while it shifts 12 DIP left (accelerating), the incoming one slides 24 DIP in from the right (decelerating over the whole 220 ms) and fades in from 30 % on. Back is the mirror image. Replace (the first page, redirects): a 180 ms fade in place. Re-selecting the current page still only scrolls it to the top. - **The outgoing page** is taken out of the tree when the new one arrives (`Widget::release`: `Window::forget` clears hover / capture / focus in it, and a keyboard focus is restored on the new page by type and position as on any page change, 3.3) and kept, detached, until it has faded out, then `deferDelete`d: no input, no layout, not in the Tab order; its own async continuations still land on it. Each page is painted inside `Canvas::pushSurfaceGroup()` (3.3), so under Mica a sticky header fading out never adds a second layer of the translucent tint (measured with `SHADETUBE_BACKDROP=force`: the pinned bar's alpha goes from 147 to the surface's 140, never above). A navigation in the middle of one drops the old outgoing page; the page that was arriving leaves from the opacity it had. - **Shared cover**: a card or row with a cover calls `pagetx::arm(SharedCover)` right before it navigates (click, Enter, its play button: "#play" opens the page too): `MediaCard`, `ListRow`, `Tile` (its round photo), the Library's grid / list cells (`LibraryView`, Liked Songs' heart tile included), smart list cards, the sidebar rail's tiles. The page it opens says where its header's cover is (`Page::coverSlot`): `CollectionPage` (album, playlist, Liked Songs), smart lists, a podcast show; while it is still loading, where the header's cover will be (`ScrollPage:: loadingCoverSlot`; the loading skeleton leaves its cover block out meanwhile). The cover then flies there (`CoverFlight`: 240 ms, Standard easing, rect and corner radius morphing: a round artist photo into a square header) while the pages only cross-fade. Its owners skip their own artwork (and shadow) while it flies (`pagetx::presence(owner)` = 0). On arrival the header takes over in 120 ms (the flying cover fades out over the header's own artwork while its shadow comes up); if the header's image is not loaded yet the cover holds on the header - no frames, `ImageCache::onLoaded` repaints - until it is, at most 1.5 s, or until the header moves (scrolled). A header that disappears (the page turned into an error) dissolves the cover where it is in 120 ms. The flight draws the sharper of the two loaded bitmaps (source's, destination's) for its current size; painted covers (Liked Songs, smart lists) are drawn by a painter that captures its data by value. It is clipped to the content area (the page and the sidebar). - **Back**: every flight remembers its origin (the page, the route it came from, the cover's key: the first image URL, "liked" or "smart:<id>", and where it was). Back from that page to that route flies the header's cover to the `CoverSource` on the rebuilt page that shows the same key, nearest to where it was and at least half on screen; Forward through the history does it again from that card. The card has to be there at the first frame (pages built synchronously: the Library, the logged-in Home, local lists...). - **Degrades to the plain transition** when the page opened has no header cover (an artist page, Settings...), the card's image is not loaded, or nothing on the page matches; this is decided at the first frame, before anything has been hidden. - **Off** (pages change at once): Ayarlar › Görünüm › *Sayfa geçişleri* (`Settings.pageTransitions`, on by default), *Hareketi azalt*, or Windows' animation effects off (`SPI_GETCLIENTAREAANIMATION`, read at every page change). - **Frames**: the frame clock (`frame::now()`), frames asked for only while something moves; after a forward + back transition the app is idle again (0 ms CPU over the next 4 s). - **Adding a source**: implement `CoverSource::coverFor` (the cover it shows for a key; `pagetx::imageCover` / `pagetx::likedCover` build it), arm it before navigating and skip the artwork while `pagetx::presence(owner)` is 0. A page with a cover in its header overrides `Page::coverSlot`. - **Dev**: `SHADETUBE_NAV_DEMO` (clicks / Back / Forward at set times) with `SHADETUBE_MOTION_SCALE` (slow motion) and `--screenshot` capture the middle of a transition (5.4). ### 3.32 Micro-interactions `ui/Micro` (logic in `Micro.cpp`, standalone and tested by `micro_test`; drawing in `MicroPaint.cpp`) holds the small feedback shared across the app: hover and press fades, the card lift, the heart pop and the playing bars. Durations are the motion tokens (80-240 ms, standard / decelerate, no overshoot) and everything is invalidation-driven like `Anim`: a value asks for frames only while it changes, so a settled window renders nothing. - **Gate**: `motion::micro()` = *Hareketi azalt* off **and** Windows' animation effects on (`SPI_GETCLIENTAREAANIMATION`, Settings › Accessibility › Visual effects; read once, again on `WM_SETTINGCHANGE` in `Window::handleMessage`). `motion::microMs(ms)` is `ms` or 0, so a micro-interaction written as `anim.to(v, motion::microMs(motion::fast))` becomes an instant change when either is off; the playing bars then stand still in a fixed pose, the heart and the card just switch. `SHADETUBE_CLIENT_ANIM=0 / 1` overrides the Windows setting (5.4). Reduce motion alone keeps collapsing every `Anim` as before (page transitions, scrolling, the seek wave are not gated by the Windows setting). - **Controls** (`ui/Controls`): every hover / press / active fade goes through `microMs`. `Ghost` and `Chip` buttons press to 98 % with `overlay.pressed`, `Nav` / `SidebarItem` get a light pressed fill. `Toggle`: the knob slides (180 ms), hover brightens the off track's outline or the on track's fill and the knob, a press stretches the knob 4 DIP towards the middle. `Slider`: held, the thumb grows 15 % over an `accent.tint12` halo (the wave's playhead keeps its hover size while dragged). `Knob`: the ring turns `fg.primary` while held. The Settings `Segmented` control slides its selection pill (180 ms; a label changes color as the pill covers it) and fades a hover fill on the other segments. - **Painted lists** (`ui::HoverFade`): the hovered row fades in and the row left fades out (120 ms each; going back resumes the fade-out). Used by `TrackTable` (row background; the number crossfades to the play / pause glyph and the heart / "×" fade in), the queue panel, podcast episode lists; `LibraryView` has its own equivalent (`hot_` / `prevHot_`). - **Cards** (`ui::card`): MediaCard, the Library grid, smart list cards, editorial `Tile`s and radio `StationTile`s share one look. Hovered by the pointer the card rises 2 DIP (`card::lift`) over `cardHoverShadow` and a `hairline.strong` edge brightens around the artwork (round artist cards: the accent ring); a press settles it back and scales it to 98.5 %. Keyboard focus shows the shadow and the play button but no rise (the focus ring stays on the card). The play button fades in rising 8 DIP and growing from 90 %, brightens (`accent.hover`) and grows 4 % under the pointer and shrinks to 92 % when pressed; a press on it leaves the card still. - **Heart** (`ui::HeartPop`): like (220 ms) = the filled heart grows out of the outline, the glyph pops to 116 % and back (a sine hump, no spring) and six thin accent ticks fly out and fade; unlike (160 ms) = the fill shrinks back with a slight dip. A `Button` made a heart with `setHeart(outline, filled)` draws the liked state from `active()` and `pulse()` plays it: the player bar's heart pulses whenever the playing song's liked state changes (its own click, a row's heart, Ctrl+L, a menu, the phone remote), never when another song starts; the album page's save heart pulses on click. Track rows pop on a click of their heart and, for the playing song's row, when it is liked elsewhere; radio station rows / tiles pop their favorite heart. Now Playing's own heart (3.40; the player bar is hidden there) pops the same way; the mini player has none at all. - **Playing bars** (`ui::paintEqualizer`, app wrapper `drawPlayingBars` in `app/Components`): four 2 DIP pills drawn in code (two slow sines per bar with the design's phases 0 / 0.6 / 1.2 / 1.9 rad), in the playing track's row (in place of its number, also while paused), the queue's current row, the sidebar's and the Library list's playing collection and the playing radio station. One shared `equalizer::Clock` drives them all: it advances with the frame time while the player plays and eases to a stop over 240 ms when it pauses (and back), so every bar on screen freezes where it is. While they move, each painted indicator asks its window for a repaint every `equalizer::kFrameMs` (25 ms, the seek wave's interval) instead of every vblank: a playing list adds no frames of its own to the ones the flowing wave already causes. Rows scrolled away, a page covered by Now Playing, the full-screen lyrics (`LyricsFullscreen::isOpen`) and hidden or minimized windows ask nothing. - **Cost** (`micro_test` checks the frame requests): idle and paused windows render nothing. Measured (Release, a 1346 × 712 DIP window at 175 %, process CPU over 10 s, a local file playing): idle 0 %, paused 0 %, playing on the *Yerel dosyalar* song list with its bars and the sidebar's moving 8-9 % of one core, the same as playing on *Ayarlar* without any bars (8-11 %): the frames are the seek wave's. (The earlier SVG-frame equalizer asked for every vblank while a playing row was on screen.) ### 3.33 Sidebar: room for the playlists The page entries used to take most of a short sidebar: at 1280 × 688 DIPs (1920 × 1080 at 150 %) the playlists got under three rows. `app/Shell` (`Sidebar::layout`) now budgets the height, top to bottom: - **Main pages** Ana Sayfa, Ara, Kitaplık; the **"DAHA FAZLA" group** (`NavGroup` header, then İndirilenler, Yerel dosyalar, Radyo, Podcastler, Yeni çıkanlar (Spotify only), İstatistikler); the "Çalma listeleri" label with "+"; the playlist list; Ayarlar pinned at the bottom. The entries live in their own `ScrollView` (`nav_`, content `NavBox`). - **Group header**: a mono section label like "ÇALMA LİSTELERİ" with a chevron that turns as it opens. Click, Enter or Space toggle it, Right opens, Left folds; the `sidebar-more` action (palette, bindable, no default key) too. The animation unrolls / rolls up the entries (`motion::medium`; each folding slot clipped to its share and faded; instant with reduce motion); once settled the folded entries are hidden, so they leave the Tab order (keyboard focus on one moves to the header). Folded, the **current page stays visible** under the header when it is one of them, and an accent dot after the label says a folded page has news (podcast episodes, unseen new releases; the count pills of visible entries are unchanged, `NavBox::paintBadge`). In the icon rail the header is a centered chevron (tooltip "Daha fazla göster" / "Daha az göster"). - **State**: `Settings::sidebarMore` (`"sidebarMore"`: 1 open, 0 folded, -1 automatic, the default). Automatic opens the group while that still leaves the list `kAutoListRows` (8) rows, re-checked at every layout and snapped (it follows window resizes); the first toggle makes it the user's choice. - **Guaranteed list**: the playlists always keep `kMinListRows` (5) rows (fewer when there are fewer; 48 DIP tiles in the rail). The nav first switches from the spec's metrics (top 24, rows 36 + 2, group row 36, label block 50, Ayarlar 16 + 36 + 8) to tight ones (top 12, rows 32 + 0, group 28, label block 34, Ayarlar 10 + 32 + 6), also always with the compact list density (3.25); when even those would squeeze the list it scrolls on its own (at least two rows in view, 72 DIPs a notch, a hairline under it while there is more; the current page's entry is scrolled into view). - Measured with 18 playlists: 1280 × 688 DIPs, automatic: folded, 9 rows (before: 2.8); open: tight metrics, 5 rows. 1440 × 860: folded, 12 rows; 1440 × 900 (the default window): open. Zoom 150 % on a 1440 × 780 window (960 × 520 DIPs): tight, the current page kept under the folded header, 5 rows. - Unchanged: the resizable width and the rail (3.27), folders, pinned items, drag and drop onto the rows (the list and `rowAt` are the same), the edge's hit strip. ### 3.34 Home page `app/HomePage.cpp` (what is shown, resolving player contexts) on `app/HomeWidgets` (namespace `home`: the widgets). - **Order**: greeting, hero, quick-access grid, then shelves. Logged in: Yeni çıkanlar (followed artists), Spotify's personalized shelves (two skeleton shelves while `ShelfCache`'s first fetch runs, dropped when it fails), Senin için listeler, Son çalınanlar, Çalma listelerin, Kaydettiğin albümler, Takip ettiğin sanatçılar (the last three link to their Kitaplık tab). Logged out: Son çalınanlar (→ Kitaplık › Geçmiş), Senin için listeler, Çalma listelerin, then the open catalog in a sub-column that loads behind two skeleton shelves (the rest of the page shows at once; a failure puts the retry panel only there): Bu hafta popüler tiles + Yeni çıkanlar list (stacked under 760 DIPs), Sana özel, Popüler sanatçılar, Öne çıkan albümler. The library's first load (logged in) shows the greeting over `TopSkeleton` + two `ShelfSkeleton`s. - **Greeting** (`home::Greeting`): `greeting()`'s two parts on one line (800 + 300) when they fit beside the date / count column, else on two; 56 / 44 / 36 DIPs by page width; the mono lines at the right (≥ 900 DIPs) or under it. - **Hero** (`home::Hero`, source `heroItem()`): what the player has (playing or paused, so the restored session too): its context resolved from what the app holds (Spotify snapshot or local library; albums / artists also from the history; smart lists with their generated cover), a station (its logo), a podcast episode (progress live from the player, "N DK KALDI"), else the track itself (opens Now Playing); "ŞİMDİ ÇALIYOR" / "KALDIĞIN YERDEN DEVAM ET" follows play / pause and the button pauses / resumes. Nothing loaded: the newest resolvable context of `libraryRecents().newest()` (new in `libview::Recents`, tested) or the newest unfinished podcast episode (`EpisodeState::updatedAt`), else the newest album of the history; its button starts it ("#play" routes, the episode through the podcast queue so it resumes). Re-asked when the player's context or track changes (posted from paint). Look: an opaque `bg.raised` card (Mica stays behind it), a linear gradient of the cover's color (`ImageCache::accentOf`, 34 % dark / 22 % light fading out at 78 % of the width, faded in over `motion::slow` once the cover is decoded), a hairline (strong on hover), the cover, the label, the title (`displayS` 40 / 30 / 24, two lines), the subtitle and the accent `PlayButton`; 216 / 176 / 148 DIPs tall at ≥ 720 / ≥ 480 / narrower. An empty profile gets `home::Welcome` in its place: a short invitation and Ara, Spotify ile bağlan (logged out), Yerel dosyalar, Radyo. - **Quick access** (`home::QuickGrid`, `quickItems()`): Liked Songs (logged in, or when it has songs), Spotify's pinned playlists, the newest library recents, then the library's playlists; the hero's own context is left out; fewer than four leaves room for pages (Radyo, Podcastler, Yerel dosyalar, İndirilenler). 4 / 3 / 2 columns at ≥ 880 / ≥ 600 DIPs, two rows (three with two columns); tiles 56 DIPs (Sıkı density 48) with a hairline outline and the artwork flush left; hover: `overlay.hover` + a 28 DIP accent play button; the playing collection shows the equalizer; Enter opens, Shift+Enter plays. - **Shelves** (`home::Shelf`, `home::addShelf` / `shelfRow`): one row of the shared cards (`MediaCard`, the smart lists' card), so their own hover / press styles apply. Every shelf of the page uses `home::cardWidth()`: as many columns of ≥ 160 DIPs (Sıkı 140) as fit, at least two, so they line up. The track reaches 40 DIPs (`kBleed`) into the page's gutters: cards that scroll out fade there (`Canvas::pushFade`, only where there is more, so cards inside the page stay whole; Mica-safe), the previous / next card peeks in. Scrolling: horizontal wheel / touchpad swipe or Shift + wheel through `SmoothScroll` (3.28; a plain wheel scrolls the page), the round 36 DIP arrows on the page edges that appear while the pointer is over the shelf and there is more that way (a page of whole cards per click, landing on a column), and keyboard focus (`revealRect`). After a glide the hover is refreshed. `smart::addSection(c, makeRow)` and `addNewReleasesShelf(c, makeRow)` take the row factory so those sections become shelves. - **Dev**: `SHADETUBE_SPOTIFY_DEMO` with a `home.json` (Spotify's raw home answer, `tests/spotify/fixtures`) also gives the logged-out Home the personalized shelves; `SHADETUBE_HOME_DEMO` (5.4) scrolls the page / a shelf for screenshots. ### 3.35 Theme studio (presets, custom themes, accent, corners, UI font) `gfx/ThemeSpec` (themes as data, standalone), `app/ThemeStore` (built-in + the user's themes, standalone), `app/ThemeStudio` (selection, live switching, files), `app/ThemeStudioUi` (Ayarlar › Görünüm rows and dialogs). - **Theme files** (`"$schema": "shadetube-theme/1"`, `gfx/ThemeSpec.h`): `name`, `base` (`dark` / `light`), `keys` (the five key colors: `background`, `surface`, `text`, `outline`, `accent`) and `color` / `effects` in the tokens' paths (`color.bg.raised`, `color.hairline.default`, `effects.menuShadow`...). What a file leaves out comes from the default theme of its base; `keys` derive a whole palette (`derivePalette`: surfaces stepped towards the text color, secondary / tertiary text mixed towards the background but kept ≥ 4.5:1 / ≥ 3:1, hairlines and overlays as the tokens' alphas of outline / text, scrims of the background; status colors and shadows from the base), `color` entries override single values. A tokens file reads the same way. `serializeTheme` writes everything (keys, every palette color, shadows) in a stable order. - **Presets**: `tokens/tokens.dark.json` (`dark`, "Koyu") and `tokens/tokens.light.json` (`light`, "Açık") plus `assets/themes/<id>.json`, each a full hand-tuned palette: `amoled` (true black), `nord` ("Kuzey", Nord's arctic blue-greys, frost accent), `sepia` ("Sepya", warm brown, parchment text, amber), `graphite` ("Grafit", dim grey with high-contrast text and stronger hairlines), `pastel` (light lavender paper, plum ink, violet), `snow` ("Kar", Nord's Snow Storm). The list and order are `builtinThemes()` (`ThemeStore.cpp`); display names are translated in `themes::displayName`. Every preset passes `contrastReport()` (`theme_test` prints the table): fg.primary ≥ 7:1 on bg.base / raised and ≥ 4.5:1 on overlay / elevated, secondary ≥ 4.5:1, tertiary ≥ 3:1, fg.inverse on fg.primary ≥ 4.5:1, the adapted accent ≥ 3:1 on base / raised with onAccent ≥ 4.5:1, error / warning / success ≥ 3:1. - **Which theme**: `Settings.themeDark` / `themeLight` (ids; default `dark` / `light`) are used by the mode (Koyu / Açık / Sistem, `Settings.theme`, unchanged). The gallery (two groups of preview tiles: a mini mock of sidebar, card, accent play button and player bar in the theme's colors with the current accent setting) picks the slot of the tile's kind; in Koyu / Açık a tile of the other kind also switches the mode, in Sistem only the slot changes (a toast says when Windows is in the other mode). Right click / Shift+F10 / the menu key: Kullan, Düzenle (custom), Kopyala ve düzenle, Dışa aktar…, Sil (custom); arrows move between tiles, a double click edits a custom theme. The command palette lists every theme ("Tema: Kuzey"). - **Live switching**: every change goes through `ctx().applyTheme` → `App::applyTheme()`: `themes::applyFor(light)` puts the mode's theme into `gfx::Theme` when it is not there yet (`Theme::apply(spec)`: palette, light / dark, its default accent; the requested accent is re-derived), and whenever `Theme::generation()` moved (palette, corners, font) every window gets `applyWindowTheme` (DWM dark mode, border / caption color from bg.base), a `relayoutAll()` and a repaint, the mini player too, and the tray menus follow light / dark. Mica's tint is `bg.base` of the theme at 55 % / 50 % (`Palette::bgBackdrop`). Album / artist / playlist placeholders are drawn from the palette in every theme except the default dark one, whose SVGs bake its colors. - **Accent source** (`Settings.accentMode`): Kapaktan (`Dynamic`, the cover as before), Temadan (`Theme`, new: the theme's own accent, whatever plays; `App::syncAccent` resets to it) and Sabit (`Fixed`, `Settings.fixedAccent`). The fixed row offers five suggestions and a hue-ring swatch that opens the picker (saturation / value area, hue strip, hex field, eight suggestions; arrows move the area / strip, Shift for 10 steps); picking previews live on the whole app (`Theme::setAccent` without fade) and *Vazgeç* / Esc / a click outside restores it. Contrast (`Theme::adaptAccent`): a light theme darkens an accent below 3:1 against its bg.base (as before), a dark theme now lightens one that is too dark the same way; `onAccent` is ink or paper, whichever contrasts more (it was paper below luminance 0.35, which put light text on coral or on the darkened light-theme volt at under 3:1). - **Custom themes**: "Kopyala ve düzenle" (or the + tile, or editing a preset) opens the editor on a copy named "<name> (kopya)": name field, the five keys (one selected, edited with the picker on the right) and the text contrast. Each change is `setKey()` (only the palette entries the key drives are re-derived; status colors, shadows and the rest stay) and `themes::preview()`: the theme replaces its mode's theme on screen (a light theme edited in dark mode flips the screen through the run's theme override) until *Kaydet* or *Vazgeç*. Saving needs `readable()` (fg.primary ≥ 4.5:1 on bg.base and bg.raised, fg.secondary ≥ 3:1 on bg.base). Saved themes are `themes\<slug>.json` in the user data folder (id `user:<slug>`, numbered when taken; write-then-rename) and become their mode's theme. - **Import / export** (*Tema dosyası* row; dialogs posted): import reads at most 256 KB and parses strictly (not JSON, another `$schema`, no colors, a malformed color anywhere, a bad base, unreadable text → refused with a one-line toast, nothing written; details in the log), saves it as a new custom theme (" (2)" on a taken name) and selects it. Export writes the theme on screen with its display name. **A broken file never bricks the UI**: files in `themes\` that fail the strict parse are left out (logged); a chosen theme that is gone or broken falls back to the mode's default (saved) with a toast once the window is up; built-in presets parse leniently. - **Corners** (`Settings.cornerStyle`: `sharp` / `default` / `round`): `gfx::radii()` (`Theme::setCornerStyle`, bumps the generation). Default = the tokens' `radius.*` (`surface`, `art`, `badge`, `tooltip`, `menu`, `dialog`, `toast`, `field`, `scrollbarThumb`; `art` and `field` are new tokens), Sharp = 0, Round = 8 / 6 / 4 / 6 / 8 / 12 / 8 / 6 / 3. Pills and circles never change. `metrics::radiusSurface` is now a reference to the live `radii().surface`. The shared widgets and pages (cards, rows, covers, skeletons, badges, menus, dialogs, toasts, tooltips, fields, the scrollbar, the focus ring of a Rect) read `gfx::radii()`, and so does Now Playing (covers `art`, skeleton bars `badge`, the time tip `tooltip`); the full-screen lyrics, the mini player and Home keep their own literals. - **UI font** (`Settings.uiFont`: "" = the bundled Bricolage Grotesque): the font dialog lists the bundled font, Segoe UI Variable (Segoe UI on Windows 10) and every installed family usable for text (`Fonts::installedFamilies()`: no symbol fonts, Latin letters present; enumerated once when the dialog first opens: 74 of 80 families in 16 ms on the development machine, logged), each name in its own font (only visible rows are shaped), with a search box; a click applies live, *Vazgeç* goes back. `Fonts::setUiFamily()` swaps the non-mono family, clears the format cache and bumps `Fonts::generation()`, which every `gfx::Text` compares before using its cached layout; `Theme::touch()` makes the baked bitmaps (Now Playing, lyrics) rebuild. A family that is not installed keeps the bundled font (a toast at startup); JetBrains Mono is never replaced. - **Dev**: `SHADETUBE_THEME_PRESET=<id>` (this run's theme, not saved), `SHADETUBE_THEME_DEMO` (live changes on a timer), `SHADETUBE_THEME_DIALOG` (opens the accent / font picker or the editor), `SHADETUBE_THEME_IMPORT` (imports a file), see 5.4. `theme_test` (5.2) covers parsing, the presets' contrast, import validation and the theme folder. ### 3.36 Menus, dialogs, toasts and tooltips (the overlay family) Everything that floats above the page shares one surface and one motion: `ui/Popups` (context and dropdown menus, toasts, dialogs), the command palette (`app/CommandPalette`) and the Window's tooltips; the mini player's toast and the zoom badge use the same surface without the backdrop. - **Where they live**: every app menu, dialog, toast and tooltip is an in-window overlay (`Window::pushOverlay`, painted above the tree; modal ones trap input and focus, 3.3). No app menu has a popup HWND of its own. Two native Win32 menus stay native: the tray icon's menu (`Tray::showMenu`, `TrackPopupMenuEx`) and the window's system menu (title-bar right click, Alt+Space). Windows draws those (dark or light through `SetPreferredAppMode`, `Tray::setDarkMenus`, its own animation setting), so they keep the OS look, accessibility and keyboard behavior. The mini player is a separate `ui::Window`: its tooltips are the family's, and `MiniView` paints its toast on the opaque surface (no backdrop capture in that small window). - **Surface** (`ui/Acrylic`, `paintOverlaySurface()`): the tokens' radius (`overlay::radius()` = `metrics::radiusSurface`), a 1 px `hairline.strong` outline and a two-layer shadow: a tight contact shadow (blur 3-6, y 1-2) under the tokens' elevation shadow (`menuShadow` / `toastShadow` / `dialogShadow` at 75-80 % and a little closer). Surface colors: menus `bg.overlay`, dialogs and the palette `bg.raised`, toasts and tooltips `bg.elevated`. - **Acrylic material**: right before an open overlay paints, the Window calls `OverlayLayer::prepareBackdrop()` with nothing pushed on the canvas. `Acrylic::capture()` copies what is painted so far under the surfaces plus a 40 DIP margin (`CopyFromRenderTarget`: the back buffer, or the PNG target of `--screenshot`), blurs it (Gaussian, tokens `backdropBlur` radius 40 DIP, hard borders) through a color matrix into a half-resolution bitmap of the same DIP size. The matrix is the contrast guard: it compresses the backdrop's luma towards the surface color's (kept 15 % dark / 20 % light) and keeps part of its chroma around it (60 % / 85 %, hue unchanged). It is linear, so nothing clips (a luminosity blend turned saturated colors into cyan / magenta blotches on paper). Painting: `bg.base` (opaque, so a Mica window never shows through), the bitmap, the surface color at 52 % (dark) / 55 % (light), then the noise (`textures/noise-tile.png` made signed: pixels above mid-grey lighten, below darken, at most 5 %, 80 % / 50 % opacity, one tile pixel per device pixel). Worst cases (a white area behind a dark menu, a black one behind a light one) keep `fg.secondary` at about 5:1 or more; over ordinary content the surface stays within a level or two of its opaque color, with the colors behind showing as soft glows. - **Never per frame**: a capture is reused while the overlay is open. It is redone only when the surfaces leave the captured area (a submenu opening beside its menu, a taller toast stack), the theme (`Theme::generation()`), the DPI / zoom or the device changed, or something under it asked for a repaint: the Window records each `invalidate()` of a widget of the tree at the widget's window rect (+ 24 DIP for shadows), a layout of the tree, a resize, zoom or theme switch for the whole window (`contentGeneration()`, `lastChangeIn(since, area)`; not overlays, not animation frames). Only a change touching the captured area counts: a player bar ticking under the page while a menu is open never recaptures it (measured: 5 recaptures in 5 s while playing before this rule, none after). The material then waits until that area has been quiet for 150 ms (a hover fading, a list settling), at the latest 1 s after the last capture. The effects are created per capture and dropped. - **Opaque fallback**: with Windows' transparency effects off (`Personalize\EnableTransparency`), in high contrast (both re-read at most once a second) or when a capture fails (logged once), the surface is the plain surface color, the look before acrylic. `SHADETUBE_ACRYLIC=force|off` overrides the system check (5.4). - **Memory** (3.2): a material holds one bitmap covering its surfaces plus the 40 DIP margin at half the window's pixel resolution (a track menu at 175 %: about 0.3-0.5 MB), plus the shared 256 KB noise tile. It goes when its overlay is deleted after the exit animation, the toast layer's when its last toast has left, the tooltip's when it has faded out, the noise tile with the last material, and everything on a device release (release hooks). `Acrylic::liveBytes()` counts them. - **Motion** (`overlay::duration()`: 0 with *Hareketi azalt* or when Windows' animation effects are off, `SPI_GETCLIENTAREAANIMATION`, read whenever an animation starts): menus open in 150 ms (fade + scale 0.96 → 1 from the corner at the anchor, decelerate) and close in 100 ms (fade + 0.98, accelerate); a submenu slides 8 DIP out of its parent (140 ms) and fades out (90 ms); the hover highlight glides between items (120 ms). Dialogs and the palette: the scrim fades while the panel fades in, rises 8 DIP and grows from 0.98 (240 ms); closing fades both and drops the panel 6 DIP (140 ms). Toasts slide in (24 DIP up + fade, 240 ms), slide out (fade + 12 DIP down, 180 ms) and the others glide to their new places (220 ms). Tooltips: 400 ms delay (60 ms when moving along a row of buttons within 300 ms of the last tooltip), fade + 4 DIP rise in 120 ms, fade out in 90 ms. The zoom badge and the mini player's toast follow the same switch. - **Exit animations** (`OverlayLayer::exiting()`): `removeOverlay()` takes an overlay out of input, focus and modality at once (keyboard focus is back on the opener, the next click reaches the page, `hasModal()` is false) and keeps painting it, with no `window()`, above the open overlays (so no capture ever contains it) until its animation ends; the next frame deletes it. - **Menus** (`Menu`; the public API is unchanged, `open()` now returns the menu): spec geometry (items 34, padY 6, padX 12), width from the content (240-360 DIP), an icon column whenever any item has an icon, `MenuItem::shortcut` hints right-aligned (mono 11, `fg.tertiary`), a trailing column for the check mark (accent) and the submenu chevron, separators tidied (none first, last or doubled), disabled items `fg.disabled` and never highlighted. Submenus: `MenuItem::submenu` builds the items when it opens (a trailing "…" of the label is dropped for the chevron); the pointer opens it after resting 200 ms on the item and closes it after resting 300 ms on another item of the parent; the parent item stays lit. Keys as before (Up / Down / Tab wrap over enabled items, Home / End / PageUp / PageDown, Enter / Space, Escape; Tab never leaves the menu), plus Right / Enter / Space open a submenu with its first item lit, Left / Escape close only the submenu, and type-ahead: letters jump to the next item starting with them (invariant locale, case and accents ignored, so "s" and "ş" both find "Şarkı radyosu"; 800 ms between letters starts a new word; the same letter again cycles). In the app: the track menu's *Çalma listesine ekle*, *Klasöre indir* and *Sanatçıyı engelle* (several artists) and the Yerel dosyalar folder menu's *Çalma listesine ekle* are submenus (they used to replace the menu with a second one at the same spot); the track menu shows the `like` key (`commands::shortcutHint()`) on the playing song's like item. - **Long menus** (0.13.0): a panel is at most the window's height minus 8 DIP at each edge (the root menu opens below its anchor, else above it, else on the side with more room, else covering the window; a submenu slides up to stay inside). What doesn't fit scrolls with the shared smooth-scroll engine (3.28): the wheel over a panel scrolls that panel, the keyboard (arrows, Home / End, type-ahead) glides the lit item into view, the highlight follows a resting pointer, and a slim thumb (3 DIP, `fg.tertiary` at 45 %) at the right edge shows where the list is. Items outside the view are clipped, never painted over the padding. Nothing is cut off any more: *Çalma listesine ekle* lists every playlist (it used to keep as many as fit in the window and drop the rest silently). - **Filter field**: a menu opened as filterable (`Menu::open(..., filterable = true)`, or `MenuItem::filterable` on the item that opens a submenu) with more than `Menu::kFilterAt` (10) entries gets a search-look `TextBox` ("Ara") on top that takes the keyboard focus when the panel opens. Typing narrows the list to the items whose label contains the text (invariant locale, case and accents ignored, `FindNLSStringEx`), separators go, `MenuItem::pinned` items stay (*Yeni çalma listesi…*), the first real match is lit and Enter runs it; "Sonuç yok" when nothing matches. Up / Down move through the matches; characters, Space, Home / End and the editing keys stay with the field; Escape closes the panel (only the submenu, the focus going back to its parent). The panel keeps its size while filtering. In the app: *Çalma listesine ekle* (the track menu's submenu, the Yerel dosyalar menu's, the menu of the collection, smart list and Blend pages' button, song recognition). - **Toasts**: up to three, the newest at the bottom; a fourth sends the oldest out (animated). The text wraps to three lines and the toast grows (min 56 DIP). - **Tooltips** are painted in `--screenshot` captures too (`SHADETUBE_HOVER_AT`). - **Checks**: `popups_test` (5.2); `SHADETUBE_OVERLAY_DEMO` (5.4) opens menus, submenus (by key), dialogs, toasts and the palette for `--screenshot`, and its `stats` step logs the captures made and the bytes held. - **Anatomy** (written down by the 0.11.0 polish pass of the chrome; a new overlay follows it): - *Dialog* (`ui::Dialog`): 480 DIP wide (forms with a picture or a list 520-680, the share card 1040), padding 28; title `type::title` (22/700, fg.primary); the body line 10 below (`bodyRegular`, fg.secondary); the content 20 below (a Column, 8 apart); the footer 28 below: 40 DIP buttons, at least 88 wide, 8 apart, right-aligned in this order: the dismissal (Ghost *Vazgeç* / *Kapat*), then the action (Primary; a destructive one is a Secondary with `Button::setDestructive`: the error color's outline and label, as menus color destructive items; `Dialog::confirm(..., destructive)` does it). One Primary at most; Enter presses it, Esc and the scrim cancel. Enter never presses a destructive button: a destructive confirm's Enter dismisses it (the Ghost button), with and without the focus ring, and destroying takes a click or Tab to the button and Enter (0.13.0; before, Enter pressed *Sil* unless the focus ring was showing, and then the focused first button, the dismissal). `addLeadingButton` puts an alternative route to the same goal (*Dosyadan…*, *Otomatik seçime dön*, *Video gösterme*) or a side destructive action (the theme editor's *Sil*) at the footer's left end (a Ghost's label on the text column); it is never the Enter default. A dialog with one field lets its title name it (a placeholder only); with two or more each field gets a `caption` label in fg.secondary above it (Ad, Açıklama, the tag editor, Last.fm's user and key). Focus starts on the first field, else the default button (`OverlayLayer::initialFocus`; the dismissal of a destructive confirm); Tab cycles inside. - *Menu*: as above (items 34, padX 12, icon column 16 + 10). Action items carry an icon; a radio group (the open catalog, speed, sleep timer) may go without and lets the check mark speak. The hint column shows the key wherever the action has one, also the keys of the list the menu came from (the queue's row menu: *Şimdi çal* Enter, *Sıradan kaldır* Delete; video mode's menu: its two actions' keys); a row without a hint keeps that room for its label (it used to be cut at 360 DIP by another row's hint). Destructive items are `status.error`, last in their group, and confirm through `Dialog::confirm(..., true)`. - *Toast*: 360 wide, at least 56 high, padX 16; the 16 DIP status icon (info in the accent, success, warning, error) 12 before the text (13/500, up to three lines); the action as accent text on the right; the 2 px accent progress line. - *Tooltip*: 28 high, padX 10, `caption` in fg.primary. `"Label\tHint"` adds the hint after the label in the menus' hint style; `commands::keyTip(label, action)` makes `"Label\t@action"`, which the Window resolves when the tooltip shows (`ui::Window::setTooltipHintResolver`, installed by App: the current binding, so a rebound key is right at once; none = the label alone). Every chrome icon button whose action has a key names it: the player bar, Now Playing, the mini player (its mode button names the next mode's key), the title bar's Geri / İleri / friend activity, the full-screen lyrics' timing buttons; *Kapat* of the full-screen lyrics and the year in review says Esc. A painted link whose text is on screen ("Yanlış eşleşme?", "Yanlış sözler mi?") gets no tooltip. - *Focus*: the Window's 2 px accent ring only (3.3); its shape follows the control (pill buttons, circles, the queue's cursor row, a painted link's proxy rect). Tab order follows reading order: Now Playing goes title bar → heart → "Yanlış eşleşme?" → seek → transport → utilities → tabs → toolbar → "Yanlış sözler mi?" (the heart and the link used to come after the utility row). - **Motion, uniform**: overlays and panels open in 240 ms (decelerate: fade + 8 DIP rise, side panels a 16 DIP slide) and close in 140 ms (accelerate); menus 150 / 100, toasts 240 / 180, tooltips 120 / 90 as above. All of it goes through `overlay::duration`, so Hareketi azalt and Windows' animation effects switch it off. The full-screen lyrics and the year-in-review story now do too (they opened on the plain motion token, ignoring Windows' setting, and vanished at once; now they fade out as `OverlayLayer::exiting()` overlays). Chrome hover / press / active fades go through `motion::microMs` (3.32): sidebar rows, the "Daha fazla" header, the sidebar edge, the account chip, the Settings card headers, shortcut rows, credits and lyrics picker rows, the video view and window. ### 3.37 Share cards: lyrics cards and the year in review `app/ShareCard` (painting and export, shared), `app/LyricsShare` (the lyrics card and its dialog), `app/YearReview` (standalone, pure: the year's numbers; `review_test`) and `app/YearReviewView` (the story view, the Stats page banner, the palette command, the dev hooks). - **Cards**: a card is a `share::Painter` that fills whatever rect it gets with everything sized in card units (360 on the short edge), so one function draws the live preview at any window size / interface scale and the export. The export (`share::render`) paints into an offscreen `ID2D1Bitmap1` on the resource context at `kExportScale` (3 px a unit: 1080 × 1080, 1080 × 1920, 1920 × 1080), opaque, and reads it back. Cards use fixed inks (`share::Ink`: the tokens' dark / light ground and fg roles, off-white on colored grounds), never the app theme, so a card looks the same whichever theme made it. `share::CardContext` requests covers from `gfx::ImageCache` at the export's pixel size (preview and export share the bitmaps), keeps text layouts across paints and counts what was not ready. - **Cover colors** (`share::Palette`): the vivid accent `ImageCache` extracts while decoding, a second hue (the most saturated pixels ≥ 40° away from it, else a neighbouring hue) and the deep tone (the darkest quarter), read back from a 16 × 16 downscale of the cover once per image (posted, outside any BeginDraw). `deepen()` turns them into legible grounds for off-white text (lightness pulled down, saturation capped, a dark yellow leaned towards amber instead of olive); `lift()` makes the accent bright enough for numbers and rules. The blurred cover ground is baked at a quarter of the pixels (a few sizes cached, released with the device). - **Export** (`share::exportCard`, posted, never inside the click): images or palettes still missing are waited for (a thread timer every 100 ms, at most ~3 s, then the card goes out with placeholders). *Copy* puts a bottom-up 32-bit `CF_DIB` (Windows adds `CF_BITMAP` / `CF_DIBV5`) and the registered `PNG` format (24-bit, what browsers, Discord and WhatsApp paste) on the clipboard; *Save* asks with an `IFileSaveDialog` (Pictures, "Artist - Title" / "ShadeTube 2025 - Özet") and writes through a flushed `.tmp`; the toast offers "Dosyayı göster". - **Lyrics card** ("Sözleri paylaş": a share button rightmost in Now Playing's lyrics header and in the full-screen lyrics' top controls, for synced and unsynced lyrics; the views only call `openLyricsShare(lyrics, activeLine, translation)`): a dialog with the lines on the left and a live preview on the right. Selection: 1-6 consecutive lines (a click starts a new selection, a neighbour extends it, an end line shrinks it, Shift+click selects a range; instrumental gaps are not selectable and break a range; going past 6 flashes the counter), keyboard Up / Down, Space / Enter, Shift; it starts on the sung line and the next. Options: ground *Renk geçişi* (the cover's colors as a diagonal gradient), *Bulanık kapak*, *Koyu*, *Açık*; *Kare* / *Hikâye* (9:16) / *Geniş* (16:9, the cover large on the left); *Sola* / *Ortaya*; *Çeviri* (only when the view shows a translation: the translated line under each line, smaller). The lines take the largest size that fits between the header (cover, title, artist) and the ShadeTube mark (the logo with the card's accent + the wordmark; binary search on half units). The choices are kept for the session. - **Year in review** ("Yılın özeti", `review::build`): one local calendar year or the last 12 months (the 12 calendar months ending with the current one) of `ListenStats` (this PC's plays and the imported history), ListenStats' rules (time counts every play, everything else streams; its song / artist / album groups). It yields the minutes, streams, active days, distinct songs / artists / albums, top 5s (and the top 50 songs), months, weekdays, hours (a play split across the hours it spans) and dayparts, 7-day blocks, the longest streak (the earliest), the busiest day, discoveries (songs / artists whose first stream ever is in the period, the most streamed new artist) and the first stream, all on the local clock. Genres are used only when known: an artist's first three tags (the MusicBrainz tags the Stats page's picture lookups carry, `statsArtistGenres`) share its streams; shown when those artists hold ≥ 25 % of the streams and name ≥ 3 genres. A period qualifies with ≥ 30 streams (`review::available`, one pass without clock calls). Timing (`review_test`, 300 000 plays, Debug): `available` ~35 ms, `build` ~55 ms. - **Story view** (`review::open(year)`; a modal overlay over the whole window, opaque): cards Giriş (the year, a cover mosaic), Dinlediğin süre (count-up minutes, active days / streams / songs / artists, a tick per week), Şarkılar, Sanatçılar, Albümler (≥ 2), Türler (only with genres), Ne zaman dinledin (months, hours, the daypart), Seri (streak, busiest day, favorite weekday), Keşifler (when there were any) and Özet, which stays. Each runs 5.5-8.5 s under a segmented progress bar; a click on the card's left third goes back, elsewhere forward; ←/→, PageUp / PageDown, Home / End, Space pauses (the reveal still finishes; only the progress stops), Esc closes; the period picker lists every qualifying period. Motion: numbers count up, rows and bars come in staggered, cards cross-fade (`motion::slow`), the ground's glow drifts in; with *Hareketi azalt* or Windows' "Animation effects" off (`SPI_GETCLIENTAREAANIMATION`) everything is drawn final and cards switch instantly. Frames: every one while something moves (the first ~3.4 s of a card), then ~25 / s for the progress bar only, none while paused at rest. The ground is the card's cover palette (a different pairing per card); the window around it is the theme's ground washed with that color. Covers for imported songs / albums and artist pictures come through `enrichStatsArtwork` (the Stats page's caches and lookups); an album without one takes a top song's cover. *Görseli kopyala* / *Kaydet…* export the current card at 1080 × 1920; *En çok dinlediklerini çal* plays the smart list "<year> en iyileri" when it exists (3.20), else the period's top 50 minus the blocklist (context `review:<year>`); *Liste olarak kaydet* goes through `promptNewPlaylist`. - **Entry points**: a banner on the Stats page under the period bar (the selected year in *Yıl özeti*, elsewhere the current year when it qualifies, else the last 12 months, else the newest year; nothing when none qualifies) and the palette command "Yılın özeti hikâyesi". ### 3.38 Collapsing page headers `app/CollapsingHeader` (the widgets) on `app/HeaderCollapse` (the geometry; standalone, tested by `header_collapse_test`). Album, playlist, Liked Songs, smart list, podcast show and artist pages. - **What collapses**: as the page scrolls, its header settles into a compact sticky bar (64 DIP): the 232 DIP cover shrinks into the bar's 40 DIP thumbnail (same corner, x 48 / y 12), the title scales down beside it and settles on the bar's center line, and a track list's column header docks under the bar (92 DIP with it; the old CollectionPage pinned bar with its own fade `Anim` is gone). Everything else in the header (mono label, description, owner line, action row, sort / filter) dissolves into the bar: a `Canvas::pushFade` mask over the header widget, transparent above `maskTop` and opaque 40 DIP lower; at rest the band lies above the topmost content, then it moves down to 8 DIP above the bar's line. The bar has its own play (`PlayButton::Look::Outline`) and shuffle (`IconOutline`, `shuffle`), which come in while the header's buttons dissolve and mirror their handlers and playing state (the header's play now shows pause too while the page's collection plays). Lists without a column header (podcast, artist) get a hairline under the bar once they dock. Podcast bars have no shuffle (artist bars have one since 3.44). - **Driven by the offset**: `collapse::compute(spec, s)` is a pure function of the ScrollView's offset of the frame (`scrollY()`, advanced to the frame time by the smooth-scroll engine, 3.28): no timers, no relayout while scrolling, the same frame for the same offset whichever way the page goes. Pinned elements settle with `collapse::soft()`: they move with the content until 12 DIP from their place, then approach it exponentially (position and speed continuous, never ahead of the content). The cover's top and bottom edges are each pinned to the bar's slot, so it shrinks exactly as fast as the content below it comes up. The title's center rides with the content to the bar's line while it scales (smoothstep of the way travelled) and cross-fades into a one-line layout of the same style: a one-line title that fits is the same layout (no cross-fade), one that gets an ellipsis fades under it, a two-line title fades out before the one-line one fades in (never a double outline). `ScrollView::topInset` is what the bar covers (`min(offset, bar height)`), so keyboard reveal, PageUp / PageDown and drag autoscroll stay below it. - **Structure**: `HeroHeader` is the base of the headers (`DetailHeader`, `SmartHeader`, `ShowHeader`, `ArtistHero`): it lays out its texts in `layout()` (`titleBox_`, `titleSize_`, `contentTop_`: header-local at offset 0) and paints everything but the cover and the title in `paintContent()`. `ScrollPage::enableCollapse()` (constructor) adds a `CollapseBar` above the ScrollView; `attachHeader(header, dock, columns)` after every build (`resetContent()` detaches it). Per frame `ScrollPage::paint` calls `CollapseBar::paintBackdrop` before the content (evaluates the frame, places the cover and the buttons, sets `topInset`, paints the backdrop); the bar then paints as the page's last child: the docked surface, the cover, the title, the buttons. Wheel input over the bar scrolls the page; the bar takes clicks only where the content under it is invisible (the dissolved band, the docked bar), never on the scrollbar. - **The cover** is a widget (`HeaderCover`, a child of the bar) whose rect at offset 0 is the header's cover slot (232 DIP at the header's top-left). It is drawn at the slot's size under a scale transform, so an image keeps the bitmap bucket it was loaded at (no reload, no placeholder flash while it shrinks) and the Liked Songs tile and the smart lists' generated covers scale as a whole. An editable playlist's cover and title still open "Ayrıntıları düzenle" (hover: the edit overlay). `findHeaderCover(page)` finds it (nullptr while the content loads and on artist pages). - **Page transitions** (3.31): `Page::coverSlot` of the album / playlist / Liked Songs, smart list and podcast show pages is `ScrollPage::headerCoverSlot` → `CollapseBar::coverSlot`: the HeaderCover's rect where it is now (evaluated on demand, also before the page's first paint), as `HeroHeader::sharedCover(owner, rect)` builds it (`pagetx::imageCover`; Liked Songs' tile and the smart lists' generated cover as painters, keys "liked" / "smart:<id>"), with the HeaderCover as the owner: it skips its artwork and shadow while `pagetx::presence()` is 0 and brings the shadow up with it as the cover lands. A card's cover lands on the expanded slot (a page opens at offset 0; scrolling during the hold ends it, as designed). Back from a scrolled page flies the cover from where it is: the shrinking cover or the bar's 40 DIP thumbnail (when that is less than half on screen or its image is not loaded, the plain transition). - **Tint**: the backdrop is a gradient of the cover's color (`ImageCache::fetchAccent`, the extraction behind the dynamic accent; the light theme darkens it with `Theme::adaptAccent`) at 16 % (dark) / 14 % (light) over `bg.base`, cross-faded in over 600 ms when the color arrives after the first paint (until then, and for images without a vivid color, the app's accent). `collapse::wash` weakens it until `fg.primary` keeps 7:1 and `fg.secondary` 4.5:1 on it (or 94 % of what they have on bare paper when that is less). It is anchored to the page's top (420 DIP at rest, as before); its end rides with the content and settles 40 DIP below the docked bar, so the bar carries the color and it fades into the page under it. Liked Songs uses the accent, smart lists their tile tone lifted to 50 % lightness. - **Mica** (3.3): the docked bar replaces the pixels under it with `Canvas::fillSurface()` and repaints the same tint clipped to itself, so it is seamless with the backdrop; the header dissolves through `pushFade`, the artist banner through its own `pushFade` masks as before. - **Artist**: the banner (photo or ring motif) is painted behind the content: its top stays at the page's top, its bottom edge rides the content up into the bar, the photo moves at half the scroll speed (parallax) and fades into the page (gone after 208 DIP, before the bar docks) while its color comes in as the bar's tint. The bar shows the photo as a round 40 DIP avatar (fading in with the title; the 128 px copy the tint was taken from) beside the name. - **Kept working**: keyboard focus (the bar's buttons are Tab stops once they are more than half in; Tab to a dissolved header button scrolls it back into view below `topInset`), selection, drag reorder, "Listede ara" / "Bölümlerde ara" (the content just gets shorter), compact list density (the dock is the table's top), Back / Forward offsets. - **Cost** per frame: one gradient, the header's fade layer (only while the header is on screen and something dissolves), one bitmap (and its shadow while the cover is bigger than the bar's) and one or two text draws; `compute()` is plain arithmetic. `SHADETUBE_SCROLL_DEMO=notch,touch` through the collapse of a playlist (Debug, 120 Hz): 292 frames, median gap 8.3 ms, frame CPU at most 2.9 ms. - Dev: `SHADETUBE_HEADER_SCROLL=<dips>` (5.4) opens such pages scrolled that far (screenshots of any stage). ### 3.39 Mini player modes `app/MiniPlayer` (the window, its widgets and messages) on `app/MiniLayout` (standalone geometry: modes, sizes, anchoring, snapping, square resizing, saved places; `miniplayer_test`). Opened by the player bar's button, Ayarlar, the tray's jump list task, `Ctrl+Shift+M` or a mode key; it hides the main window while it is open. - **Modes** (`mini::Mode`, `Settings.miniMode`, default Wide). **Strip** 380 × 56 DIP: cover 40, title / artist, prev · play 32 · next, a 2 DIP progress line on the bottom edge (accent over `hairline.subtle`; a station: all accent). **Square** 240 DIP (168..480, never more than the work area): the cover alone, full bleed; on hover the `scrim` token plus a `scrimHeavy` gradient towards the bottom fade in (both follow the theme, so the overlay is paper-colored in the light theme), with the window buttons, prev · play 40 · next in the middle, title / artist and the wave seek bar (`ui::Slider::Look::Wave`, with its playhead) at the bottom. **Wide** 520 × 168: cover 136, title / artist, shuffle · prev · play 36 · next · repeat, the time, the heart, the wave seek bar under everything and two lyrics lines. All of them use the player bar's thin outline icons and outline play button (3.29), its track-change slide (`TrackSwap`, `FadingArt`; the square cross-fades its cover in place) and the faint accent wash. - **Lyrics** (Wide only, fetched only while it is on and kept for the track): `lyricsQueryFor` + `lyrics::fetch` on a worker (the track's own `.lrc` / tags, LRCLIB, Spotify; 3.16), on the song's clock (`lyricsClockMs`: SponsorBlock segments and the per-track offset) with Now Playing's 150 ms lookahead. The line being sung (B 15/600, `fg.primary`) over the next one (13, `fg.tertiary`); at a line change the sung line moves up and fades while the next rises into its place, grows into the sung line's style and brightens, and the one after it fades in (`motion::slow`, instant with reduce motion; drawn as geometry, 3.62). Without synced lyrics the album name and a mono note take their place (SENKRON SÖZ YOK, BU ŞARKININ SÖZÜ YOK, SADECE MÜZİK, SÖZLER KAPALI); a podcast episode shows its show there, a station nothing (its song is the title). - **Hover**. The surface is the drag region (`HTCAPTION`), so the pointer over it arrives as `WM_NCMOUSEMOVE`: `MiniPlayer` follows client and non-client moves and leaves (`TME_NONCLIENT`; after a leave a posted check asks whether the pointer is still over the window) as one "pointer inside" state. The hover-only controls (the window buttons mode · Büyüt · Kapat; in the square everything but the cover) fade in with it (`motion::normal` in, `medium` out), also while one of them has keyboard focus (Tab) or the context menu is open. Hidden, they take no clicks (`MiniView::hitTest` returns the surface, so the press drags). - **Switching**: the mode button (the next mode's icon, `mini-strip` / `mini-square` / `mini-wide`), the context menu or the keys. The window keeps its anchor (`mini::anchorFor`): per axis the work area edge it sits at (within the 12 DIP snap margin + 6), else the third of the work area its center is in, so a window in the bottom-right corner grows up and to the left, one at the top edge downwards, one in the middle from its center; then `ui::Window::fitToWorkArea`. Going straight back to the mode it came from without moving the window returns exactly to where that mode was (this run). The size animates over `motion::slow` (320 ms, Standard) in `WM_TIMER` steps (`USER_TIMER_MINIMUM`, ~64 a second): each `SetWindowPos` resizes the swap chain and draws the new size synchronously through `WM_SIZE`. Every mode's layout is a function of the window rect, so the content follows the window; the old mode's content cross-fades into the new one and the new controls come in over the second half. Instant with reduce motion and never while the window is hidden (`show()` re-fits instead). - **Placement** (`Settings.miniPlaces`: mode → `[x, y, w, h]`, the top-left in screen pixels and the size in DIPs): written after a drag, a resize, a switch and on hide / exit; `miniX` / `miniY` keep the last top-left of any mode (what older versions read). Opening: the mode's place, else `miniX` / `miniY`, else the bottom-right corner of the main window's monitor, 12 DIP from the edges; `ui::Window` keeps it on a monitor (one that is gone: the nearest). - **Dragging** anywhere on the surface runs the system move loop; `WM_MOVING` snaps every edge that comes within 20 DIP of the work area's edge inset by 12 DIP, on the monitor under the pointer (edges and corners; dragging on frees it). After the loop, on `WM_DISPLAYCHANGE`, `SPI_SETWORKAREA` and `WM_DPICHANGED` the window goes back inside the work area of the monitor it is mostly on (`ui::Window::fitToWorkArea`, the constructor's placement rule, made public for this). A monitor with another DPI rescales it during the drag (Per-Monitor V2): the DIP size stays. - **Square resizing** has its own grips (corners 14 DIP, edges 5 DIP, resize cursors) instead of `WS_THICKFRAME`, which would bring Aero Snap and lose the square: the side follows the pointer's larger movement outwards, the opposite corner stays; 168..480 DIP and the work area. The side is the square's saved size. - **Mouse**: a double click on the surface returns to the main window (`WM_NCLBUTTONDBLCLK`), a right click opens the context menu, the wheel sets the volume like the player bar's knob (5 % a notch, touchpad deltas in proportion) and shows a small pill (the speaker icon of the level, a level line, the percentage) for a second. - **Context menu**: a native popup menu, like the tray's (it can extend past the 56 DIP strip; dark / light with the app, `Tray::setDarkMenus`): Şerit / Kare / Geniş, Her zaman üstte, Ana pencereye dön, each with the user's key. Right click, the menu key or Shift+F10. - **Keys** (shortcut actions with `kMini`, rebindable in Ayarlar › Klavye): `Ctrl+1` / `Ctrl+2` / `Ctrl+3` Strip / Square / Wide (`mini-strip`, `mini-square`, `mini-wide`; in the main window they open the mini player in that mode, and they may get global keys), `Ctrl+T` always on top (`mini-on-top`, a toast says which), `Ctrl+Shift+M` back to the main window (`mini-player` now also works inside it), and the player's own keys (Space, Ctrl+← / →, ← / →, Shift+← / →, Ctrl+↑ / ↓, Ctrl+M, Ctrl+L, Ctrl+S, Ctrl+R, the speed keys). Tab walks the controls (they show while focused). - **Always on top** (`Settings.miniOnTop`, on by default): `HWND_TOPMOST` / `HWND_NOTOPMOST`, live. Off, the tool window (no taskbar button) can go behind other windows; the tray icon, a second launch or the show-window hotkey bring it back. - **Theme, accent, scale**: palette and accent are read at paint time (live switches; the DWM hairline border is re-applied). It follows "Arayüz ölçeği" (3.25): its DIP sizes are multiplied by it (`WindowOptions::zoom`, re-applied when it is shown after a change). - **Cost**: invalidation-driven like the player bar. Paused: no wake-ups at all. Playing: the wide mode (and the square while its controls show) asks for the flowing wave's `kWaveFrameMs`, else 250 ms; the strip repaints once per pixel of progress (250..1000 ms); the square's bare cover never. Lyrics lines change in that rhythm (with reduce motion the next line's time is scheduled). Measured (Debug build, 2560 × 1440 at 175 %, 240 Hz, a local MP3; frames from the mini player's debug log `N frames in X s`, process CPU over 10 s): paused, every mode: no frames, 0-16 ms of CPU; playing: the square at rest no frames at all, the strip 4 frames a second (~2 % of one core), the wide mode ~32 frames a second plus vsync during each 240 ms lyrics slide (~4-7 %), the square while its controls show ~32 (~4 %). - **Memory** (3.2): the mini player owns no device objects (covers through `ImageCache`, DirectWrite layouts); a hidden mini player never draws or moves, so the idle graphics release works as before. - **Dev**: `--mini` with `SHADETUBE_MINI_MODE` and `SHADETUBE_MINI_DEMO` (5.4) for captures of every mode, the hover look, a frame in the middle of a switch, the volume pill. ### 3.40 Now Playing `app/NowPlaying` (the view), `app/CoverBackdrop` + `app/CoverGradient` (its backdrop, also behind the full-screen lyrics), the queue panel of `app/Shell.cpp` embedded in a tab. Tested by `nowplaying_test` (the backdrop's colors). - **Opening / leaving**: the player bar's cover, lyrics and expand buttons, the `now-playing` shortcut, `--route nowplaying`; Esc, the title bar's "Küçült" or going to any page (`Router::onShow` in App: the links in the view, the track menu, shortcuts) leave it. It cross-fades over the whole window and covers the player bar, which is hidden once it is fully open (the view has its own controls). The title bar is painted over its backdrop (Shell) and gets the clicks there (`setTopInset`: the view's `hitTest` lets that strip through). `activate()` / `deactivate()` bracket everything it holds; the backdrop field, lyrics, details and display-size layouts go when it closes. - **Layout**: *wide* (at least 900 × 520 DIP below the title bar): the track block on the left (44 % of the width, 340-560 DIP), vertically centered: the cover as large as the height leaves after the rows under it, the title (`displayS` 28-42 DIP following the cover, two lines, heart beside it), the artist line, the match line, the seek row, the transport row (40 DIP buttons, play 52), the utility row; the tab column on the right. *Compact* (narrow or short windows, interface zoom): a header (cover 96-200 DIP beside title, artist, match, seek, transport and the utilities on the transport's row when they fit, else below it) above the full-width tab column; lyric sizes 32 / 22. - **Track**: the cover with the CPU-baked shadow (the art's blurred rectangle as an erf profile in a small bitmap, as before) and a `hairline.default` outline. The title opens the album (a station: the Radyo page; an episode: its show); each artist in the artist line opens its page and the album name the album (DirectWrite hit-test ranges, underlined under the pointer); right click on the cover / title / artist line: the track menu (a station's menu). Match line: duration · match %, the smart shuffle badge, "Yanlış eşleşme?" (not for the user's own files); a station: CANLI + codec; an episode: its length. - **Controls**: the player bar's widgets (3.29: wave `Slider`, outline `PlayButton`, the thin icons of 3.43, `Knob`): shuffle (cycling smart shuffle), previous, play, next, repeat; like (a station: favorite; `setHeart` / `pulse`: the micro-interactions' heart pop, as in the bar); sleep timer, speed (episodes, or any speed but 1x), listen together (the session pill when it fits, else the icon; a guest's transport is disabled as in the bar), the visualizer (3.61, after video mode), volume, mini player. State comes from `onTrackChanged()` (App calls it on every player change while the view is visible) and from library / listen-together subscriptions; labels are set only when they change. - **Tabs** (`NowPlayingTabs`, `ButtonKind::Tab` labels: Left / Right move between them): *Şarkı sözleri* (a station: *Canlı yayın*, the titles it announced; none for a podcast episode), *Sıradaki* (`QueuePanel::setEmbedded`: no title row or panel fill, the count and "Kuyruğu kaydet" on the "ŞİMDİ" row) and *Hakkında*. A 2 DIP accent indicator slides between the labels (`motion::medium`), the content fades in. The choice is kept across tracks and openings (an episode falls back to Hakkında); the queue shortcut / command switches to Sıradaki and back while the view is open (`toggleQueueTab`). - **Toolbar**: the open tab's buttons right-aligned on the tab row (on the row below when the tabs leave no room), built from one list in `buildToolbar()`: `{widget, tab (or every tab), shown predicate, gap after}`. Lyrics: Romanizasyon (3.63), Çeviri, timing −, the offset (reset), +, full-screen lyrics, "Sözleri paylaş" (`openLyricsShare`, 3.37). **A feature adds its button with one entry there.** - **Lyrics**: providers, translation, offset, click-to-seek and the 3 s wheel override as in 3.16; "Yanlış sözler mi?" after the header label and "Sözleri ara" under "no lyrics" open the lyrics picker (3.46). A placeholder only after 350 ms of loading (a cached / local file answers before it would flash); arriving lyrics fade in (420 ms), already scrolled to the active line; lines fade out towards the area's edges by their own alpha (no layer). A new sung line grows from the small style into the big one while the previous one shrinks back (3.62). - **Hakkında**: a song shows the track's own album and artist at once; with catalog ids (Spotify URIs, MBIDs) `source::album` and `source::artistPage` run on a worker (Normal priority, once per track, only while the tab is open) and add the album's kind · year, track count · label and the artist's kind · country · start year · genre, ListenBrainz listens (or the disambiguation), up to 8 similar artists as outlined pills; links "Albüme git" / "Sanatçıya git", then the song's credits (3.46). A failure leaves the track's fields and a note; local files have only those (and their credits when MusicBrainz knows the song). An episode: the show, date · length, "Podcast'e git" and the show notes (`paintEpisodeNotes`). A station: logo, country / genres, codec, its website, Radyo. Long content scrolls with the wheel. - **Track change**: `TrackSwap` as in the player bar (the slide 1.6× longer for the bigger block), opacity layers only for those 320 ms and clipped to the track block; `FadingArt` for a cover that arrives later; the backdrop cross-fades its colors (1.2 s); the lyrics fade in as above, the queue updates in place. **Backdrop** (`CoverBackdrop`, the pure part in `CoverGradient`): - **Palette**: once the cover's 128 px thumbnail is in the image cache (its bytes are then on disk), `ImageCache::decodePixels(url, 48)` on a worker and `extractPalette`: a 4-bit histogram over at most 64 × 64 samples, bins weighted by area with a nudge for vivid ones (chroma up to 2.5×), distinct seeds (distance ≥ 0.14, no specks under 0.4 %), two k-means rounds, ordered by area, padded to five with shades. No cover or a failed one: `paletteFrom(accent)`. The last cover's palette is kept, so the full-screen lyrics and a reopened view show it at once. - **Contrast**: `textBand(fg.primary, fg.secondary, bg.base)`: with light text the backdrop stays at or below the luminance where fg.primary keeps 7:1 and fg.secondary 4.5:1 (6 % margin; dark tokens: Y ≤ 0.036), with dark text at or above it (light tokens: Y ≥ 0.637), never stricter than the theme's own bg.base (custom palettes). The palette is fitted into the band in linear light (scaled down, or mixed towards white; 12 % of bg.base mixed in; the ground the darkest / palest, the first blob nearest the limit), so every mix of those colors stays inside it: guaranteed by construction, checked on 7 200 random fields by `nowplaying_test`. Labels in fg.tertiary are lifted towards fg.primary to 3:1 (`labelColor()`, also used by the full-screen lyrics). A live theme switch refits. - **Field**: the ground plus four blobs (0.6-0.8 view heights across, a soft bell weight) on slow Lissajous paths (a cycle in one to two minutes), a weighted mean in linear light, sRGB through a table; one texel per 10 DIP (a 1440 × 780 DIP view: 145 × 79 texels, 45 KB), uploaded with `CopyFromMemory` and stretched with linear filtering; a 64 px grain tile (±2-3 %, one texel per physical pixel; `Settings.grain`) against banding. No effect and no layer. - **Cost**: recomputed 12 times a second only while it drifts: the view painted, playing, not under the full-screen lyrics, and the micro-interactions' gate open (`ui::motion::micro()`: reduce motion off, Windows' animation effects on); about 33 times a second during a 1.2 s color cross-fade; on a resize or theme change; otherwise the bitmap is only drawn. The drift clock stands still meanwhile, so a paused view is static and asks for no frames. The view's frame budget while playing: the wave 25 ms, synced lyrics 50 ms, the drift 83 ms, else the time label 250 ms; the lyrics' follow glide runs at the display's rate while it moves (3.28). - **Measured** (Release, 1440 × 900 DIP window at 175 %, a playing local file with synced lyrics, Lyrics tab, 20 s; 0.9.1 vs now): CPU 25.8 → 12.2 % of one core, GPU 3D engine 50.6 → 22.8 %, private bytes 82.5 → 79.9 MB (commit 82.2 → 77.7 MB, GPU segment 65.2 → 62.2 MB); paused 0.15 % and no frames in both. Queue / Hakkında tab: 32 frames/s, the field 10.7 renders/s at about 0.2 ms each. Reduce motion: the field never re-renders. Dev: `SHADETUBE_NP_TAB` (the first tab), `SHADETUBE_NP_LOG=1` (every 5 s: frames/s, field size, renders/s and their cost). Screenshots: open the view after the playing file started with `SHADETUBE_KEYS_DEMO=2500:action:now-playing`. ### 3.41 Video mode "Video modu" shows the music video of the playing song, silent, slaved to the app's own audio. The audio pipeline is untouched and stays the master (equalizer, normalisation, crossfade, speed, listen together, SponsorBlock); the picture follows whatever the audio does. `app/VideoMode` (controller, painting, commands, settings rows, dev hooks), `app/VideoView` (the surface), `app/VideoWindow` (its own window) on `src/video` (`st_video`) and `youtube/VideoStreams`. Turned on with the player bar's video button (between the lyrics and the sleep timer; songs only, disabled for songs that play from a file or a stand-in source), the same button in Now Playing's utility row (the bar is hidden while Now Playing is open), the `video-mode` action (Ctrl+Shift+V, palette) or `video-window`; turning it on while nothing shows a video opens Now Playing. - **Which video**: the YouTube video the song resolved to (`Player::currentMatch`); when that upload is a still picture or has no picture stream, the artist's official music video, aligned with the song's audio (3.42). Its picture-only stream (`MatchService::videoStream`, picked by `youtube::pickVideoStream`): video-only streams up to `Settings::videoQuality` rows (480 / 720 / 1080, default 720; the smaller side of a portrait video), H.264 / MP4 first (stock Media Foundation decodes it on the GPU everywhere); at the same size up to 30 fps before 60, YouTube's original before a "Super Resolution" upscale, then the bit rate. VP9 / WebM or AV1 / MP4 only when H.264 doesn't reach 480 rows (or the cap) and `video::optionalDecoders()` found the decoder (`MFTEnumEx`; VP9 also needs the WebM byte-stream handler); the muxed itag 18 as the last resort. The URL is probed like the audio's and a refused one starts a new YouTube session (3.9); a URL refused later while playing is fetched anew (twice). The backup servers are not asked for video. - **Still pictures**: Art Tracks (" - Topic" channels) and "(Official) Audio" uploads are one image over the audio. `youtube::looksStatic` tells them by the stream's average bit rate (content length × 8 / duration), before a byte of picture is downloaded: under 200 kbps for 1280 × 720, scaled by the picture's area, floor 45 kbps. Measured 2026-11-23 (720p averages): Art Tracks 26-32 kbps, audio uploads 71-140, a lyric video 334, music videos 438-1058. Those songs look for their official video (3.42); without one, songs without a picture stream this machine decodes and songs that don't stream from YouTube show the cover with "Bu şarkı için video yok" (or why); podcasts and radio have no button. - **Decoding** (`video/VideoDecoder`, thread `st-video-decode`): `audio::ProgressiveBuffer` with a read-ahead window (`setReadAhead`: the download stays 8 s of the stream's peak bit rate, at least 1 MB, ahead of the last read; a paused picture holds the network, a seek moves the window) → `audio::MfByteStream` → MF Source Reader (video stream only) with an `IMFDXGIDeviceManager` on `gfx::Device`'s D3D11 device (made multithread protected) → the decoder decodes with DXVA → each frame is copied on the GPU (`CopySubresourceRegion` inside `ID2D1Multithread`'s lock, so it never lands in the middle of a Direct2D batch) into one of 6 NV12 slot textures and the sample goes back to the decoder at once (holding decoder surfaces could starve its pool). Slots must be render-target capable: Intel refuses a video processor input view on a shader-resource-only NV12 texture. Without DXVA (no video API, buffers in system memory, no input view) the Source Reader's converter delivers RGB32 rows instead. - **Rendering** (`video/VideoPlayer`, UI thread): the frame on screen is converted once with the GPU's video processor (`ID3D11VideoContext::VideoProcessorBlt`: the stream's BT.601 / BT.709 matrix and range → full-range RGB) into one BGRA texture wrapped as an `ID2D1Bitmap1`, which the views draw like any image (multi-sample linear when smaller than the picture, cubic when larger). Chosen over a dedicated swap chain or composition visual: every window already shares the one device, so the picture stays on the GPU end to end, appears in Now Playing and the video window at once, is clipped / letterboxed / overlaid by fading controls with no airspace problems, and the device release and loss rules (3.2) cover it. Conversions happen only when the frame on screen changes, at the start of a view's paint (the other window's frame was flushed by its EndDraw; a slot goes back to the decoder only after its Blt). - **YouTube's fragmented MP4s** (ftyp, moov, sidx, then moof + mdat per ~5 s segment) hit two Media Foundation problems: its MPEG-4 source presents no sample at all of a fragmented track with an edit list (YouTube's moov/trak/edts/elst: 40 ms, the B-frame delay): it read the whole file and reported the end of the stream; and it ignores sidx, so a seek scans every fragment's header, a ranged request each (a seek to 3:00 took over 10 s). `video/Fmp4Index` parses the file's first 64 KB: the init boxes with the edts box renamed `free` (same size, nothing moves), the edit's media time (the decoder subtracts it from frame times) and the segments from sidx. The source opens on a view (`audio::ByteStreamView`: the init boxes from memory, then the file from a segment on); a seek opens a new view on the target's segment (segments start with a key frame) unless the target is in the current segment or less than 2 s ahead, where decoding on is cheaper. Frame times come from the fragments' tfdt (else the segment's start from the index is added). Files without a sidx (local files, WebM) seek through MF. - **A/V sync** (`video/SyncScheduler`, pure, tested with a fake clock): `AudioEngine::clock()` (`Player::clock()`) is the heard position: the track position of the device frame the engine just took (written − padding) minus the audio engine's stream latency (`GetStreamLatency`, one device period when a driver says 0) and the limiter's 5 ms, with its QPC time stamp and rate (the speed; 0 while paused, loading or stalled), extrapolated at most 120 ms. A view's paint takes the clock at its frame's vblank (`ui::frame::now()`) and shows the newest decoded frame with pts ≤ clock + 8 ms; older ones are dropped, one that is not due yet leaves the picture as it is. A clock more than 400 ms off its expected advance (a seek, a SponsorBlock skip, a listen-together correction) seeks the decoder there, aimed ahead by the measured seek latency (150 ms .. 3 s, times the rate); the first frame from there shows at once. A decoder more than 250 ms (× rate) behind skips frames up to the clock (`VideoDecoder::skipUntil`: decoded, not copied); more than 5 s behind with frames on hand, or 3 s ahead, it is seeked; at most every 2 s, never while a seek is on its way. Speed 0.5-3× is just the clock's rate (at 2-3× frames are dropped on a 60 Hz screen); a new item (gapless, crossfade) starts its picture when its audio is heard (`Clock::tag` == `Player::clockTag()`). Views repaint at the next frame's time and at least every 100 ms while the song plays (a stalled clock's restart is no event they hear about). - **Resources**: VideoViews register with video mode. The player (decoder thread, DXVA surface pool, slots, display texture, download) exists only while the mode is on, the song has a video, a view is on screen (it and its parents visible, its window shown and not minimized) and the song's audio already plays (the picture's download never competes with the song's start). Otherwise it is dropped within ~2 s (housekeeping, a view going away), and so it is on the idle graphics release and device loss (its `DeviceHook` / the device generation): the next paint of a view makes a new one at the clock's position. The stream URL stays cached, so showing it again costs one segment. - **Now Playing** (3.40): one `VideoView` child laid over the track block's cover (`artRect_`, wide and compact layouts) and a `video` button after the sleep timer in the utility row. While a picture is on screen (`VideoView::hidesHostArt()`) `paintCover` leaves the cover, its baked shadow and outline out, for the incoming and the outgoing `TrackSwap` layer alike, so nothing slides under the video; the view draws the picture fitted into the cover's square with `radii().art`, the outline around it, on the square's bottom edge next to the title (wide) or centered (compact). Without a picture (loading, none for this song) the cover shows as usual (shadow, outline, track-change slide) with the note as a pill on it. A pop-out button on hover (double click pops out too); a right click goes on to Now Playing's track menu. Closing the view (Küçült, Esc, any page: `deactivate()` posts a sync) drops the picture ~0.5 s later unless the video window shows it; reopening brings it back at the audio's position. - **Overlays over the video** (3.36 overlay family): the views repaint through `Window::invalidateAfter`, which is not a widget `invalidate()`, so a playing picture never makes an open menu / toast / tooltip recapture its acrylic backdrop: the material keeps the blurred frame of its last capture. Measured with a track menu over the playing video in Now Playing (`SHADETUBE_ACRYLIC=force`, 6 s): 6 captures, exactly as many as without video (Now Playing's own drifting backdrop invalidates the area: one capture a second at most); the video adds none. - **Song preview** (3.30): the preview voice adds no runs to the engine's position, and a held main track writes silence runs, so `AudioEngine::clock()` stands still at the held position (rate 0): the picture holds its frame (identical screenshots 2 s apart during a 5.6 s hold), then goes on from there when the song fades back in, with no seek. `keepMainRunning` previews keep the main track's runs, so the picture follows the muted song. - **Video window** (`app/VideoWindow`): resizable (at least 320 × 180), letterboxed on black, rendered by App's loop through `AppContext::extraWindows` (also counted as "on screen" for the idle release), its rect and "always on top" remembered (`Settings::videoX / videoY / videoW / videoH / videoOnTop`). Controls fade 2.5 s after the pointer rests while the song plays (the pointer hides with them in full screen): the song, previous / play-pause / next, video mode's menu, always on top, full screen, close; light ink over gradients in both themes. The picture is the window's caption (the root is a drag region; only the visible buttons are client area), so Windows moves the window and no widget holds a capture through the move loop; a caption double click (`WM_NCLBUTTONDBLCLK`) or F toggles full screen on its monitor (no caption / frame, the monitor's rect, all client area), Esc leaves it, Space and the mini player's shortcuts work, Ctrl+W closes. Turning video mode off closes it. - **Settings** (Ayarlar › Oynatma): Video kalitesi (480p / 720p / 1080p), Resmi müzik videosu (`videoOfficial`, 3.42) and Video modunu hatırla (`rememberVideoMode`; `videoMode` is the state at exit). Listen together: local only, a guest's picture follows its synced audio. - **Menu** (`videomode::showMenu`): the right click on the player bar's and Now Playing's video buttons (Shift+F10 / the menu key too), a "more" button left of the pop-out button on the picture and in the video window's top row: the video window, Resmi müzik videosunu kullan, Yanlış video mu?, Bu videoyu gösterme (3.42), video mode on / off. - **Measured** (2026-11-23, Intel UHD + DXVA, 720p25 H.264 from YouTube, 2355 × 1247 px window): frame vs. heard audio 5-9 ms on average and 8-25 ms at worst in steady playback at 0.5×, 1×, 1.5× and 2× (a frame is 33-40 ms); only the first frame after a slow start or a seek can be up to ~0.2 s late for a moment (the audio resumed before the picture arrived; the next frames catch up); a paused seek shows the target frame. First picture 0.7-3 s after the video starts on the network (opening the source and the first segment; local files ~30 ms), network seeks 0.4-1.9 s. Release: the video window alone (main window minimized) costs about 4-6 % of one core, GPU video decode ~2 %, video processing ~2 %, 3D ~3-5 %; in Now Playing the window repaints at the video's frame times on top of its own 30 fps ticks: 21-36 % of one core against 6 % without video. Memory: the decoder's surface pool and the slots take ~70 MB of GPU memory at 720p (shared system memory on an integrated GPU; slots + display texture 11.4 MB of it), Media Foundation ~25 MB of heap: commit 74 → 209-218 MB in Now Playing, and back when the picture goes. - **Dev**: `SHADETUBE_VIDEO_FILE` plays a local video as every song's picture (a burned-in timecode against the audio), `SHADETUBE_VIDEO_DEMO` scripts the feature (5.4); `video` lines in the log report the sync every 10 s and when a picture is dropped (frames shown / dropped, resyncs, frame vs. audio average / worst, frames more than a frame off, slot memory, DXVA or software). `video_test` (5.2) covers the pure parts and the decoder. ### 3.42 Official music video for audio-only songs Most songs resolve to an Art Track or an audio upload (the matcher prefers them for the sound), whose picture is one still (3.41). For those, video mode plays the picture of the artist's official music video of the same song, silent, against ShadeTube's own audio, after checking by ear that it is the same recording and working out how its timeline relates to the song's. `app/OfficialVideo` (the decision, the picker), `app/OfficialVideoCache` (standalone), `youtube/OfficialVideo` (search, ranking), `video/Soundtrack` and `video/AudioAlign` (pure maths), wired into `app/VideoMode` (`findOfficial`, the time map in `paint` / `openPlayer`). - **When**: video mode is on, the song's own upload turned out a still picture (`looksStatic`) or has no picture stream, and Ayarlar › Oynatma › Resmi müzik videosu (`Settings::videoOfficial`, on by default; also in video mode's menu) is on. The note says "Resmi video sesle eşleştiriliyor…" meanwhile. A song with a stored decision (below) goes to its official video at once, without asking for its own upload's picture stream first. Offline (a song from the song cache, a network failure on either picture stream or the search): the cover with "Çevrimdışı", nothing stored. - **Candidates** (`youtube::findOfficialVideos`): YouTube Music's video search (`music.youtube.com/youtubei/v1/search`, WEB_REMIX, the "Videos" filter, query "<artist> <title>", only that text is sent): every result carries YouTube Music's own label, `MUSIC_VIDEO_TYPE_OMV` (what its Song / Video switch plays) or `_UGC`, and the artist runs. The watch-next panel's direct song → video `counterpart` is not in anonymous responses (checked 2026-11-26), so it is not used. Without a usable result, YouTube's search ("<artist> - <title> official video"). Ranking (`rankOfficialVideos`, pure): the song's core title words (80 %) in the video's title and the primary artist in the artist runs / channel / title, both compared with marks folded (Şımarık = Sımarık = SIMARIK); refused: " - Topic" channels, lyric / audio / visualizer uploads, live, concert, cover, remix, acoustic, unplugged, reactions, karaoke, sped up / slowed, loops, extended, mashups, medleys, teasers, translations, performance / session takes ... unless the catalog title says so itself, and lengths outside [song − max(20 s, 12 %), song + max(3 min, 75 %)]. A non-OMV upload needs the artist's own or a VEVO channel or "Official (Music) Video" in its title. OMV first, then those signals, the length, YouTube's order; the best four. The song's own upload and the user's rejections are left out. - **Soundtracks** (`video::decodeSoundtrack`): the song's and each candidate's smallest Opus stream (`MatchService::soundtrackStream(id, "opus")`, itag 249, ~50 kbps), downloaded whole (~1.1-2.3 MB) and decoded by the engine's own `audio::Decoder` (the built-in Opus path, pre-skip trimmed: the presentation timeline) at the stream's rate, then decimated to 12 kHz mono here (the built-in windowed-sinc resampler cost 8 s against 1 s per song in a Debug build). Measured 2026-11-27: the built-in Opus 249 is sample-identical to Opus 251 and to an Art Track's AAC with its edit list applied (3.4), while an AAC stream without an edit list comes out 36.28 ms late (1600 samples of priming left in, at 44.1 kHz). - **Alignment** (`video::analyzeAudio`, `alignAudio`; the header has the details): 5-band onset envelopes at 100 frames/s (each band at unit deviation, so the kick's regular beat doesn't outweigh voices and hats); 8 s windows every 2 s correlated with every lag of the video (FFT at 40 ms, then the best peaks at 10 ms, parabolic), candidates passed on to neighbouring windows, a dynamic programme choosing one lag or "none" per window (a change of lag costs, so identical repeated choruses keep their own place), runs fitted to lines (an offset, and a speed difference under 0.6 % when it adds up to 25 ms), runs split where they leave their line by 25 ms, ends found to the frame (local correlation, change points), quiet song ends covered. Accepted: ≥ 65 % of the song's sounding part covered, at most 3 holds inside it, the chosen lags leading each window's next best by 0.05 on average (two songs on one beat grid don't), parts in the video's order. The first of the best three candidates that is accepted wins; ~0.5 s per pair in Debug. - **The picture** (`video::TimeMap`): the song's heard position (`AudioEngine::clock`) mapped through the segments before the scheduler (3.41) sees it: video time and rate (the clock's rate × the slope). A step under 0.25 s between neighbouring parts (a micro-edit) plays through (the scheduler drops or repeats a frame). Outside the segments the map holds: rate 0 on the next part's first frame (the decoder seeks there while the cover shows), or after the last part on its end; a part after a jump in the video starts 1.2 s in (the seek's time). An official picture fades over the cover (`State::fade`, 320 ms in / 240 ms out, none with reduced motion): out into a hold and while the decoder is on its way to a new place (`VideoPlayer::waitingForFrame`: after a seek, a SponsorBlock skip, a hold), in once a frame of the right place is there; the host's cover shows under it (`hasPicture` only at full opacity). The video window draws the cover itself under a fading picture. Seeks, SponsorBlock skips, listen-together corrections are clock jumps (mapped, resynced as in 3.41); speed is the clock's rate; a song preview holds the clock and so the picture; a new item (gapless, crossfade) brings its own decision. - **Decisions** (`cache\officialvideos.json`, per catalog track): the video, its segments, the verdict, what was tried (video → verdict) and what the user turned down, for the song's upload it was made against (another upload after "Yanlış eşleşme?" = a new decision). A song is searched and aligned once: the next play shows the video at once. An automatic "none" is searched again after 30 days (7 when nothing was found), a decision of an older alignment version (`OfficialDecision::kVersion`) at once; the user's choices stay. A lookup that failed on the network stores nothing. At exit (video mode's persist hook) the lookups on the pool are cancelled (their requests' token, the soundtrack downloads) and awaited: App destroys the MatchService they use before it joins the pool (a lookup still running at quit crashed there once). - **The user's say** (video mode's menu, 3.41): Resmi müzik videosunu kullan (the setting); Yanlış video mu? (a dialog with the candidates, thumbnails, length and what is known: "SESLE EŞLEŞİYOR", "AYNI KAYIT DEĞİL", "RESMİ VİDEO", "DENENMEDİ"; a pick is aligned first and refused with a toast when it isn't the song's recording; "Video gösterme" stores a manual "none"); Bu videoyu gösterme (rejects the current one and searches again without it). - **Measured** (2026-11-26/27; Art Track's soundtrack against the official video's, offsets against a sample-accurate waveform cross-correlation of 2 s at 12 kHz every 15 s): Rihanna "We Found Love" +51.61 s (a 52 s spoken / cinematic intro), mean 4.1 ms, worst 13.1 ms; Billie Eilish "bad guy" +14.08 s, 0.8 / 0.9 ms; Dua Lipa "New Rules" +9.43 s, 0.2 / 0.4 ms; Queen "Bohemian Rhapsody" +1.80 s, 0.9 / 0.9 ms; Tarkan "Şımarık" (the single) −0.18 s, 4.4 / 5.8 ms; Rick Astley "Never Gonna Give You Up" −1.00 s at slope 0.99746 (the video's transfer runs 0.25 % fast: 0.5 s over the song), 2.0 / 2.9 ms where the waveforms match; Michael Jackson "Billie Jean" +1.02 s, two parts at slopes 1.0022 / 1.0032 meeting in a 5 ms step; The Weeknd "Blinding Lights" +22.61 s, a 20 ms micro-edit, a hold over 118-127.6 s (the video's own sound there; the waveforms match neither line 120-127 s) and +25.20 s after its 2.6 s insert, mean 3-14 ms, worst 20 ms. Declined: Eagles "Hotel California" (only "(Live)" / "(Live 1976)" official videos: refused by the ranking; the 1994 live video's soundtrack also by the alignment), the album edit of "Şımarık" against the single's video (the length window; the alignment: "reordered"), unrelated pairs. In the app (Debug, sandbox): a decision in 3.1-8.6 s (once 38 s: googlevideo throttled one soundtrack URL to ~52 KB/s), the picture vs the mapped clock 5-6 ms on average, worst 18-58 ms (3.41's figures), 1.5× 10 / 32 ms; a hold's seek to the next part 78-109 ms; Billie Jean's micro-edit played through without a resync. Re-measured 2026-11-27 on 0.11.0's decoder (the built-in Opus path): the same offsets and errors on the same songs; a decision in 3.6-5.7 s (soundtracks ~1 s each in Debug). Checked together with (2026-11-27, Debug, sandbox): an Art Track from the song cache (its AAC with an edit list), online (the stored decision at once) and with `SHADETUBE_OFFLINE=1` (the cover, "Çevrimdışı"); a crossfade from "Blinding Lights" into "Billie Jean" and from it into "Bohemian Rhapsody" (each picture starts with its song's audio, the next song's lookup meanwhile); Billie Jean's SponsorBlock segment (289.3 → 294.3 s, a jump past the video's end: resync, then the next song); a song preview held 6.6 s over the video window (identical frames 2 s apart, no resync after it); WASAPI exclusive mode (`SHADETUBE_EXCLUSIVE=1`, 6 ms average, a hold); a `yt:` track of a pasted Art Track link (AAC with an edit list, its official video in 3.6 s). - **Remaining error**: the picture shows the frame of the clock's time, both on the presentation timeline: none from the codecs when the engine plays Opus (the normal case) or AAC with an edit list. When it plays an AAC stream without one, its clock counts the 36 ms of priming as song, and every picture (3.41's too) is 36 ms early. - **Dev**: `SHADETUBE_VIDEO_DEMO` steps `menu=x,y`, `picker`, `reject`, `official=0|1` (5.4); `video` log lines say the candidates, each alignment (verdict, coverage, r, segments) and the decision's time. `video_test official` runs the offline checks (synthetic songs: intros, a 0.3 % speed difference, an insert, a cut, repeated choruses, silence, another song, live takes, a reordered edit; the time map; YouTube Music fixtures and the ranking; the cache), `officiallive <artist> <title> <upload>` the whole lookup on YouTube, `soundtrack <id> <file> [codec]` and `alignraw <a> <b>` the alignment on saved soundtracks with the waveform reference. ### 3.43 Icons One thin outline language for every icon in the app: sidebar, title bar, page headers, menus, track rows, cards, settings, dialogs, toasts, the queue, Now Playing, the mini player, the command palette, the taskbar buttons and the phone remote (which serves `icons/24`). `tools/icons.py` is the source: each icon is a small drawing function, and the tool writes `assets/icons/<grid>/<name>.svg` for the six grids (`--design <dir>` also the design package's `icons/`, `--check` fails when the files differ from the drawings). Edit the drawing, never the SVGs. - **Grids**: 12, 14, 16, 18, 20, 24 px. A file's viewBox is its own grid (`0 0 16 16`), so a unit is a device pixel when the icon is drawn at that size. Each drawing is made on a 24-unit master (2 units of padding, stroke centers between 3 and 21) and scaled to the grid with hinting: stroke centers on pixel centers (x.5), so a 1 px horizontal or vertical stroke covers whole pixels; lengths and radii in whole pixels; filled shapes end on pixel edges; points on an axis of symmetry (a chevron's or a roof's apex, a triangle's tip) are the mean of their snapped neighbours, so the shape stays symmetric. When a grid's center is a pixel edge, a shape with a crisp centre line sits half a pixel right / down. At 12 and 14 px secondary details that would merge are left out (the second sparkle, a wifi arc, keyboard keys). - **Weight and shape**: stroke `max(1, N / 16)` px (1 px up to 16, 1.125 / 1.25 / 1.5 at 18 / 20 / 24: the weight the 0.9.0 player bar had at 24, now everywhere), round caps, round joins. Circles r 9, squares 16 units, container corners r 1.5 (1 px at 16), inner details 0.75; dots (more, list bullets, the i of info) are filled circles with a stroke's radius, on pixel centers when they line up with a stroke, on pixel corners (a crisp 2 × 2) when they stand alone. - **State**: outline = off / neutral, in the foreground color. On = the accent; a state with a body that is *yours* uses the filled glyph: `heart-filled` (liked; the player bar, Now Playing and the mini player too, no longer the 0.9.0 outline over a 32 % tint), `downloaded` (on disk), and the playing indicator is the filled `equalizer` (the rest pose of `ui::paintEqualizer`'s bars). Toggles (shuffle, repeat, lyrics, queue) stay outlines in the accent with their dot. No other icon is filled: `play`, `pause`, `stop`, `next`, `prev`, `queue`, `playlist`, `mini-player`, `sparkle`, `youtube-source` are outlines; the page headers' accent `PlayButton` draws the player bar's outline glyph (3.29). A filled glyph is its outline's path filled *and* stroked, so it covers exactly the outline's silhouette and `HeartPop` swaps them without a size change. Details inside a filled glyph are cut out (even-odd: the check of `downloaded`, the E of `explicit`), never painted white: icons are one-color masks, which lost those details before. - **Drawing** (`gfx::Icons`, `gfx/IconGrid.h`): the grid for `px` device pixels is the smallest one that is at least `px` (drawn at its size or a little smaller, where its hinting holds), then the larger ones, then the smaller ones, so an icon that only has 16 / 20 / 24 files (one added elsewhere) still draws. Below its own size a grid keeps every stroke at least a device pixel (`keepStrokeFloor`); above 24 px the 24 grid scales and its stroke with it (px / 16). `app/WinShell`'s taskbar and jump-list glyphs pick the grid the same way. - **Names** stay what they were, and a name with no file of its own falls back (`icongrid::legacy`): `<name>-thin` (the 0.9.0 player-bar set, removed) draws `<name>`, `heart-liked` draws `heart-filled`. New in 0.11.0: `sliders` (the Ses settings card; the equalizer bars mean "playing"), `mini-strip`, `mini-square`, `mini-wide`, `video`, `pop-out` under their plain names. - **Not icons**: the native tray menu has no icons; the placeholders (`assets/placeholders`), the logo and `animations/` are separate (the play-pause morph is drawn in code; its unused frames were removed in 0.11.0). - **Checks**: `icons_test` (5.2) checks every file against these rules through the app's loader and writes contact sheets with `--sheet <dir>` (every icon at 12-24 DIP for 80-175 % in dark, light and preset themes, each grid magnified over its pixel grid, off / on pairs). ### 3.44 Artist and Search pages `app/ArtistPage.cpp` and `app/SearchPage.cpp` (the Library stays in `app/BrowsePages.cpp`), on `app/BrowseWidgets` (filter chips, a fading column, the album / artist / playlist cards and menus shared with the Library) and `app/BrowseModel` (standalone logic: recent searches, the top result, the discography's groups and orders; `browse_test`). Both read the catalog only through `source::search` / `source::artistPage` (Source.h); what a source does not give is left out of the page, never shown as an empty box. **Artist data** (`catalog::ArtistPage`, optional parts after the original lists): `popular`, `appearsOn`, `playlists`, `latest`, `pick` (`ArtistPick`: a `CardItem` + comment), `banner`, `gallery`, `bio` / `bioSource` / `bioUrl`, `monthlyListeners`, `followers`, `worldRank`, `topCities`, `links` (`ArtistLink {kind, url}`), `verified`. - Spotify: `Api::parseArtistOverview` (static, `spotify_test` with `fixtures/artist_page.json`) reads the whole `queryArtistOverview` answer: the header image (`headerImage.data.sources`, sizes as `maxWidth` / `maxHeight`), the gallery, verified (`onPlatformReputationTrait`), the stats and top cities, the biography (HTML tags and entities out, one paragraph per line), external links (http(s) only, kinds lower-cased), the pinned item (album / playlist / artist / track; concerts skipped), top tracks, `popularReleasesAlbums`, the grouped `albums` / `singles` / `compilations` (`items[].releases.items[]`, newest first) with full dates and the catalog's kinds (`Album` / `Single` / `EP` / `Compilation`; they were Spotify's upper-case types before), `latest`, related artists, `appearsOn` and the featuring / discovered-on playlists (error entries and duplicates dropped). `artist.listenCount` keeps the monthly listeners for older readers. The overview gives only the first 10 releases of a group (20 appears-on): their `totalCount` goes to `albumsTotal` / `singlesTotal` / `otherTotal` / `appearsOnTotal`, and `source::artistReleases(api, id, ReleaseGroup)` -> `Api::artistReleases` pages the whole group (`queryArtistDiscographyAlbums` / `Singles` / `Compilations`, one document, `{uri, offset, limit: 50, order: "DATE_DESC"}`; `queryArtistAppearsOn`, `{uri, offset, limit}`; at most 300; the first edition of each release; hashes from the web player's `xpui-routes-artist` chunk in the built-in table). The page asks for it when "Tümünü gör" opens such a group (placeholders where the rest will be). - MusicBrainz: `links` from the lookup's url-rels (`detail::parseArtistLinks`: the homepage and Instagram, X / Twitter, Facebook, YouTube, TikTok, SoundCloud, Bandcamp; current relations only, one per kind, at most 8), the biography from Wikipedia: the Wikidata entity (fetched once for its photo anyway) also caches its article titles (`wikidata-sitelinks Q…`, 30 days), then `<lang>.wikipedia.org/api/rest_v1/page/summary/<title>` in the UI language, else English (`detail::parseWikipediaSummary`; a disambiguation page gives nothing); the article becomes a "wikipedia" link. `popular`, `appearsOn`, `pick`, the stats and the banner stay empty; the newest album / single stands in for `latest`. **Artist page**: - **Hero** (`ArtistHero`, a `HeroHeader`, 3.38): a wide header image runs across the page under the name (bg.base left under the text: 88 % dark / 93 % light, faded further on pages under 900 DIP), else the photo at the right as before, else the accent rings; parallax and the collapse are unchanged. The mono line is "✓ DOĞRULANMIŞ SANATÇI" (Spotify) or type · country · year · genre; under the name monthly listeners · followers (Spotify) or ListenBrainz listens. Actions: play (accent 56), shuffle (`shuffle-thin` outline; the bar mirrors it, so artist bars now have one too), Takip et (pill, a check while following), radio (outline icon, Spotify artists with a session), more (queue the popular songs, copy the link, block) and, while the artist is on the kara liste, an "Engelli" pill that lifts it. `artist:<id>#play` starts the popular songs once loaded (the top result's and cards' play buttons). - **Popular** (`PopularBlock`): five rows of the shared `TrackTable`; "Daha fazla göster" unrolls up to ten (the clip height eases over `motion::medium`; folded rows leave the table afterwards so the keyboard never lands on hidden ones). Beside it from 900 DIP (under it on narrower pages): `FeatureCard`s for the artist's pick (its comment in quotes) and the newest release ("SON ÇIKAN · 22 AĞU 2025", a "YENİ" pill within 30 days), raised cards with a gradient of the cover's color, the accent play button rising in on hover / focus; Enter opens, Shift+Enter plays. - **Diskografi** (`Discography`): the groups the source has as `ChipTabs` (Popüler sürümler, Albümler, Tekliler ve EP'ler, Derlemeler (and live recordings, MusicBrainz), Yer aldığı) over one shelf (`home::shelfRow`, 3.34); "Tümünü gör" shows the whole group as a grid with a sort button (En yeni / En eski / Alfabetik, and Popülerlik = the source's order for the popular releases; `browse::sortReleases`: partial dates sort before precise ones of the same period, undated last, names in the user's locale with digits as numbers). A new group or order fades the cards in (`FadeColumn`, `motion::normal`). - Then "Hayranları bunları da dinliyor" (circle cards), "Öne çıktığı çalma listeleri" (Spotify), and **Hakkında** (`AboutCard`): a gallery photo when there is one (the hero already shows the avatar), the numbers (monthly listeners, followers, world rank; or ListenBrainz listens, founded / born, country), the biography clamped to five lines that fade into the card ("Devamını göster" unrolls the rest over `motion::medium`), the five cities that listen most, genres as outlined pills and the links as outline pills that open the browser. **Search page**: - **Result kinds are data** (`resultKinds()`): `{id, title (tab / section), one (the top result's label), count, entry (one item -> ResultEntry: card lines, artwork, round or square, open / play / menu / preview, its recent-search record), custom (non-card content, e.g. the songs' rows), besideTop, route (how its recent items open) | reopen}`. `cardKind(id, title, one, &SearchResults::list, entryFn, route)` makes a card kind: a shelf with "Tümünü gör" in Tümü, a grid in its own tab, top-result candidates, recent-search cards. **Adding a kind is one entry there** (plus its `entryFn`). The chip order is the table's order after "Tümü"; chips only for kinds with results. - **Tümü**: the top result beside four songs (stacked under 760 DIP, the card at most 520 wide), then a shelf per card kind. The top result (`browse::pickTopResult`): every kind's first items scored by name against the query (folded like the command palette: case, accents, Turkish ı / İ): equal 100, starts with it 70, holds every word 45, the start of a longer query 30; +35 for an artist who sings one of the top three songs (searching an artist's name; also tells MusicBrainz homonyms apart), +6 artist, +3 song, minus the rank in its list; nothing matching: the first candidate. Its card (`TopResultCard`) is a raised card with a gradient of the artwork's color, the artwork (round for artists), the name in display type, a hairline kind pill and line, and the accent play button rising in on hover / focus. MusicBrainz search hits carry no photos: the top artist's comes from its lookup (`mb::artist`, MBIDs only). - **Type-ahead**: 220 ms after the last key with a Spotify session, 380 ms on MusicBrainz (one request a second, a search is three). The request in flight is cancelled (`CancellationTokenSource` into `source::search`) and its continuation dropped (`searchLife_`). While the next results load the shown ones stay, dimmed to 55 % (`FadeColumn`, 240 ms), and an indeterminate accent line runs along the header's edge (fading in after 150 ms; a still line with reduce motion); the new results come up from that opacity. The first results show placeholders in their shape (`TopRowSkeleton` + a shelf). Answers are kept for the run (16 queries, per catalog), so typing back or Back shows them at once; the route is retargeted to `search:<query>` (only while the page is the one shown). - **Keyboard**: Tab order box -> chips (one stop; Left / Right switch) -> results. Down in the box enters the results (the top result or the first recent search); arrows move between result stops spatially (`neighbor()`: the nearest item of the next row closest to the current center, or the next item on the same row); a song list takes Up / Down itself and hands the edges back (`TrackTable::onEdge`); Up from the first row goes to the chips / box, Escape to the box (text selected). Enter plays a song / opens anything else, Shift+Enter plays the top result. Ctrl+Tab / Ctrl+Shift+Tab cycle the tabs from anywhere on the page. - **Empty box**: "Son aramalar" as cards (`RecentCard`: artwork or the search glyph, name, kind · artists, "×" or Delete removes, "Temizle" clears) in 4 / 3 / 2 / 1 columns, then the genre tiles (Spotify: a search for the genre's name; logged out: the MusicBrainz tag search as before). Recent searches (`browse::RecentSearches`, `recent-searches.json` v2: `{k, id, t, s, img, track}`; v1's plain queries are read): a query sent with Enter, and what is opened / played from the results (the item, not the query), newest first, 12 at most; kinds this build cannot open are kept but not shown. - **Links** pasted into the box keep their row (`LinkHint`: what the link is, Enter opens it). **Cost**: both pages hold no bitmaps of their own (artwork through `ImageCache` at the painted size; 3.2) and are destroyed on navigation. Idle (Debug, 1440 × 900 DIP at 175 %, 10 s after loading): artist page 0 ms CPU; search results 47 ms and the empty view ~80 ms in 10 s (the focused box's caret). `SHADETUBE_SCROLL_DEMO=notch,touch,keys` (Debug): MusicBrainz artist page 313 frames, frame CPU median 2.7 / max 6.9 ms; a full Spotify artist page median 2.9, p90 10 ms, the heavy frames on first view of a shelf of new covers (bitmap uploads). The About card fades its biography with a gradient over its opaque fill instead of a layer (14 -> 7 ms frames there). **Dev**: `SHADETUBE_SPOTIFY_DEMO=<folder>` with an `artist.json` (a raw `queryArtistOverview` answer) shows it for any `artist:spotify:artist:<id>` route without a session (5.4). ### 3.45 Song cache `player/AudioCache` keeps the streams of played songs on disk (`cache\audio`), so a song heard before starts from the file without a single request, also offline. Until 0.10.0 every play downloaded the stream again: `MatchService`'s "stream cache" only remembers stream URLs (until they expire, ~5 h) and the engine's buffer is a temporary file deleted with the track. - **What is kept**: the YouTube or backup-server (Piped / Invidious) stream of a queue item (current or preloaded, not a song preview) that arrived completely while it played. `ProgressiveBuffer` calls `StreamSource::onComplete` once on its download thread with the whole buffer (never for a cancelled or failed download; readers are untouched) and `AudioCache::store` copies it byte for byte to `<videoId>-<itag>.m4a|.webm`. A song skipped before its download completed is not kept. Podcasts, radio, local files and downloads never get here (they are on disk already), nor SoundCloud stand-ins (no video id). The entry (`index.json`) holds what a play needs without the network: the format (MIME type, codec, bit rate, itag), YouTube's `loudnessDb` (normalisation), the match (title, channel, duration, score), the catalog tracks it played for and the video's SponsorBlock segments. - **Lookup** (`Player::resolveSong`, on the worker that used to resolve): the video the track plays (a listen-together session pin, a manual or persisted match, `Track::videoId`: what `MatchService::resolve` would pick) in the format the current stream choice picks. The "profile" is MatchService's own pair of flags, Opus allowed or not × High / Normal quality; a format is served only for the profiles that picked it, so a quality change never serves another format while online. A hit plays like a download (mapped read-only) with the match and the loudness gain, and nothing is resolved. Otherwise the usual resolve; when that fails (offline, YouTube refusing), any cached format of the song (the track's video, else the video the track last played from; Opus only while the engine decodes it); when it picked a format another quality setting cached, that file (no download). The player's `currentFromCache()` tells which. - **Safety**: a stream is written as `.part`, flushed and renamed, so a partial download is never served. Every lookup checks the length and a sampled FNV-1a hash (the length, the first and last 64 KB, 16 blocks of 4 KB across the file: at most 192 KB read) and drops an entry that fails. `load()` drops entries whose file is gone or has another length and files no entry knows (a crash's `.part`). A cached file that fails in the engine is removed by the next resolve's worker and the song is resolved again from the network at the same position (an audio device error is not the file's: it stays, 3.4 Failures). - **Size**: `Settings::audioCacheMb` (Ayarlar › Kitaplık ve depolama › *Şarkı önbelleği*: Kapalı / 500 MB / 1 GB, the default / 2 GB / 5 GB; any value in `settings.json`). The least recently played go first (a lookup counts), one stream may take at most a quarter of the limit, and the cache never leaves less than 1 GB free on its volume (`kMinFreeBytes`): on a nearly full disk it evicts before writing, or empties itself and writes nothing. *Kapalı* empties it, *Önbellekteki şarkılar › Temizle* clears it (both on a worker). Uninstalling with *Ayarları ve önbelleği de sil* removes it with the data folder. - **Downloads**: a download of a song whose stream the cache holds in the format the download would pick (the same profile; passthrough only MP4) is converted from that file: no stream request, also offline, and the SponsorBlock cuts come from the kept segments when the lookup fails. A finished download removes the video's cached streams (a song is never kept twice; the download plays first anyway, `localFileFor`). - **SponsorBlock**: `SponsorBlock::stored` / `onFetched` (wired by App, the class stays standalone): every successful lookup is kept with the video's entries, or held for one stored later in the run (the lookup lands before the stream is complete). A video's kept segments apply as soon as it starts, also offline; the lookup still runs and replaces them when they changed (unchanged ones keep their armed state), and a failed lookup keeps them. - **Unchanged behaviour**: a cached next item is preloaded from its file (gapless, crossfade), seeks work as in a download, a preview reads the cache but never adds to it, video mode resolves its picture from the known match as before, and a listen-together guest's session pin picks the host's video, which may be cached. Rows are dimmed only for catalog reasons (`Track::playable`) and the blocklist: the app has no offline state that dims songs, so there was nothing to light up for cached ones. - **Memory and threads**: the index only (~0.3 KB a song). `store` copies from the buffer's mapped temporary file and a cached song plays from a read-only mapping: file cache pages, no private commit. File work runs on workers and download threads; `index.json` (tmp + rename) is rewritten after stores and removals, and after lookups and SponsorBlock updates by App's housekeeping on a worker (and at exit). The Settings rows read in-memory stats. - **Measured** (2026-11-26, Debug build, Get Lucky 4 MB Opus, from the command to the engine's first sound): first play after a restart with the match known: network 1.2-2.5 s (manifest, URL check, first range), song cache 40-80 ms (0.9 s once, on a busy startup). Replay in the same session: network 80-110 ms (its URL is still cached), song cache under 16 ms (the tick's resolution; 234 ms once). The stream was stored about 1 s after it started playing. - **Dev**: `SHADETUBE_OFFLINE=1` (5.4) cuts the shared transport off; `songcache` log lines; `player` lines "playing after N ms (network | song cache | preloaded | file | station | feed)"; `audiocache_test` (5.2). ### 3.46 Song credits and the lyrics picker Two features around Now Playing: who made the song, and a way out when the automatic lyrics are wrong. Tested by `credits_test` and `lyrics_test` (5.2). **Song credits** (`catalog/Credits`, `spotify/SpotifyApi`, `musicbrainz/{MusicBrainz,Parse}`, `app/Credits`, `app/CreditsUi`): - **Model** (`catalog::Credits`): five groups (performers, writers, producers, engineers, others), each a list of people with their roles and an artist id when they have a page (a `spotify:artist:` URI or an MBID), plus the sources (labels / distributors) and the provider. `Credits::add` folds a role (`canonicalRole`: "Songwriter" → "writer", "Mix" → "mixing engineer", ...), puts it in its group (`roleGroup`; unknown roles go by the source's own group title, else Other) and merges one person's roles per group (same name, ASCII case ignored). - **Spotify** (`Api::trackCredits`): what the web player's "Credits" dialog asks, the persisted Pathfinder query `queryTrackCreditsGroupedModal` `{trackUri, contributorsLimit: 100, contributorsOffset: 0}` → `trackUnion.creditsTrait.contributors.items[{name, role, roleGroup{name}, uri | reference.uri}]` and `creditsTrait.sources.items[{name}]` (`parseTrackCredits`). The op lives in a lazily loaded chunk (`xpui-root-dialogs`): its built-in hash is in `HashRegistry`, and healing ranks dialog chunks first for "...Modal" ops. When the query fails for another reason than 401 / 429, the older spclient `track-credits-view/v0/experimental/<id>/credits` is asked (`parseLegacyCredits`: `roleCredits[{roleTitle, artists[{uri, name, subroles}]}]`, `sourceNames`). Only `spotify:artist:` URIs become links (`spotify:creator:` and external URLs do not). - **MusicBrainz** (`mb::recordingCredits`): one lookup with `inc=artist-credits+artist-rels+work-rels+work-level-rels+ label-rels`. The artist credit gives the main artists; recording relationships give instrument / vocal / performer (the instrument names as roles, modifiers such as "guest" dropped), producer (co / executive / additional), engineer / mix / mastering / recording / programming / remixer, others by their type ("misc" is left out); the works' composer / lyricist / writer / arranger relationships give the writers; label relationships (℗) are the sources, a work's publisher is not. A song known only by name (`mb::songCredits`): a recording search for the cleaned title (`searchableTitle`: "(feat. X)", " - 2011 Remaster" dropped) and the artist, `rankRecordings` keeps the same title and artist within 10 s of the song's length (2 s / 5 s / 10 s tiers, then the recording on most releases, the closest, the score), and the first of up to three candidates whose relationships add anybody beyond the artist credit wins (MusicBrainz has many duplicate recordings without relationships). - **Chain and cache** (`app/Credits`, standalone): Spotify for a `spotify:track:` while logged in, then MusicBrainz (an MBID directly, else by title and artist; a song without an artist is not searched: a title alone finds someone else's song). The first answer naming somebody wins. Answers are cached per track in memory (48 entries) and in `cache\credits\<id>.json` (30 days; "nobody known" 3 days, and only when every provider answered: a failed one is asked again). MusicBrainz' answer takes the label of the track's own album (a release group MBID, the cached album lookup) as its source when the recording names none. - **UI**: Hakkında (3.40) asks once per track while the tab is open (`fetchCredits`, the view's per-track lifetime): a skeleton, then up to five people (`credits::summary`: the first two of each group, a person once with the roles of every group), each artist a link, "Tüm krediler" and "KAYNAK · <labels>". Nothing is fetched while Now Playing is closed. The "Krediler" item of a song's menu (`creditsMenuItem`, not for stations / episodes) and "Tüm krediler" open the dialog (`showCredits`, the overlay family's `ui::Dialog`): the groups with their people (an artist row is a Tab stop: Enter or a click closes the dialog and opens the artist page), the sources and "BİLGİLER: SPOTIFY | MUSICBRAINZ"; it fetches while open. Known roles are translated (`creditRoleLabel`), instruments are shown as the source names them. **Lyrics picker** (`lyrics/Lyrics`, `app/LyricsService`, `app/LyricsPicker`): - **Choice** (`lyrics::Choice`: Auto, an LRCLIB record id, Spotify, a file, None) is stored per track next to the timing offset in `lyrics-offsets.json` (`Offsets::choice` / `setChoice`, a `"choices"` object beside `"offsets"`; older builds ignore it). A picked file is copied as UTF-8 into `lyrics\<track id>.lrc` next to it (`importFile`; at most 1 MB, it must hold plausible lyrics), deleted when the choice changes; a stored name with a path separator, ":" or ".." is ignored. `setLyricsChoice` stores it, resets the track's offset (it was tuned for the old lyrics) and tells the views (`onLyricsChoiceChanged`), which load the lyrics again. - **fetch()** honours `Query::choice` (set by `lyricsQueryFor`) before the chain: None = no lyrics; an LRCLIB record from `cache\lyrics\lrclib-<id>.json` (written when it was picked, `rememberRecord`) or `GET /api/get/<id>`; Spotify's lyrics through the query's fallback provider, cached as `<id>~spotify` ("none" is none); the file. A pick that can't be had now (offline, the record or file gone, logged out) leaves it to the chain. Downloads' lyrics follow the pick too. The chain's cache entries now keep the LRCLIB record id (`"lid"`), so the picker can mark the record on screen. - **Dialog** (`showLyricsPicker`): a query field ("artist title", Enter searches again), LRCLIB's free-text search (`GET /api/search?q=`, junk records dropped) ranked by `rankHits` (within 5 s of the song first, synced before plain, then the closest), each row: "title — artist", album · length · the difference to the song ("Süre aynı", "+12 sn fark", in the warning color beyond 5 s), a SENKRONİZE / DÜZ METİN / ENSTRÜMANTAL tag (ŞU AN for the record in use) and a two-line preview; rows are Tab stops (Enter picks). Below: "Spotify'ın sözleri" (a Spotify track while logged in), "Dosyadan yükle…" (closes the dialog, then a posted `IFileOpenDialog` for .lrc / .txt and the copy on a worker) and "Söz yok"; in the footer "Otomatik seçime dön" while a pick is stored. The word-level sources switched on are searched beside LRCLIB and listed above it (3.81). - **Entry points**: Now Playing's lyrics header ("Yanlış sözler mi?" after the label, which gives way on a short row; "Sözleri ara" under "no lyrics"), the full-screen lyrics' search button (a picker over the view). A stored pick adds "SENİN SEÇİMİN" to both headers; None shows "Bu şarkıda sözleri kapattın.". Dev: `SHADETUBE_OVERLAY_DEMO` steps `credits` and `lyricspicker` open the two dialogs for the playing song (5.4). ### 3.47 Lists: the track table, the Library, the queue and the shared states `app/TrackColumns` (standalone geometry, `lists_test`), `TrackTable` and `badge::` in `app/Components`, `LibraryView` + `ViewToggle` in `app/LibraryView`, `QueuePanel` in `app/Shell`, the shared states in `app/PageWidgets`, `ui::paintSkeleton` in `ui/MicroPaint`. - **Track table columns** (`trackcols::layout`, a pure function of the width): `# | [art] title / artists | album | year | added | plays | BPM | Ton | [queue][heart] | duration | [more]`. The right end never moves: the 28 DIP slots of the hover actions are always reserved, the actions fade in and slide 6 DIP into them (`HoverFade`, 120 ms; instant without micro-interactions), the heart stays while liked. As the table narrows the optional columns give way to the title (240 DIP minimum, 200 compact) in this order: plays, Ton, BPM, year, added, album, then the queue action; narrowing never brings one back. BPM (3.65) and Ton (3.82) are offered in every list but on only when the user picks them. Which optional columns a list shows is the user's (`Settings::trackColumns`, `"album,added,plays"`; the column header's context menu toggles them, *Varsayılan sütunlar* resets) intersected with what the list has (`Options::showAlbum / showAdded`; *Dinlenme* only when a row has a play count, `Track::listenCount`). There is no year or "added by" data in `catalog::Track` yet, so the Year column is laid out but never offered. - **Rows**: the title line carries the badges, the artists line underlines the hovered artist link, a row without artists centers its title. Hover = `overlay.hover` + the play glyph in the index cell; the playing row = the accent title, the equalizer bars and a flat `accent.tint06` (a gradient that faint bands on paper); selection runs (`trackcols::selectionRuns`) are one `accent.tint12` block each with one continuous 2 DIP accent bar, and with several rows selected their index cells show a checked box (a click on it deselects) and the header counts them ("· 3 SEÇİLİ"). Shift + arrows extend the selection, Escape narrows it to the cursor's row; the keyboard cursor's row shows the actions too. Unplayable / blocked rows are dimmed; rows of the table's own drag are dimmed while they travel. - **Badges** (`badge::`, one look everywhere: tables, queue, player bar, Now Playing): text badges are 14 DIP outlined pills with mono 9 text (neutral: `hairline.strong` / `fg.secondary` — ENGELLİ, YEREL, KULLANILAMIYOR; accent: the accent outline and text over `accent.tint06` — ÖNERİLEN with its sparkle, a listen-together guest's "+ AD"); the explicit "E" is the spec's filled square; *downloaded* is a 12 DIP accent disc with a check (also the Library's synced mark). Order after the title: E, downloaded, recommended / added by, blocked, local. `Options::markLocal` / `markDownloaded` turn the last two off where every row is one (Yerel dosyalar, İndirilenler). `smartshuffle::drawBadge` and `together::drawAddedBadge` keep their signatures and draw through it. Recommended rows lost their tint (the badge and the "+" say it). - **Header**: mono labels; the hovered sortable label brightens, the active one is `fg.primary` with a thin chevron. A click sorts (`asc → desc → the list's own order`; added and plays start descending) through `TrackTable::onSortChanged`, so a page's sort menu and label follow (`CollectionPage::sortChoices()` is the one list both use). The header sticks to the top of the scroll view (below its `topInset`) once the table scrolls under it, over a `fillSurface` band, and takes clicks there; a collapsing page header docks it instead (`CollapseBar::attach` → `setHeaderDocked`) and forwards hover / clicks on the docked copy (`headerPress / headerHover`). An empty table has no header and no height: the page's empty state stands alone. - **Drag feedback**: the insertion line glides between slots (`motion::fast`, decelerate) with a 3.5 DIP ring at its start; the ghost (`app/DragDrop`) is a small card: the first song's cover, title and artists (or "+ n şarkı daha"), two hairline cards stacked behind it and the count on the cover's corner for several songs, fading in 4 DIP from the pointer. - **Library**: one toolbar row — the search pill and how many items show ("12 ÖĞE", "3 / 12 ÖĞE" while searching) on the left, "SIRALA <sort>" and `ViewToggle` (two icon segments, the Settings `Segmented` look with a sliding pill) on the right. List rows follow the density (64 / 48 DIP, covers 48 / 36), the synced mark is the badge disc, empty tabs get an empty state with one action (*Albüm ara* / *Sanatçı ara*), a search with no result the compact state. - **Clearing the queue** (0.13.0): *Sırayı temizle* (the panel's trash button, its menu, the command palette's *Çalma sırasını temizle*) clears at once, without a confirmation, and the toast *Çalma sırası temizlendi* offers *Geri al* (`clearQueueWithUndo()` in `app/AppContext`): `Player::restoreOrder(order, pos)` puts the order from before back with the same slot playing, songs queued since after it. It refuses (and says *Sıra değişti, geri alınamadı*) once another queue plays (`queueGeneration()`), the playing song changed or the command filter takes it; a clear the command filter takes (listen together, 3.24) changes nothing here and shows no toast. `queueundo_test` covers it. - **Queue panel**: *Sıradaki* with *Kuyruğu kaydet* and *Sırayı temizle* as icon buttons; "ŞİMDİ ÇALIYOR" above a tinted block (48 DIP cover, accent title, bars) with a 2 DIP progress line; then the upcoming slots in sections (`queuelist::Sections`): runs of songs the user queued (`Track::queued`, set by `Player::playNext / enqueue / insertAt` except smart shuffle's recommendations, kept in `session.json` as `"q"`) under *SIRADA*, runs from the context under *SONRAKİ · <kaynak>*; the first label sits above the list with the count, later ones are 36 DIP header rows inside it. *Sıraya ekle* (`Player::enqueue`) puts songs after the *SIRADA* run that follows the playing one, in front of the rest of the context (Spotify's queue: what you queue plays first); *Sonra çal* stays right after the playing song; smart shuffle's recommendations go through `insertAt` and are never marked queued. A hovered row trades its duration for "×" (out of the queue). Dragging a row lifts it onto the elevated surface under the pointer, leaves a hairline outline in its slot and shows the gliding insertion line. Only visible rows are painted; sections cost one pass over the upcoming slots per queue change. The empty queue is the compact empty state. - **Shared states** (`app/PageWidgets`, for every page): - `MessagePanel` (signature unchanged) is the state panel: a thin illustration (a hairline ring with the icon inside a dial of 36 one-pixel ticks, a longer one every quarter), one title, one short line, at most one action; it fades in and rises 6 DIP. `Tone::Empty / Error / Offline` (guessed from the icon, settable) adds a small `status.error` / `status.warning` dot on the ring; error tones put the refresh glyph on the action, empty ones none unless given. `setCompact(true)` is the inline size (no dial). Helpers: `emptyState(...)`, `errorState(parent, raw, retry)` (`friendlyError` maps service errors; connectivity failures become *Çevrimdışısın* with the offline icon, other technical text a plain sentence), `noResultsState(parent, line)`. `ScrollPage::showError` uses `errorState`. - Skeletons: `SkeletonRows` (track rows in the table's geometry, density aware, optional header), `SkeletonCards` (MediaCard grid, square or round), `SkeletonShelf` (section title + a row of cards), `SkeletonHeader`, `SkeletonTitle`, `SkeletonBlock` (header + rows, `ScrollPage::showSkeleton`); `ScrollPage::showLoading(Cards | Shelves | Rows)` for other page shapes; `TrackTable::paintSkeletonRows` for a table's next page. - The shimmer (`ui::paintSkeleton` → `Canvas::skeleton`): one soft band crosses the whole window (`gfx::skeletonBand`: 30 % of the width, 240-520 DIP, 1400 ms, then 500 ms of rest), placed in window space, so every block on screen shimmers in step instead of each running its own sweep. Without micro-interactions the blocks are static and ask for no frames; otherwise a painted block asks its window for a repaint every 33 ms (blocks scrolled away or hidden ask nothing). - Applied to: album / playlist / Liked Songs (empty with *Şarkı ara*, missing playlist with *Kitaplığa dön*), the Library, Yerel dosyalar (first scan: skeleton rows; folder tree: skeleton cards; no matches), İndirilenler (empty with an action), Podcastler (chart / search rows: skeleton cards and compact error / no-result states; new episodes: skeleton rows), Radyo (its station skeleton on the shared painter), İstatistikler (`showLoading(Shelves)`), Yeni çıkanlar (`showLoading(Cards)`, filter without results), Home's skeletons (the shared painter). Search and the artist page are left to their own redesign. - **Cost** (`SHADETUBE_SCROLL_DEMO=notch,spin,touch,end` on a 5 000-song local playlist, Debug, thread cycles of `TrackTable::paint` per frame, the 0.10.0 table and the new one instrumented the same way and run alternately on the same machine, batches of 200 paints): comfortable density, median per batch 3.3-3.4 M cycles after vs 4.2-9.8 M before over five runs each (p90 4.1-4.5 M vs 4.8-13 M; the single worst frames, new rows' first layouts, 11-32 M vs 25 M); compact density 7.3-12.6 M after vs 7.6-8.7 M before over six runs each, i.e. within the machine's noise (other builds were running). Frame gaps were not comparable between runs (the display ran at 60, 120 or 240 Hz). Row texts measure their natural width once (a `gfx::Text` keeps one layout per width: measuring at another width than it is drawn at would lay it out again every frame) and the header labels and badges are laid out once. Virtualization is unchanged: rows are painted from the model, only the visible ones. - **After the 0.11.0 merge** (the polish pass over the features built on the old design): - Shared states everywhere: Artist / Search skeletons, the YouTube Music moods (tile placeholders: `SkeletonCards` with a tile height), Home's catalog / YouTube Music errors (`errorState`), the Spotify podcasts section (card row placeholder, compact error with retry) and import list (`SkeletonLines`), Podcasts' empty subscriptions, the credits dialog and the lyrics picker (`SkeletonLines` rows, then the compact offline / no-result states, a retry that searches again). Every `Canvas::skeleton` caller is now `ui::paintSkeleton` (Now Playing's lyrics / credits / About, the full-screen lyrics, the playlist details and tag editor covers), so reduced motion stills them all. - Keyboard: Now Playing's painted "Yanlış eşleşme?" / "Yanlış sözler mi?" links are Tab stops through `ui::FocusProxy` (an invisible focusable stand-in at the painted rect; Enter / Space run it, the Window draws the ring); the queue panel is one Tab stop with a row cursor (arrows, PageUp / PageDown, Home / End, Enter plays, Delete removes, Alt + Up / Down moves, the menu key opens the row menu). - Pacing: the seek wave and the playing bars ask for their next frame 25 ms after the current one is *shown* (`Window::invalidateAfterShown`, the frame clock's presentation time) instead of 25 ms after painting began: ~30 fps at 60, 120, 144 and 240 Hz alike (at 120 / 240 Hz it was ~40). Measured at 60 Hz (Debug, *Yerel dosyalar* song list playing, 10 s): 320 frames before, 319 after, 2.9 ms mean frame CPU; the higher refresh rates were not available to measure. - Covers: an open-catalog search that comes up with placeholder art was late, not broken: MusicBrainz answered 503 (busy) and the client backed off for several seconds before the results and then their Cover Art Archive covers came. Artist photos from Wikimedia Commons, though, failed for good with HTTP 429: Wikimedia refuses the browser-like agent of the shared transport, so `http::getLimited` names ShadeTube to `*.wikimedia.org` / `wikipedia.org` / `wikidata.org`. The image cache's expiry never drops the current page's covers (only pages two steps back, unpainted for 20 s), so nothing on screen or about to scroll in reloads. - Catalog tags in mono labels use `toUpperData` (invariant casing unless the text has Turkish letters: "TURKISH ROCK", not "TURKİSH ROCK"); the top search result drops a subtitle that only repeats its kind; the Blend chip's label is laid out once per row instead of every frame. - **Page layout** (the content pages' system; `PageTitle`, `PageTabs`, `cardMinCell` / `addCardGrid` in `app/PageWidgets`; taken from Home, the collection / artist headers, Search and the track table): - Frame: 48 DIP gutters (`metrics::pageX`), 36 at the top (`pageTop`), 48 at the bottom, set by `ScrollPage` (a page never pads itself). No maximum width: the content fills the window and long text keeps its own measure (the search box ≤ 720, descriptions ≤ 640, the top result ≤ 520). - Rhythm: a page's header block (title, then its tabs / chips / toolbar) 24 apart; the first section 32 below it and the sections 32 apart (`metrics::sectionGap`); a section's header and its content 16 apart (a `ui::Column(16)` per section); rows of a list touch. Detail pages: the hero header (232 cover, 3.38), then the list. - Type: page titles `displayM` at 56 / 44 / 36 DIP by page width (≥ 900 / ≥ 560 / less: Home's greeting steps), 8 DIP smaller per step down to 36 for a long name, then an ellipsis; detail headers `displayXL` fitted 88-36, the artist `hero`; section titles `title` 22/700 with a mono count / label 14 after it, "Tümünü gör →" at the right and a hairline at 44 (`SectionHeader`, 48 tall, more links with `addLink`, the title never runs under them); card titles 13/600 (artists 14/600), subtitles `caption` 12 fg.secondary; the line under a title `secondary` 13 fg.tertiary; mono labels (`monoLabel`, `toUpperTr` / `toUpperData`) fg.tertiary on plain pages, fg.secondary on hero headers. - Page title (`PageTitle`): an optional kicker above the title (a sub-page's context: "ABONELİKLERİNDEN", "RADYO · TÜR", a folder's "12 ÇALMA LİSTESİ"), the title, an optional meta line (≤ 2 lines); actions right-aligned, centered on the title's line, 8 apart, the main one last as a Secondary pill with its icon, the others Ghost; a sub-page's way back is a Ghost "← <parent>"; a page's search is the search pill after them (48, 220-380 wide). What doesn't fit beside the title moves under it. Used by Kitaplık (+ folders), İndirilenler (+ folders), Yerel dosyalar, Podcastler (+ Yeni / İndirilen bölümler, the Spotify import), Radyo (+ its lists), İstatistikler and Yeni çıkanlar; the profile header draws the same texts beside its avatar. Ayarlar keeps its own header (the chrome's). - Controls: `PageTabs` (underline) for a page's views (Kitaplık, Yerel dosyalar); `ChipTabs` for filtering what a page shows (search kinds, discography groups, Yeni çıkanlar); `Segmented` for a mode switch of a few short options (İstatistikler' period, `ViewToggle`); plain `Chip` buttons only as shortcuts that navigate (Radyo's genres). Each is one Tab stop with arrows (the genre row too). A page's own search is the search pill (`TextBox::Look::Search`, 44 in a toolbar); a detail header's search is the icon that opens a 40 DIP field in place of "SIRALA <order>" (album, playlist, podcast show). - Cards: one column for every media-card grid and shelf: ≥ 160 DIP (Sıkı 140), gap 16, as many as fit (`cardMinCell`, `addCardGrid`, Home's `cardWidth`, the Library's `LibraryView`); the card look of 3.32. Editorial tiles (genres, moods, stations) keep their own height with the 12 DIP `gridGap`. - Rows: the track table 56 / 40; list rows (`ListRow`, the Library list, episodes, stations, downloads, sync rules) 64 with 44-48 DIP art. - Buttons: the accent `PlayButton` 56 for "play this"; Secondary pills (40) for a page's main action and shuffle; Ghost for the other commands; `IconOutline` 40 circles in a detail action row (14 apart, in the tree in their visual order); `Link` for "Tümünü gör". Disabled is 38 %: an empty list disables play, shuffle, Geliştir, offline, sort and search (`DetailHeader::setListEmpty`). - Outlines: 1 px `hairline.default` for section rules and card / panel outlines (`hairline.strong` on hover), `hairline.control` for control outlines; corners from `gfx::radii()`. - States: only the shared ones above (compact inside a section, the full panel for a page); an unknown song length shows nothing (an imported history), never "00:00". - Keyboard: Tab follows what is seen: sidebar, the page's header actions, its controls, the content, the player bar. `SHADETUBE_FOCUS_LOG=1` logs every focus change (class, window rect, tooltip): with `SHADETUBE_OVERLAY_DEMO`'s `key=Tab` steps it gives a page's order without looking (checked for Search: box → chips → top result → "Tümünü gör" → songs → artists...; the Library, Yerel dosyalar, İndirilenler, Podcastler, Radyo, İstatistikler, Home, a playlist and an artist). Paint: a text drawn every frame is a `gfx::Text` measured once (on a copy when its natural width is needed): `SectionHeader`, the collection and podcast show headers laid out several DirectWrite layouts per frame before. - **The 5 000-song list's open, measured again** (the previous pass read a slowest frame of 22.6 ms against 17-19 and a mean of 11.3 against 9-10 ms, Debug): `SHADETUBE_MEM_DEMO` (`route=playlist:<5 000 songs>`, `frames=` 3 s later, then 20 wheel notches), the pre-polish build (84d845f), the polish build and this one run alternately on one profile, six runs each: open mean 8.92 / 8.62 / 8.82 ms, slowest 19.3 / 18.5 / 18.6 ms (medians of the runs), scrolling 6.90 / 6.99 / 6.78 ms. Single runs of the same build ranged 6-13 ms mean and 14-42 ms slowest while other builds ran, so the earlier reading was that noise, not a regression. The page layout pass, the same way (dev-0.11.0 before it / after it, medians of 4-6 alternating runs, frame CPU while opening / scrolling 15 notches, process CPU 15-25 s in): Home open 3.8 / 3.8, scroll 6.9 / 6.7 ms; the 5 000-song list 9.2 / 9.7 open, 6.8 / 6.7 scroll; an artist 5.5 / 4.5 open, 7.4 / 6.6 scroll; Search 4.3 / 4.7 open, 4.7 / 4.8 scroll; the Library 7.8 / 7.7 open, 6.9 / 6.9 scroll; idle CPU 0 % on every page but Search (0.3-0.6 %, the box's caret). `memory_test` passes. - Dev: `SHADETUBE_LIST_DEMO` (5.4) selects rows, sorts through the header path, sets the columns, queues rows, opens the queue, scrolls, shows a reorder drag in place and fakes play counts for `--screenshot`. ### 3.48 Several Spotify accounts Several Spotify accounts on one PC, switched without logging in again (`spotify/Accounts` = the store, `spotify/Session` = the switch, `app/Accounts` = what is per account + the UI; `accounts_test`). - **Layout.** Per-account subfolders rather than keyed files: everything of an account sits in `<data>\accounts\<id>\` (id: 8 random hex digits, made up locally, never derived from the Spotify user): its `spotify.dat` (DPAPI sp_dc), `webview2\` (the WebView2 profile of the login that produced it) and its per-account files. `<data>\accounts.json` lists the accounts (id, the Spotify user `spotify:user:<name>` once known, user name, display name, avatar URL, added / last used) and the active one, written with a flushed rename. Removing or moving a folder is the whole account; a damaged list is kept as `accounts.json.bad` and rebuilt from the folders (nothing is deleted then); folders not in a trusted list (a login that never finished) and the WebView2 profile of signed-out accounts are removed at startup. - **Per account / per PC.** Per account (`accounts::perAccountFiles()`; a name also covers its `.old` / `.bak` / `.tmp` siblings): `listening.json` + `listening-imported.json` + `listening-lastfm.json` + `listening-listenbrainz.json` (stats, the year in review, the Library's play recency; the imported histories with their import cursors, 3.55 Last.fm and ListenBrainz history import), `blacklist.json`, `new-releases.json`, `smart-lists.json`, `library-recents.json`, `rule-lists.json` and `rule-sources.json` (3.64; the cached track lists sit in the account folder's `rule-sources\`). In memory, the Session keeps the library snapshot (playlists, folders, saved albums, followed artists, liked ids) per account and parks the one it leaves for an instant switch back (a reload follows); Home and the friend activity reload. Per PC (the root): settings, themes, downloads (`downloads.json`, the files), `sync.json`, local files, `library.json` (local likes and playlists, the local play history), podcasts, radio, lyrics offsets, caches, `palette-recent.json`, `recent-searches.json`, Last.fm / ListenBrainz (`scrobble.dat`), the phone remote. **Decision for stats, smart lists and the blocklist: per account** - they describe a person's listening (two people on one PC each get their own Wrapped, mixes and blocks); the cost is that one person with two accounts sees two histories. Sync rules stay in one `sync.json` (the downloaded files are shared) but a Spotify Liked Songs / playlist rule carries the Spotify user it belongs to (`"acct"`; a rule from before is stamped by its first listing) and is listed only while that account is active; on another account it waits like a Spotify rule while logged out, keeping its track ids, so nothing of it is dropped. Albums are the same for everyone. One Liked Songs rule per PC (its id is Spotify's collection URI). - **Data folder of the moment** (`Session::dataDir()`): the active account's folder; the root while there are no accounts (MusicBrainz only). Signing out keeps the account's record and folder (only `spotify.dat` and `webview2\` go) and, when no other account is signed in, it stays the active one: MusicBrainz mode keeps showing its history, and a later sign in to the same Spotify user (matched by user id) finds everything again. The very first account in a profile adopts the root's per-account files (they were that person's); later accounts start empty. - **Migration** (`AccountStore::load`): a 0.10 profile (`spotify.dat` in the root, no `accounts.json`) becomes account 1 in place, by renames: the cookie, `webview2\` and the per-account files move into its folder, the list is written, the profile (name, avatar) fills in at the first connect. A crash half way is recovered from the folders at the next start. MusicBrainz-only profiles keep their root files until their first login. - **Login** (`Session::beginLogin` / `finishLogin`, `app/LoginWindow`): every login gets a new account folder and its WebView2 user data folder there, so the login window starts with an empty cookie jar: it neither signs the other accounts out nor picks up one of their `sp_dc` again. The captured cookie connects first (token + profile); if the Spotify user is already known, that account signs in again (its cookie replaced) and the new folder is deleted (retried while WebView2's browser process still holds it, else at the next start); otherwise the folder becomes a new account. A failed connect discards the folder and leaves the current account alone. - **Switch** (`Session::switchTo`): the target's token and profile are fetched on a worker with a throwaway `Api` while the current account stays on; then, in one UI turn: `onAccountLeaving` (App: `ctx().accountLeaveHooks` - every feature saves to the old folder and drops work in flight), the snapshot parked, the Session's lifetime renewed (no continuation of the old account lands), credentials / profile / snapshot swapped, `accounts.json` saved, `onAccountEntered` (`accountEnterHooks` - every feature loads from the new folder), the notification, a library reload. The App then rebuilds the page on screen when it shows account data (not Settings, Downloads, local files, podcasts, radio or Stats, which follow their own notifications). The player is not touched: the song and the queue play on. The listening history writes what it stored to the old file and carries the play in progress over (`ListenStats::detach` / `attach`: it is stored in the history that is active when it ends); a running history import is dropped from memory (its file is already written in the old account's folder). New releases cancel a refresh in flight; a Spotify sync listing in flight is cancelled (its next pages would come from the other account) and a listing that finished under another account is not applied. - **Sign out** (`Session::signOut`, "Çıkış yap"): only that account - its cookie and login profile go. For the active one, the most recently used other signed-in account takes over (a normal switch: the music plays on); with none left the App pauses, leaves Now Playing and shows the connect screen as before. A start whose active account has no cookie but another one is signed in switches to that one. - **UI.** The title bar's source tag (`SPOTIFY · <NAME>`) is a button (`accounts::AccountChip`, mono label, hover pill, chevron) opening the account menu: the signed-in accounts (the active one checked, "Bağlanıyor…" while a switch connects), "Hesap ekle…", "Hesapları yönet" (Settings › Spotify hesabı), "Çıkış yap". Settings › Spotify hesabı lists the other signed-in accounts (avatar, name, user name, "Geç", "Çıkış yap") and "Başka bir hesap ekle". The command palette has "Hesaba geç: <name>" per other account and "Spotify hesabı ekle". A switch toasts "<name> hesabına geçildi", a failure (an expired cookie) says to sign in again. - **Connection trouble** (3.5): Spotify unreachable at startup keeps the account (`Connecting` + `offline()`, the chip "SPOTIFY · ÇEVRİMDIŞI", in the menu "Çevrimdışı", Ayarlar a "Tekrar dene" row) and tries again with a backoff and when the network comes back; a running account whose renewals fail shows the same until one works. A cookie Spotify refuses marks that account expired (`Session::expired(id)`, in memory for the run; the cookie stays until a new login or a sign out): a warning toast "Spotify oturumu sona erdi" with "Tekrar bağlan", the chip "SPOTIFY · OTURUM SONA ERDİ", "Oturum sona erdi" in the menu and the account rows, whose action becomes the login ("Tekrar bağlan", the same Spotify user signs that account in again), and an Ayarlar row with "Tekrar bağlan". A failed quick switch to an account (no network) keeps the current one, as before. The account in the row above (on, connecting or refused) is not listed again under "Bu PC'deki diğer hesaplar". - **Dev**: `SHADETUBE_ACCOUNT_DEMO` (5.4) scripts menu / switch / sign out / add. The live checks were done with one real account (migration of a 0.10 profile copy, connect, a switch to a second record holding the same cookie while a song played); `accounts_test` drives the Session with a fake connect (two users, add, switch, re-login, failed switch, sign out hand-over, restart) and the connection trouble (fake connect, fake token fetch and a fake Spotify answering 401). The offline start was checked in a sandbox profile with `SHADETUBE_OFFLINE=1` (tries 6 / 10 / 18 s apart), the expired prompt with a made-up `sp_dc` (one token request, HTTP 401, nothing more). ### 3.49 Song-change notification Ayarlar › Pencere ve sistem › "Şarkı değişince bildirim göster" (`Settings.songNotifications`, off by default; `app/SongNotification` = the rules + the toast XML, standalone, `songnotify_test`; `app/SongNotifier.cpp` = the app part). - **Mechanism.** The app's other notifications (new releases, background errors) are tray balloons, which have no buttons and only an icon. This one is a WinRT `ToastNotification` (C++/WinRT like SMTC) for the app's AUMID (`installer::appUserModelId()`): the cover as `appLogoOverride`, title, artist, album as attribution, "Sonraki" and "Beğen" buttons (Beğen only when the song can be liked and isn't), silent, tag `song` / group `now-playing` so each song replaces the previous one (one entry in the notification center), `ExpirationTime` = when the song would end (1-15 min), and the group removed from the notification center when ShadeTube quits. The cover is decoded at 256 px (`ImageCache::decodePixels`) and written as `<data>\shell\now-playing-{0,1}.png` (two files in turn). Buttons come back through the toast's `Activated` event (in process, posted to the UI thread; the notification object is kept alive): "next" skips only if that song is still playing, "like" likes that song, the body brings the app back (`show-window`). An unpackaged app needs its AUMID to be known to the shell: the Start menu shortcut carrying it (`installer::ensureStartShortcut`) does that; without it (e.g. a test AUMID) `Show` fails with 0x80070490 and the tray balloon is used instead (title and artist, no buttons, no cover). Notifications turned off for ShadeTube in Windows are respected (no fallback). - **When** (`songnotify::decide`; a change is judged `kDebounceMs` = 1.5 s after it happened and only if that song is still current, so skipping through songs gives one notification): never when a ShadeTube window is in view - the foreground window is ours, or one of our thread's top-level windows (main window, mini player, video window) is shown, not minimized, not cloaked (another virtual desktop) and not under the foreground window by 90 % of its area (a window above the foreground one in the z-order, like the always-on-top mini player, counts as in view). So the mini player on screen, which shows the song and gets the app's toasts, means no notification. Not for a change within 3 s of a command from Windows' media controls (SMTC buttons: media keys, the flyout, the lock screen; and the taskbar thumbnail buttons): Windows' own media overlay / the thumbnail shows the new song. **Decision on hotkeys**: skips through ShadeTube's global hotkeys do notify (nothing else shows the song then); a burst of them is one notification thanks to the debounce. Not as a listen-together guest while changes come in a burst (2 within 10 s: joining, catching up, the host skipping around); a host's single change does notify. Not while Windows says the user is busy (`SHQueryUserNotificationState` other than "accepts": a full-screen app or game, presentation mode, quiet hours, a locked screen); Focus assist / Do not disturb itself is left to Windows, which holds toasts back. Not for the same song again (repeat one, a re-resolve), radio stations, podcast episodes or a song paused by then. The verdict is logged (`songnotify` lines). ### 3.50 Blend A shared playlist made from the taste of two or more people, without a server or accounts, on the listen-together transport (3.24). `app/Blend` (standalone, pure: the taste profile, its JSON, the mix, the match, the store record; `blend_test`), `app/Blends` (the blends of this PC, the exchange, the consent dialog, the actions, the palette) and `app/BlendPage.cpp` (cover, cards, the page). - **Taste profile** (`blend::makeProfile`, on a worker from a copy of `ListenStats`' tracks + plays, imported history included): streams only, podcast / radio ids out; each stream weighs `0.5^(age / 60 days)` within the last 180 days (fewer than 15 songs there: the whole history with a one-year half-life, `win: 0`). The 50 heaviest songs (id, title, up to 4 artists, album, http(s) cover, length) and the 30 heaviest artists (every credited artist of a song counts), each with a weight 1..100 relative to the member's top one, the display name (`Settings::jamName` or its default) and the time rounded down to the hour. No play counts, no times, nothing else. Fewer than 5 songs: refused ("listen a bit more"). 300 000 plays: 26 ms (MinSizeRel). - **Keys** are computed by the sender (`k`: 16 hex digits of FNV-1a-64 over `ListenStats::keysFor`'s folded "title + first artist" / artist name) and the mix only compares those, so two app versions that fold names differently still build the same list. - **The mix** (`blend::build`, the same on every PC from the same profiles): members sorted by member id, one profile each (the newest), at most 10; songs two or more members have first (by how many, then their summed weight, then key), then one song per member in turn in each member's own order, skipping songs already in; 50 songs at most. Each row knows whose taste it is (`from`). **Taste match**: the mean over pairs of `0.7 × artists + 0.3 × songs`, each a weighted overlap (Σ min of the two members' shares, integer cross products), shown as `100 × (1 − (1 − c)³)`, so half the taste in common reads ~88 %. - **Invite and topics**: `shadetube://blend/<base64url(1 | flags | blend id (16) | key (32) | broker)>` (the session invite's payload under its own prefix: neither opens as the other, and 0.10.0 answers "can't open this ShadeTube link"); topics `shadetube/blend/v1/<hex SHA-256(blend id)>/…`. Each member has a random member id per blend (not the Jam device id, so blends and sessions can't be linked). - **Exchange**: `p/<member>` holds that member's profile as a **retained** JamProtocol envelope (type `taste`, sealed with the blend key, the topic as associated data; the envelope's device must be the topic's member), so a member who opens the link hours later still finds it: nobody has to be online at the same time as anybody else (`blend_test live` checks it on all three public brokers with the members never connected together). Leaving replaces it with a sealed retained `left` record. `x` carries `ask` (not retained): a member refreshed and asks those connected right now to share their current taste too — they get a toast, never an automatic send. When the app talks to the broker: after creating (held up to 30 minutes, closed 3 s after someone shared), joining or refreshing; while the page is open (renewed every minute while it is painted); 20 s after startup and every 6 hours, 10 s per blend, one after the other. Every visit re-publishes this PC's profile *as it was shared* (a broker that lost it gets it back) and reads the others'; a newer profile (by `at`) replaces the older one. - **Consent**: creating, joining and refreshing open a dialog with the exact artists and songs (all of them, in a scrolled list), the name and what is not shared; only "Paylaş ve …" sends. "Paylaştıklarını gör" shows what is shared now. Joining reads the others' profiles at once (so the page shows the inviter), but sends nothing before the consent. - **Store**: `blends.dat` = DPAPI-sealed JSON (`v`, `blends`: link, member id, my profile, the others', who left, creator, times), written on a worker (a newer save wins); read on a worker at startup. At most 20 blends. - **UI**: blend cards and a "Blend oluştur" card (outlined, "+") at the end of "Senin için listeler" (Home, Library; the section shows while there is a smart list or a blend). The cover is the smart lists' (mosaic of the first rows' covers, filled from the Stats artwork cache like theirs, band "BLEND · %87 UYUM" + the names). The page (`Route{RouteKind::SmartList, "blend:<id>"}`, `--route smart:blend:<id>`) has the smart list header, a why line ("first the 5 songs you both love…", who left), the track table with a chip per row (`TrackTable::chipFor`: "ORTAK", "SEN", "AYŞE", "AYŞE + CAN"), play / shuffle / add, and a menu: Yenile, copy the invite, Paylaştıklarını gör, queue, "Çalma listesi olarak kaydet" (`promptNewPlaylist`), Blend'den ayrıl. Waiting for a friend / consent pending: the page says so with a button (copy the link / see what would be shared). Invite links open from paste, the search box, "Blend davetiyle katıl…" (palette), `--open-link` and the URL protocol (`links::Kind::BlendInvite`). - **Dev**: `SHADETUBE_BLEND=create | <invite> | refresh:<id> | leave:<id>`, a trailing `!` agrees without the dialogs; `SHADETUBE_BLEND_INVITE_FILE` receives a new blend's link; `blend` lines log every mix change with an order fingerprint (two members' logs show the same one when they built the same list). - **Measured** (two sandbox profiles, EMQX): A created and quit; B opened the link after A had quit, got A's profile in ~1 s and built the list; A started again 30 s later, its startup visit got B's profile: both logs show the same 29-song mix (5 shared, 75 %, the same order fingerprint). A refresh on A reached B's open page as a toast in ~1 s; B leaving showed up on A's next visit. ### 3.51 Listen together: podcasts, radio and restarts Additions to 3.24 in 0.11.0, in the same files (`app/JamProtocol`, `app/JamSync`, `app/Together`). - **Versions**: the envelope's `v` stays 1 — 0.10.0 drops any other value (`OpenError::Version`), so a bump there would turn old peers away with "session not found". New abilities are announced by a **feature level** instead: `pv` in the host's state and in a guest's hello and heartbeats (absent = 1 = 0.10.0; `jam::kFeatureLevel` = 2), and travel in fields older parsers ignore (they read only the keys they know). - **Podcast episodes and stations** keep `"k":"x"` on the wire, so a level-1 guest still holds on them as unsupported (it would read an unknown kind as a song and look the episode's title up on YouTube); `pe` (feed URL, guid, audio URL, type, show, date) or `rs` (stationuuid, stream URL, codec, country, tags, bitrate, HLS) say what they are, and a level-2 parser turns them into `ItemKind::Episode` / `Station` (http(s) URLs only, `podcast:` / `radio:<uuid>` ids only, else they stay unsupported). The host fills them from its podcast / radio stores; episodes of feeds the user added by RSS address (often private, a token in the URL, or on the LAN) stay unsupported. The guest puts the host's copy into its own registry unless it knows the episode / station already (its own copy wins; never for a feed it added by address itself), so the player resolves them as usual — public internet only. - **Speed**: the state's `sp` is the current episode's speed (songs stay at 1 for everyone; the host may now change an episode's speed). `expectedPosition` advances by `elapsed × speed`; the guest sets `Settings::podcastSpeed` / the player's speed to the host's (its own comes back when it leaves, `jam.json`'s `guestSaved`). - **Stations are live**: `decide()` loads the station (no seek, autoplay = the host plays), jumps to it when it is next, follows play / pause, never seeks or measures drift; the panel shows "Aynı istasyon · canlı". The host no longer treats a station's listening time as drift (it re-published its state four times a second, also in 0.10.0). - **Host restart**: closing the app (any exit, including Windows ending the session) no longer ends the session. The host publishes a last retained state (paused where it was, `away` = unix time), says `bye` with reason `away`, and keeps the room in `jam-host.dat` (DPAPI: room id, key, broker, revision, permission, bans, members with their ECDH keys, who added what, saved time), which is also written when the session starts or changes and every minute (a crash). The next start within `jam::kResumeWindowSec` (10 min) resumes it: same room, key and broker first; revisions continue from `unix seconds << 20` (above anything published before, also when the last save is a minute old); sequence numbers start a new epoch as on every connection; members come back offline and turn online with their heartbeats; a toast offers "Oturumu bitir". An older file is cleared from its broker on a worker (an `end` and an empty retained state). Ending the session ("Oturumu bitir", joining another one) deletes the file. - **Guests while the host is away**: on `bye`/`away` (or a state with `away`) they pause where the host was, show "Oturum sahibi uygulamayı kapattı…", stay on that broker (no failover while away) and follow again when a state without `away` arrives ("{} geri döndü"); after the window + 1 minute they leave ("geri dönmedi"). A state found with an `away` older than that counts as an ended session. 0.10.0 guests see the paused state and "host lost its connection", keep waiting, and follow the resumed host by themselves (checked). - **Guest restart**: a guest's app that closes says `bye`/`away` (the host marks it offline, not gone) and keeps the invite in `jam-guest.dat` (DPAPI; rewritten every minute while in a session); the next start within the window joins the room again by itself (its own queue was restored on exit as before and is saved again on the join). Leaving, being removed, the session ending or not being found deletes it. - **Dev**: `SHADETUBE_JAM_DEV=quit@<s>` quits the app (either role) that long into a session; `SHADETUBE_PLAY_STATION` plays a station by name at startup; `--play-episode` and `SHADETUBE_VIDEO_DEMO=speed@<ms>=1.5` drive episodes. - **Measured** (two / three sandbox instances, EMQX): an NPR episode at 120 s followed within +2 … +16 ms, the host's switch to 1.5x reached the guest with one seek; Radio Paradise followed across a "next station" and a station error; host quit + restart 17-30 s later resumed the room with both a 0.11 and a 0.10.0 guest following again; a guest restart rejoined by itself; a 0.11 guest followed a 0.10.0 host's songs. ### 3.52 Built-in Opus / Vorbis decoding YouTube's best audio is Opus in WebM (~160 kbps), and Windows decodes it only with the right Store extensions; stock Windows has no Ogg handler at all. So Opus and Vorbis are decoded by the Xiph reference libraries, vendored and linked statically (`external/libopus` 1.6.1 decoder, `opusfile` 0.12, `libvorbis` 1.3.7 decoder + vorbisfile, `libogg` 1.3.6; official tarballs, SHA-256 in each `CMakeLists.txt`, licenses in `THIRD_PARTY_NOTICES.md`), on every Windows. - **Where** (`audio/Decoder`): `XiphDecoder::probe` reads the stream's first 4 bytes: `OggS` → opusfile, else vorbisfile; the EBML magic → `audio/Matroska` (WebM / Matroska) with an `A_OPUS` (libopus multistream decoder: mapping families 0, 1, 2, 255) or `A_VORBIS` (libvorbis, the Xiph-laced CodecPrivate) track. Anything else (AAC / MP3 / FLAC..., another codec in Matroska or Ogg: `S_FALSE`) goes to the Media Foundation Source Reader as before, so a container Windows can play with an installed handler still plays. Both paths read the same `ProgressiveBuffer` (range requests, the temporary-file / mapping rule, interrupted reads during a seek, decoder reopening): opusfile / vorbisfile through read / seek callbacks, the demuxer through `ByteReader`. Downloads' MP3 transcode (`audio/Downloader`) uses the same `Decoder`, so Opus streams can be downloaded as MP3 everywhere too. - **Matroska demuxer** (`audio/Matroska`): EBML header, Segment, SeekHead, Info (scale, duration), Tracks (the first audio track: CodecPrivate, CodecDelay, SeekPreRoll, rate, channels), Cues — read at open when they come first (YouTube), else at the first seek through the SeekHead — and clusters with SimpleBlocks / BlockGroups (DiscardPadding), Xiph / EBML / fixed lacing, unknown-size clusters. Seeking takes the last cue at or before the target, or walks the cluster headers when there are none. Every size is bounded (16 MB blocks, 1 MB CodecPrivate, 10^6 cues); a damaged file ends or fails cleanly. - **Timing**: positions are exact. Ogg: opusfile / vorbisfile seek sample-accurately and trim the Opus pre-skip and the last page's granule. WebM: presentation time = block time - CodecDelay; the pre-skip and the last block's DiscardPadding are dropped, a seek decodes from the cue before (target - SeekPreRoll, 80 ms) and the Track drops what lies before the target. Matroska block times are whole milliseconds and muxers round them their own way (ffmpeg writes Opus blocks 1 ms late): the first block after a seek is snapped onto the packet grid (`k * duration - pre-skip`, when within 1 ms), so a seek lands on the same samples a straight decode gives. A run's later frames are counted, never taken from block times. - **Output**: interleaved float stereo — mono doubled, 3-8 channels (Vorbis order, shared by Opus family 1) downmixed with -3 dB centre / surrounds, LFE dropped, normalised. The OpusHead output gain is applied. The rate comes from the track's `RatePolicy` (the mix rate in shared mode, 3.53 for exclusive): `audio/Resampler` converts — a windowed sinc (Kaiser, ~80 dB stop band, pass band to 90 % of the lower Nyquist, widened when decimating; 1 kHz sine 48 → 44.1 kHz: 103 dB SNR) with zero delay and a global output grid (`reset(startFrame)`), so a seek never shifts the output by a fraction of a frame and a whole stream gives `ceil(N * out / in)` frames. A chained Ogg Vorbis link at another rate is resampled to the first one's. - **Tags**: R128_TRACK_GAIN (+5 dB: -23 → -18 LUFS) or REPLAYGAIN_TRACK_GAIN of an Ogg file feed loudness normalisation (3.4) after the decoder opened. `audio/XiphTags` gives the local library (3.8) the comments (multi-valued ARTIST, ALBUMARTIST / ALBUM ARTIST, TRACKNUMBER / DISCNUMBER "3/9", DATE / YEAR), the exact duration and the front cover (METADATA_BLOCK_PICTURE type 3, else the first); stock Windows has no property handler for them. - **Live radio** (3.18): Ogg Opus decodes with libopus instead of the Opus MFT (pre-skip dropped after every start / discontinuity), and Ogg Vorbis stations play now: `live::OggDemuxer` collects the identification, comment (title) and setup headers per logical stream (shared by its frames, keyed by a hash of identification + setup), gives each packet its duration from the block sizes (`(previous + current) / 4`, the first only primes) and marks the first frame of every chained stream as a discontinuity; `LiveDecoder` runs `VorbisPacketDecoder`. Ogg FLAC / Speex are still refused. - **Cost** (measured 2026-11-27, Release): the exe grew 470 KB (12 032 512 → 12 503 040 bytes with this round's exclusive mode; the four libraries are nearly all of it). Playing a 90 s 160 kbps file in a sandboxed app, commit was 65.4 MB with Opus (built in) against 69.7 MB with the same AAC through Media Foundation (fewer DLLs mapped: images 220.6 vs 244.5 MB); per track the decoder holds ~0.1-0.2 MB, plus a ~120 KB kernel table while resampling. Decoding (codecs_test --bench): Opus 0.15 % of a core (650x real time), Vorbis q5 0.11 %, AAC through MF 0.20 %; resampling 44.1 ↔ 48 kHz adds ~0.6 % (plain C, no SIMD; MF's own resampler is cheaper, ours keeps the timing exact). - **Tests**: `codecs_test` (5.2) on ffmpeg-made chirp fixtures (`tests/codecs/fixtures`, `make_fixtures.py`): lengths, alignment with the formula (best lag 0), seeks against the full decode, resampling, downmix, tags, the demuxer on hand-built / truncated / damaged input, live Ogg parsing + decoding, a short engine run; `audio_test --webm` runs the whole YouTube suite on Opus streams. ### 3.53 WASAPI exclusive mode *Ayarlar › Ses › Özel mod (WASAPI)* (`Settings.exclusiveAudio`, off by default; `Player::applyAudioSettings` → `AudioEngine::setExclusive`, live; `SHADETUBE_EXCLUSIVE=1|0` overrides it for test programs and sandboxed runs). - **Opening** (`audio/WasapiOutput`): IsFormatSupported(EXCLUSIVE) on the requested rate and channel count, best format first: 32-bit integer, 24-in-32, packed 24-bit, 32-bit float, 16-bit (TPDF dither). Event-driven with equal buffer and period: 20 ms (the default period when refused, the driver's aligned size on `AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED`). Every WASAPI event wants one whole buffer: the engine thread notes which handle woke it (`signalled()`), `writable()` says how much to write (one buffer per event, one before `start()`), the float block is converted at `releaseBuffer()`, and `padding()` comes from IAudioClock (written - played). Latency for video mode's clock: GetStreamLatency (one period) + the limiter. - **Refusal → shared mode**: `AUDCLNT_E_DEVICE_IN_USE` (another app holds it), `..._EXCLUSIVE_MODE_NOT_ALLOWED` (the device's *Allow applications to take exclusive control* is off), `AUDCLNT_E_UNSUPPORTED_FORMAT` or anything else: the stream opens shared (AUTOCONVERTPCM resamples the track's rate) and `WasapiOutput::info().fallback` says why; `AudioEngine::outputInfo()` publishes it with the device format. While another app holds the device exclusively, Windows refuses shared streams too: the engine reports a device error and retries as before. - **Rates** (`RatePolicy`): exclusive mode probes the device's exclusive rates (`exclusiveRates()`: 44.1-384 kHz and a few low ones, stereo, any of the formats) at start, on a device change and when it was refused (while nothing is open). A track decodes at its own rate when the device takes it, else the nearest (an integer multiple first, else the next higher, else the highest); the device opens in that rate. No accepted rate (refused) = shared-mode rate. - **Between tracks** (choice): a track of another rate needs the device reopened — the previous one plays out first, so a gapless handoff gets a short gap (~50-150 ms) and an album of one rate stays gapless. A **crossfade** keeps the rate that plays: a preloaded track with a crossfade decodes at the current track's rate (resampled), so the mix works; the next track that starts on its own (after a pause, a jump) opens at its own rate again. - **Never holding a silent device**: no warm-up open at startup in exclusive mode, and when the output stops while nothing is meant to play (paused, stopped, the queue ended, an error) the client is closed, so other apps play meanwhile and a refused exclusive open is tried again at the next start. Seeks, stalls and the next track loading keep it. - **Unchanged**: equalizer, normalisation, limiter, crossfade, speed, the preview voice (decoded at the rate the device runs at; started on a closed device it takes the held track's rate), video mode's clock and the phone remote (which only drives the Player). Windows' own per-app volume and audio enhancements (APOs) don't apply to an exclusive stream. - **Device change / unplug**: the endpoint notifier works as in shared mode (default changed, our device removed, the preferred device back); the engine closes, re-probes the rates and reopens exclusively on the new device. Toggling the setting reopens the device at once (playing on). - **UI**: the toggle's description says what the mode does and doesn't (other apps silenced, the device freed when paused, which effects apply, the short gap between rates); a status line under it (`ExclusiveStatus`, polled twice a second) shows "Şu an özel modda: 44,1 kHz · 24 bit" or why it plays shared. - **Tests**: `codecs_test --exclusive` (exclusive at the file's rate, a second engine refused → Busy, released while paused, a 44.1 → 48 kHz handoff reopening, a crossfade keeping the rate, the preview, back to shared while playing), `audio_test --exclusive [--webm]`, and `playback_test` / `preview_test` with `SHADETUBE_EXCLUSIVE=1`. ### 3.54 Search kinds, profiles and Spotify podcasts **Search** (`app/SearchPage.cpp`, "Artist and Search pages" above; `spotify/SpotifyApi`). `catalog::SearchResults` holds tracks, albums, artists and, from Spotify only, `playlists`, `shows` (`catalog::PodcastShow`: `spotify:show:` id, name, publisher, notes, cover, media type), `profiles` (`catalog::Profile`: `spotify:user:` id, name, avatar, followers, public playlist count) and `topResult`. `Api::search` (searchDesktop, 12 of each) fills every kind; episodes, audiobooks and genres are left out, and wrappers of another type (`NotFound`, restricted content) are skipped. - **Kinds**: three more entries of `resultKinds()`, after the albums: *Çalma listeleri* (`playlistEntry`: the owner as the line, open / play / the playlist menu / preview, `RouteKind::Playlist`), *Podcastler* (`showEntry`: the publisher; opens `Route{Podcasts, "spotify:show:<id>"}` after `spotifyshows::remember()`, below; a recent search reopens it the same way from its saved name and publisher) and *Profiller* (`profileEntry`: round, no play button, `RouteKind::Profile`; round recent-search cards too). Chips, Tümü shelves, grids, top-result candidates and recent searches follow from the table. MusicBrainz has none of them, so their chips and shelves never appear there. - **Top result**: searchDesktop's `topResultsV2.itemsV2[0]` is Spotify's own top hit; when it is a kind the lists hold (`topResult`, its URI) the card shows that item, wherever it is in its list. Otherwise (MusicBrainz, an episode or genre on top) `browse::pickTopResult` picks one as before. - **More of one kind** (Spotify): a kind's own tab ends with *Daha fazla yükle* (`addLoadMore` / `setLoadMore` in `BrowseWidgets`) when its overview row came back full (12). `Api::searchMore(kind, query, offset, 30)` sends the web player's per-kind query (`searchTracks`, `searchAlbums`, `searchArtists`, `searchPlaylists`, `searchPodcasts`, `searchUsers`; variables as its search route sends them; `pagingInfo.nextOffset` null = the end) from the rows already there; new rows join `results_` (and the session's search cache, so typing back shows them) and the open grid / song list. A page that adds nothing ends the kind. Another tab or query drops a page still on its way. - **Pasted links** (`app/Links`, `app/LinkOpener`): `open.spotify.com/show/<id>` / `spotify:show:<id>` open the Podcastler page of the show, `open.spotify.com/user/<name>[/...]` / `spotify:user:<name>` the profile (the username as the link has it: 1-128 of `[A-Za-z0-9._+-]` and `%XX`). Both need a session like the other Spotify links. The command palette and the phone remote keep using tracks, albums and artists. **Profiles** (`app/ProfilePage.cpp`, `--route profile:<uri>`): spclient `user-profile-view/v3/profile/<name>` (`playlist_limit=0`: name, avatar, followers) and `/profile/<name>/playlists?offset&limit` (50 a page), asked as JSON (the web player asks for the protobuf form of the same messages). Image fields may be `spotify:image:` / `spotify:mosaic:` URIs (turned into `i.scdn.co` / `mosaic.scdn.co` URLs). Spotify drops rows it won't show *after* paging (offset 20, limit 20 gave 16 rows; offset 36 repeats three of them), so the next page starts at offset + limit while that is below `total_public_playlists_count`, which is itself an estimate (1519, then 1515 on the next page). Logged out the page says it needs Spotify; an unknown user is a 404. **The user's Spotify podcasts** (`app/PodcastsSpotify`, UI thread; the Podcastler routes in `app/PodcastsPage.cpp`). ShadeTube never plays Spotify-hosted audio: a show plays through its **public RSS feed**, so each Spotify show is looked up in Apple's directory and played through the existing feed pipeline (3.17). - **Followed shows**: `Api::libraryShows` = libraryV3 with the web player's filter id `"Podcasts & Shows"` (audiobooks and other items skipped). Should Spotify refuse the id (`LibraryInvalidFilterIdError`), the whole library is walked unfiltered and its `Podcast` items kept. The list is reloaded when it is 10 minutes old or the account changed. `Api::show` (queryShowMetadataV2) names a show opened by its id alone. - **Matching** (`podcast::matchScore` / `bestMatch`, standalone, `podcasts_test`): names and publishers become folded words (`foldForSearch`: case, accents, I/ı; `&` = "and"; apostrophes dropped; "the", "a", "an", "podcast(s)" ignored). Same words = 100; one name a whole-word run of the other with at least half its letters = 72..95; else 90 × the Dice coefficient. The same or a contained publisher adds up to +10, an unknown one leaves an exact name at 80, a different one takes 25-30 off, and a short generic name (one or two words under 14 letters: "The Daily") with a different publisher never matches. 70 and up (`kMatchMin`) is the same show; ties keep the directory's order. - **Lookup** (`Client::findFeed`): the directory's search for the show's name in the home store, then the US store; `findFeed` keeps 3.2 s between its own uncached requests (Apple allows about 20 a minute) and throws when the directory can't be asked, which is never recorded as a verdict. The page side (`spotifyshows::resolve`) runs one lookup at a time on a Low worker (a page waiting for one puts it first); a failure is retried after two minutes or on demand. - **Verdicts** (`podcasts.json` `"spotify"`, `podcast::SpotifyLink`, at most 2000, oldest lookups dropped): the show's own name / publisher / cover (pages render it without a session), the matched feed with its directory title, author and score, or none. A match stays; "no feed" is looked up again after a week. *Yanlış podcast mi?* in the matched show's menu turns the link into "no feed" and remembers the rejected feed, which later lookups never pick. These changes don't call the store's listeners (that would rebuild every Podcastler section per lookup); `spotifyshows::subscribe` tells the pages instead. - **Pages**: the Podcastler home shows *Spotify'daki podcastlerin* (cards whose second line says *Abonesin*, *Yalnızca Spotify'da* or the publisher) and starts the lookups of the shows without a fresh verdict in the background, plus a *Spotify podcastlerini içe aktar* chip. `Route{Podcasts, "spotify"}` is the import preview: every followed show with what it resolved to (the directory entry and a toggle, *Abonesin*, *Herkese açık besleme yok* with a lock, *Aranıyor…*, *Kontrol edilemedi*), select all / none and *Seçilenlere abone ol (n)*, which fetches each chosen feed and subscribes it like the show page's button (so the episodes already out are not "new"). Nothing is subscribed without that button. `Route{Podcasts, "spotify:show:<id>"}` waits on a skeleton for the verdict, then shows the matched feed's show page (its menu adds *Spotify'da aç* and *Yanlış podcast mi?*) or a page that says the show can't play here, with *Spotify'da aç*, *Apple Podcasts'ta ara*, *Tekrar ara* and *RSS adresiyle ekle*. **Testing**: `spotify_test` (5.2) parses captured answers (`tests/spotify/fixtures/search_*.json`, `show_metadata`, `profile*`; captured with an anonymous web-player token on 2026-11-26, private people's names replaced) and a `library_shows.json` written in the shape the web player's mapper reads; `spotify_test search` runs every kind, two pages each, a show, Spotify's public profile and its playlists, a missing profile and four shows resolved through the directory, with the saved session or, without one, an **anonymous** web-player token (no account: Pathfinder search, show details and public profiles answer it; it finds only well-known profiles). `podcasts_test` covers the matching, the link store and (`live`) `findFeed` with its request spacing. ### 3.55 Last.fm and ListenBrainz history import Stats › *İçe aktar* (a menu: Spotify, Last.fm, ListenBrainz) and, until something is imported, three cards in a row ("Spotify geçmişini getir" and its two new neighbours) bring scrobbles into the listening stats (3.8). `app/ScrobbleImport` (standalone: core + ListenStats + HistoryImport's ZIP reader) fetches / reads them; `ListenStats::buildImport` matches, dedupes, times and stores them; `app/StatsPage.cpp` has the dialog, the cards, the progress banner and the job thread. - **Last.fm API**: `user.getRecentTracks`, 200 a page, by user name (pre-filled: the account this history imported from last, else the connected scrobbling account; see "Several Spotify accounts" below). Last.fm hands out listening history only with an API key and the app has none of its own: it uses the key of Settings › Bağlantılar (the scrobbler's, 3.10); without one, or after Last.fm refused it, the dialog asks for it and stores it there (key only: scrobbling still needs the secret and the login; a new key drops the old key's secret and session). Under a fixed `to` (the run's start) the newest page is fetched first only for the page count (and kept), then the pages from the oldest to the newest: whatever the import has behind it is always one stretch from the start. Errors: 6 (no such user), 17 (private), 10 / 26 (key), 29 (rate limit); the now-playing entry and undated scrobbles are left out; a single scrobble comes as an object. - **ListenBrainz API**: `GET /1/user/<name>/listens?min_ts=<t>&count=1000` moves forward from the oldest listen (`/listen-count` first, for the progress total); a page's last second is asked again (`min_ts` = its newest - 1) so listens sharing it are never lost (the repeats are duplicates). The connected account's token is sent along. - **Politeness**: one request at a time, at least 250 ms apart; HTTP 429 / 503 and Last.fm's error 29 wait for `Retry-After` (seconds or an HTTP date) or ListenBrainz's `X-RateLimit-Reset-In`, else a backoff; `X-RateLimit-Remaining` 0 holds the next request until the window resets; network errors, 5xx and Last.fm's 8 / 11 / 16 are retried with a backoff of 2 s doubling to 60 s, 6 times. A rate-limit wait shows in the banner. The job runs on its own thread (`st-history-import`, minutes of network would otherwise hold a pool worker); "Durdur" cancels it (the request in flight is aborted through its CancellationToken), exit cancels and joins it. - **Batches, cursors, resume**: rows go into a compact `ListenStats::ImportBatch` (each distinct song once, 24 bytes a play) and every 20 000 rows `buildImport` merges them and writes the source's file (`runJob`), so memory holds one batch and an import that stops (Durdur, an error, the app closing) keeps every batch so far. API imports store a cursor per account in their file's `"sync"` (everything the account scrobbled before `next` is imported; never past the run's start, whatever a wrong client clock stamped on a listen); the next run starts from the cursor minus 14 days (scrobbles that reach the service late carry older times: the overlap is read again and deduplicated), so it fetches only what is new (live: 656 listens in one request after a 75 725-listen import). File imports have no cursor. - **Files** (`.csv .tsv .txt .json` for Last.fm, `.zip .jsonl .json` for ListenBrainz): lastfm-to-csv (benjaminbenben: `artist,album,track,"14 Nov 2023, 22:13"`, no header, BOM), CSV / TSV with a header (Ghan's `uts,utc_time,artist, artist_mbid,album,album_mbid,track,track_mbid`; lastfmstats.com's `Artist;Album;AlbumId;Track;Date#<user>` in ms; the delimiter is guessed), JSON (lastfmstats' `{"username","scrobbles":[..]}`, Ghan's raw API pages `[[track..]..]`, saved replies), the ListenBrainz export ZIP (`listens/<year>/<month>.jsonl`; `user`, `feedback`, `pinned_recording` skipped), a `.jsonl` or an older JSON array of listens. JSON is read with a SAX handler that builds each object alone and hands a scrobble record out as soon as it closes, never attaching it to its parent, so the arrays around records stay empty (a 64 MB, 100 000-scrobble Ghan file reads with +0.2 MB private memory); it gives up after 200 000 nodes without a record (a file that isn't a history). CSV / JSON lines go a line at a time, a ZIP a month at a time. Records of the other service are skipped (and the file reported as no history of this one). - **Matching the songs** (`Resolver` in buildImport, against everything known): the same id is that song (a ListenBrainz-mapped recording MBID = a MusicBrainz track here, a Spotify URI); an artist or album with a known id (MBIDs: Last.fm's artist MBIDs, ListenBrainz's mapped artists and release groups) takes the known name ("Mazhar Fuat Özkan" with MFÖ's MBID files under MFÖ); a credit "A feat. B" / "A & B" / "A, B" / "A x B" whose first part is a known artist (and the whole credit is not) or makes a known song is split, so it files under A like the plays heard here. Everything else groups by folded name + first artist as always (3.8). ListenBrainz's mapped artists (MusicBrainz's credit) are used when present, else the client's `artist_names`; MBIDs become ids the way MusicBrainz songs have them here (recording / artist / release group), which also makes the entries open their pages. Covers: Last.fm's 300 px image (not its placeholder star), Cover Art Archive for mapped listens. Songs without an id get the `import:<hash of name|artist>` id the Spotify account data uses. - **Duplicates** (every source and this PC at once, per song): two measured plays (this PC, Spotify's files) as before (overlap / same end, 3.8). A scrobble on either side carries only its start: it is a play already known when both started within half the song's length (a measured play's own length; for a scrobble the song's known length, else unknown: 30 s), clamped to 30 s .. 2 min. ShadeTube's own scrobble starts a few seconds after the play it records; Spotify's scrobble is the real start while its file gives end minus time played (later by any pause); the same scrobble on Last.fm and ListenBrainz has the same second. Two real plays of one song are at least half its length apart (a scrobble needs half the song), so a song repeated is not merged. Plays left out as duplicates are not stored, so removing a source can take a play another source also had: a removal forgets the other sources' cursors, and their next import reads the whole account again and brings those back. - **Minutes**: scrobbles carry no listening time. A scrobble lasts its song's length when some source knows it (ShadeTube's catalog, ListenBrainz's `duration_ms` / `duration`), else the longest play of it measured here or in Spotify's history when that is at least a minute, else 3:30 (`listen::kScrobbleDefaultMs`); never past the start of the next play in the merged history (any source: a radio's scrobbles a minute apart count a minute each), and never under what makes it a stream (30 s, or half a song shorter than a minute; a scrobble means it was listened to). The estimate is stored with the play; it is not recomputed when later imports add plays around it. - **Storage**: `listening-lastfm.json`, `listening-listenbrainz.json` next to `listening-imported.json` (Spotify), the same flat format plus `"sync"`. Each is removable on its own (Geçmişi temizle › *İçe aktarılan … geçmişini kaldır*); plays carry their source (`ListenStats::Play::source`), counts per source (`importedCount(source)`). The imported files are read with a SAX reader (no document tree, no copy of the index), which made the 75 725-listen import 3× faster and smaller. - **Several Spotify accounts** (Several Spotify accounts section): the imported files are siblings of the store's `listening.json` (`ListenStats::importedFileFor`), so they follow the active account like the main history: in `accounts\<id>\`, in the profile root without an account (MusicBrainz / YouTube Music), all four in `accounts::perAccountFiles()` (a 0.10 profile's `listening-imported.json` moves into the first account as before; so would Last.fm / ListenBrainz files a root profile already has). `detach()` writes a removal not saved yet for each source, empties the imported plays, counts and cursors with the rest; `attach()` + `readFile()` bring the next account's back. A running import is stopped by the leave hook before `detach()`: the Last.fm / ListenBrainz job is cancelled and joined (its last batch and cursor land in the account being left, ~1 s), a Spotify pool job stops reading; its result arrives superseded and changes nothing in the new account (`ImportResult::file` is compared, so the new account's file is not marked for a rewrite); a toast says it stopped because of the switch. Back on that account, an API import resumes from its cursor. **Pre-filled user name: per account** - the account this history imported from last (its cursors, moved last on every import, live in the account's own file); only a history that never imported from the service gets the PC's scrobbling login (Settings › Bağlantılar, `scrobble.dat`, stays one per PC as the accounts feature left it), so on a shared PC one person's Last.fm is not offered to another person's history that has its own. The Last.fm API key is the PC's too. - **Measured** (Release, this PC, `history_test live lb <user>`, public accounts): 75 725 listens (32 847 songs) in 77 requests and 4 batches, 41 s, peak +61 MB private (process peak commit 87 MB), the next run 1 request / 0.5 s; 220 287 listens (219 827 plays after duplicates, 33 760 songs) in 222 requests and 12 batches, 308 s (the network: ~1.4 s a page), peak +70 MB private (process 105 MB), the next run 1 request / 0.7 s. The peak is the history's index built once more for a batch's merge (the store keeps its own until the result is installed); the rows never exceed one batch. Offline (Release): a 64.5 MB Ghan JSON of 100 000 scrobbles reads in 1.0 s with no measurable memory growth; 100 000 listens through `runJob` in 6 batches in 2.0 s. A Debug build is 3-25× slower and needs about twice the memory. - **Dev**: `SHADETUBE_IMPORT_SCROBBLES` starts an import once the history is loaded, `SHADETUBE_IMPORT_DIALOG` opens the dialog (5.4); `history_test` (5.2) replays fake Last.fm / ListenBrainz servers, reads every export format from `tests/history/fixtures` (`make_fixtures.py` regenerates them) and runs live imports. ### 3.56 YouTube Music catalog YouTube Music (music.youtube.com) is the third catalog, next to Spotify and MusicBrainz: an open catalog like MusicBrainz (no account; the anonymous web client), picked on the connect screen ("YouTube Music ile keşfet" / "MusicBrainz ile keşfet" under "Spotify olmadan keşfet") or in *Ayarlar › Spotify hesabı › Spotify olmadan katalog* (`Settings.openCatalog`: `"musicbrainz"` default | `"ytmusic"`). Logged in to Spotify, Spotify stays the catalog; logged out, the open catalog is the chosen one. `source::applyOpenCatalog()` mirrors the setting for worker threads (an atomic: `Settings` is UI-thread only) and reopens the current page on a switch from the connect screen. - **Transport** (`YoutubeExplode::Music::MusicClient`, `external/YoutubeExplode`): `YoutubeClient::music().send()` POSTs to `music.youtube.com/youtubei/v1/<endpoint>` with a `WEB_REMIX` context (version `1.<date of 3 days ago>.01.00`, `hl` / `gl`) through the client's `ClientContext`, so the consent cookie, YouTube's cookies, 5xx retries and the 429 mapping are the ones playback uses (the app passes MatchService's client: `ytm::setClient`). YouTube Music keeps a visitor of its own: the first answer's `responseContext.visitorData` is sent with every later request of the session (context + `X-Goog-Visitor-Id`), and the request that obtains it goes alone (the others wait), so the session never has two. The www.youtube.com visitor (`sw.js_data`) is not sent: with it the Home feed's continuations come back empty (verified 2026-11-27). `resetSession()` drops it with the rest. - **Ids**: a song is `yt:<videoId>` with `Track::videoId` set: the id pasted YouTube links and imported YouTube playlists already use (3.10, 3.21), so liked songs, local playlists, history, stats, downloads and the blocklist treat it like any song, and `MatchService::resolve` plays exactly that video, never a search (it also derives the video from a `yt:` id whose copy lost `videoId`). Collections: `ytm:album:<MPREb_…>`, `ytm:artist:<UC…>`, `ytm:playlist:<id without VL>`. `source::album / artistPage` route `ytm:` ids to YouTube Music in every mode, like `spotify:` URIs to Spotify, so a mixed history keeps opening. - **Parsers** (`ytmusic/Parse`, pure): InnerTube answers are renderer trees 10-20 levels deep that move between experiments (the same unfiltered search came back as `musicShelfRenderer`s per type and as one `itemSectionRenderer` per row). Nothing walks a fixed path: the parsers find the renderers that carry data wherever they sit (`musicResponsiveListItemRenderer` rows, `musicTwoRowItemRenderer` cards, `playlistPanelVideoRenderer` queue rows, `musicCardShelfRenderer` top results, the page header among `musicResponsiveHeaderRenderer` / `musicDetailHeaderRenderer` / `musicImmersiveHeaderRenderer` / `musicVisualHeaderRenderer`) and classify each row by what it links to: the browse page type (`MUSIC_PAGE_TYPE_ALBUM / ARTIST / PLAYLIST`; user channels, podcasts and episodes are left out) or the watch endpoint's music video type (`ATV` = a song, `OMV` / `UGC` = a video, `PODCAST_EPISODE` dropped). Subtitles are split at their " • " runs into credits (linked artists plus plain names between ", " / " & "), album, length, year and counts. Requests are sent with `hl=en` so the few words read ("Single", "EP", "songs", an artist page's shelf titles) are predictable; Home and the mood tiles are asked for in the UI language and shown as they come. googleusercontent / ggpht pictures carry their size in the URL: larger renditions are added (544 / 1080 px) and an artist's wide header banner becomes centered square crops (`-p`). Missing fields keep defaults, a row without an id is skipped, no shape throws. - **Endpoints** (`ytmusic/YtMusic`, blocking, worker threads): search (`ytm::search`, the Search page) = the unfiltered answer (its top result card names `SearchResults::topResult`) and the first page of each kind (`ytm::searchMore`: songs, albums, artists, playlists = the featured lists, then the community's) in parallel; a kind whose own request fails takes the overview's rows. `searchMore(query, kind, offset, count)` follows a kind's continuations (`ctoken=` URL parameters) and keeps what it paged for 10 minutes, so "Daha fazla yükle" asks only for what is new. `ytm::searchQuick` is the unfiltered answer alone: one request per keystroke for the command palette (`source::quickSearch`). Album = `browse MPREb_…` (header, tracklist, `Album::releaseId` = its `OLAK5uy_…` audio playlist). Artist = `browse UC…` (the header: square avatar crops of its 1080 × 450 picture plus that picture as the page's banner, monthly audience, subscribers as followers, the description: Wikipedia's summary with its credit line turned into `bioSource` / `bioUrl`, else the artist's own text; albums, singles & EPs, appears on, "Fans might also like", "Featured on" / "Playlists by" as the playlists featuring the artist, the header's "Mix" radio) plus the first page of its "Top songs" playlist: the page shows five songs without lengths, that list has them by popularity with lengths and albums (top songs = its first 20). The albums and singles carousels show about ten each; their "More" (`MPAD<channel>` + params, `MUSIC_PAGE_TYPE_ARTIST_DISCOGRAPHY`) is the whole group: `albumsTotal` / `singlesTotal` are one more than shown when it exists (YouTube Music gives no count) and `ytm::artistReleases` (`source:: artistReleases`) reads it when the discography grid opens. Playlist = `browse VL<id>` (about 100 rows) and continuations, new style (`continuationCommand`, in the body) or old (`nextContinuationData`, as `ctoken=` URL parameters). Home = `FEmusic_home` with two continuation pages, `FEmusic_explore` (new albums & singles, trending, new videos) and `FEmusic_charts` (chart playlists, top artists) in parallel. Moods = `FEmusic_moods_and_genres`, a mood = `FEmusic_moods_and_genres_category` + its params. Radio = `next` with `RDAMVM<video>` (a song), `RDAMPL<OLAK…>` (an album), the artist's `RDEM…` mix, `RDAMPL<id>` (a playlist), else the radio of the collection's first song; 50 rows a page, continuations to 100. - **Caches**: parsed albums (30 min), artists / first playlist pages (15 min) and searches / paged kinds (10 min) in memory; on disk (`cache\ytmusic`, one file per answer, pruned of tracking data, menus and accessibility labels: about a quarter of the raw size) albums for 7 days, artists, their songs lists and discographies for a day, the first page of playlists for 6 hours, the mood tiles for a day; at most 32 MB (the oldest files go first, checked every 32 writes). Searches, Home, radios and continuations are never written. *Ayarlar › Kitaplık ve depolama › Önbellek* counts it with the catalog cache and "Temizle" clears it with the covers. - **App**: the Search page (3.56 Artist and Search pages) takes YouTube Music's answer through its kinds: songs, artists, albums and playlists, the top result card, and "Daha fazla yükle" per kind tab through `ytm::searchMore` (`SearchPage::loadMore`, like Spotify's `Api::searchMore`); its empty view shows YouTube Music's moods & genres as tiles per group, a tile opening that mood's shelves of playlists. The Artist page shows everything above (the discography grid complete through `artistReleases`; sections YouTube Music has no data for are left out), with the radio button and "YouTube Music bağlantısını kopyala". Playlists open read-only in the collection page with progressive paging, "Yerel listeye aktar" (`transfer::importYtmPlaylist`: a local copy, rows pinned to their videos), export and download sync (`DownloadSync` lists them through `ytm::playlistTracks`). Home (logged out, YouTube Music): the local sections, then "Sana özel" (artists YouTube Music relates to the one played most here) and YouTube Music's shelves through `ShelfCache` (key `"ytm"`, fresh for 20 min, retried after 20 s); its song cards play the shelf from that song. Radio (3.6): `radioSeed` accepts `yt:` songs and `ytm:` collections and `fetchRadio` asks `ytm::radio` for them (context `ytmradio:<seed>`); endless playback seeds from `yt:` songs too, so a YouTube Music queue never runs dry. Smart shuffle / "Geliştir" and the daily mixes' fresh songs use the same song radio for `yt:` songs. Stats artwork lookups use one filtered search (`ytm::searchKind`). Pasted `music.youtube.com/browse/MPREb_…` and `/channel/UC…` links open the album / artist; a YouTube playlist link opens as a YouTube Music playlist page while it is the catalog (imported as before otherwise). - **With the other 0.11 parts**: song credits of a `yt:` song come from MusicBrainz by title and artist (the fallback for every song without a Spotify / MusicBrainz id); the song cache (3.56 Song cache) is keyed by video id + itag, and `Player::resolveSong` takes the video of a `yt:` song straight from its id, so a cached YouTube Music song plays offline; Blend keys songs by folded title + artist and plays a `yt:` song from another member pinned to its video (`MatchService` and the player derive it from the id); listen together pins the host's video. With several Spotify accounts the open catalog applies only while no account is signed in (`source::loggedIn()` is the active account's session). - **Local library**: liked songs, saved albums, followed artists and local playlists are this PC's (the active profile's), exactly as in MusicBrainz mode; stats, smart lists, downloads, sync and the blocklist work on the `yt:` / `ytm:` ids unchanged. - **Tests**: `ytmusic_test` (5.2) parses responses captured from music.youtube.com (`tests/ytmusic/fixtures`: real answers cut down to a few rows per list, shelves kept whole, noise keys removed; `ytmusic_test dump <file>` prints what the parsers make of a new capture) and, with `live`, exercises every endpoint (search, the one-request quick search, paging songs and playlists, the full discography, the disk cache) and plays a search result through `MatchService` to check the video is the one YouTube Music named. ### 3.57 Setup (ShadeTubeSetup.exe) Releases ship two editions: the portable zip (as before) and `ShadeTube-<ver>-setup.exe`, a small native setup with its own window, built on the app's `gfx` / `ui` libraries (no installer framework). The app itself no longer offers "Bilgisayara kur" (3.11). - **Targets** (`src/setup/CMakeLists.txt`): `st_setup_core` (Payload, SetupArgs, SetupEngine; links `st_install`, the installer / updater / autostart code the app uses too), `setup_pack` (a build-host tool) and `ShadeTubeSetup` (`bin\ShadeTubeSetup.exe`: SetupUi + main, linking `st_ui`). The setup's VERSIONINFO says `ShadeTube Setup`, never `ShadeTube`, so the updater's `verifyExe` can never take it for the app; its manifest is `asInvoker` + PerMonitorV2. - **Payload** (`setup/Payload`): `ShadeTube.exe` of the same build plus `LICENSE.txt`, `THIRD_PARTY_NOTICES.md` and `OFL.txt`, packed by `setup_pack payload` into the RCDATA resource `payload`. Format: magic `STSETUP1`, the app version, a file table (name, size, SHA-256), the files' bytes concatenated and cut into 4 MB blocks, each compressed on its own with the Windows Compression API (cabinet.dll: LZMS for release builds, XPRESS_HUFF in Debug, which packs 43 MB in 1.5 s), and a SHA-256 seal over everything before it. `read()` checks the seal and the structure (plain file names only, block count and sizes consistent) before anything is trusted; `unpack()` decompresses block by block (progress per block, one block of memory), checks every file's SHA-256 and size and deletes what it wrote on any failure. The packer refuses an exe whose ProductVersion is not the build's version, and the setup runs `updater::verifyExe` (PE x64 GUI, ProductName `ShadeTube`, ProductVersion == the payload's version) on the unpacked exe before it touches the install folder. - **Translations**: `setup_pack i18n` scans the setup's sources plus what it links that calls `tr()` (`ui`, `gfx`, `core`, Installer, Updater, Autostart) with the rule of `tools/i18n_check.py` and embeds only those keys of each `assets/i18n/<code>.json` (~140 keys, ~15 KB a language instead of ~180 KB). The language follows Windows' display language among the app's (`i18n::init("")`); `--lang` overrides it. - **What it does** (`setup/SetupEngine`, no UI: the silent mode and `setup_test` call it directly): `detect()` reads the uninstall key (installed folder, version of its exe, missing exe), whether the Start menu / desktop shortcuts start that exe, "Windows ile başlat" (the app's `startWithWindows` in settings.json and its Run value) and the running ShadeTubes (`installer::runningInstances()`, windows of the app's class). `actionFor()`: nothing installed = Install, older = Update, the same or the exe missing = Repair, newer = Downgrade. `run()` for an install: read + seal (8 %), every running ShadeTube asked to quit with WM_QUIT, the way the uninstaller does it (App::run saves settings, library and queue on the way out; 30 s each, then the single-instance mutex is awaited; a copy that stays is not fatal: `install()` renames its exe away like the updater's swap and the new one starts next time), unpack into `%TEMP%\ShadeTubeSetup-<pid>-<tick>` (15-75 %), `verifyExe`, `installer::install()` (exe through a temp copy and one rename, the licenses, the uninstall key, the shortcuts asked for; one of ours no longer wanted is removed, a user's own shortcut never), the old folder's own files when the install moved, then "Windows ile başlat": `installer::setStartWithWindows()` patches settings.json's `startWithWindows` in place (every other value, also a newer version's, stays) and writes / removes the Run value, because the app re-syncs the Run value from that setting at every start. Uninstall: the copies running from the install folder quit (one that doesn't is an error), with the data also the others (one that stays keeps the data), then `installer::uninstall()`. The registration is the one the app knows: `UninstallString` stays `"<dir>\ShadeTube.exe" --uninstall`, so Windows' *Installed apps* and the app's own *Uygulamayı kaldır* keep working, and the in-app updater keeps updating the installed exe in place. - **The window** (`setup/SetupUi`): an 800 × 620 DIP `ui::Window` (custom chrome, not resizable, class `ShadeTube.Setup` so running-instance lookups never see it, rounded corners asked for on Windows 11; on a work area too small, e.g. 1366 × 768 at 125 %, it is zoomed out to fit). Left: a sunken panel with the accent's glow and the record: the logo mark (recolored to the theme's accent) inside two hairline rings and a dial of 72 ticks that light up clockwise with the progress; the mark spins like a record while files are written and slows to a stop, then a check (or error) badge appears. Right, one page at a time (pages slide / fade in 240 ms, out in 120 ms): *welcome* (mono label, a two-line hero set at the largest size that fits, the subtitle, the folder field with *Değiştir…*, an `IFileOpenDialog` folder picker; a picked folder gets `\ShadeTube` appended and is checked for writing without admin rights, one note line under it: the size needed / free / no admin rights, or ShadeTube is open, or the folder can't be used; options as rows with the app's toggles: Start menu, desktop, start with Windows, open when done; Kur), *maintenance* (update / repair / downgrade text and button, the installed folder read only, *Kaldır…*), *uninstall* (*Ayarlarımı ve kitaplığımı sakla*, on by default; the focus starts on *Vazgeç*), *progress* (the percentage in the language's order (`%{}`), the player bar's flowing wave line as the bar, the steps ticking off with checks, the taskbar button's progress), *done* (*ShadeTube'u aç* / *Kapat*; with "open when done" the app starts with `--installed` / `--updated`, which toast in the app, and the window closes 1.8 s later), *error* (the reason, *Tekrar dene*). The work runs on a worker thread; progress reaches the UI through the `Dispatcher` and the shown value eases towards it; the progress page stays at least 1.2 s (0.4 s without motion) so it can be read. A page that needs more room in a language (a three-line subtitle) gets a smaller hero and tighter rows until it fits. Theme: the app's own mode from the profile's settings.json (dark when there is none, like the app; "Sistem" follows Windows, live); "Hareketi azalt" and Windows' animation effects off stop the spin, the wave and the transitions. Keyboard: Enter = the page's main action, Esc = back / close (the window ignores closing while it works), Tab / Shift+Tab with the app's focus ring; the empty areas drag the window. One setup at a time (`Local\ShadeTube.Setup`, per sandbox): a second one brings the first to the front, or exits 1618 with `/S`. An elevated setup ("Run as administrator") starts the app through Explorer (`IShellDispatch2::ShellExecute`) so it runs with normal rights. - **Command line** (`setup/SetupArgs`; `/?` shows it): `/S` silent (no window, the result in the exit code), `/D=<folder>` (NSIS style: last, may contain spaces, quotes optional; used as given), `/DESKTOP`, `/NOSTARTMENU`, `/AUTOSTART`, `/LAUNCH`, `/UNINSTALL` (with `/S` silent; `/REMOVEDATA` also deletes the user data). A silent update keeps the shortcuts as they are (a desktop shortcut only goes away when asked), "Windows ile başlat" is left alone unless `/AUTOSTART`. Exit codes: 0 done, 1 failed, 87 bad command line, 1602 the window was closed before anything was done, 1618 another setup is running. - **Sandbox** (tests, screenshots): `SHADETUBE_SETUP_SANDBOX=<folder>` (`installer::applySandbox()`, called first by the setup and by `setup_test`) sets the installer's locations (`SHADETUBE_INSTALL_DIR`, `_SHORTCUT_DIR`, `_DESKTOP_DIR` inside the folder, `_UNINSTALL_KEY` and `SHADETUBE_RUN_KEY` under `HKCU\Software\ShadeTubeSandbox\<id>`, `<id>` a hash of the folder), the profile (`SHADETUBE_DATA_DIR`) and the instance class / mutex, each unless set already; child processes (an app the setup starts, the uninstall helper) inherit them. Nothing of the user's is touched then: no Start menu, desktop, *Installed apps* or Run entry, no app identity, and the user's running ShadeTube is never asked to quit. Remove `HKCU\Software\ShadeTubeSandbox` afterwards (`setup_test` does). - **Dev flags**: `--screenshot <folder>` renders every page with made-up states (`welcome`, `welcome-running`, `folder-error`, `update`, `repair`, `downgrade`, `uninstall`, `progress`, `progress-update`, `progress-uninstall`, `done`, `done-launch`, `done-update`, `uninstalled`, `error`) to `<page>.png` without showing a window or installing anything; `--page <name>` only that one; `--theme dark|light`, `--scale <f>` (e.g. 1.5, whatever the monitor), `--lang <code>`. E.g. `set SHADETUBE_SETUP_SANDBOX=%TEMP%\st-sb` then `ShadeTubeSetup.exe --screenshot %TEMP%\st-shots --theme light --scale 1.5`. - **Size and speed**: 8.2 MB (Release), an install in about a quarter of a second; numbers and what was not run live in 7. ### 3.58 Lyrics tools: the synchronizer and "Sözden şarkı bul" Two features around lyrics: timing plain (or badly timed) lyrics by hand, and finding a song by a line of it. `lyrics/LyricsSync` (the draft), `lyrics/LrclibPublish` (LRCLIB's publish API) and `lyrics/LyricSearch` (Genius' lyrics search) are standalone (core only, `lyrictools_test`); `app/LyricsSync` and `app/LyricSearch` are their UI. **Söz senkronlayıcı** (`showLyricsSync(track)`, a `ui::Dialog` subclass, 680 DIP): - **Entry points**: the lyrics picker's "Senkronla…" (3.46; next to *Dosyadan yükle…* / *Söz yok*), a "Senkronla" chip in Now Playing's lyrics toolbar while the lyrics on screen are plain (one toolbar entry), the command palette's "Söz senkronlayıcı" (the playing song; a song, not radio or an episode). - **Three steps** (`ChipTabs`; Ctrl+Enter goes on): *Metin*, *Senkronla*, *Önizle*. The song's lyrics are fetched when it opens (`lyrics::fetch`, the user's pick included): plain ones become the lines, synced ones keep their stamps so a badly timed file is redone line by line, none = an empty text. *Metin* is a multi-line editor of its own (lines, caret and selection across lines, the clipboard, word moves; it derives from `ui::TextBox` only so that `App::handleKey` treats it as text input and runs no playback shortcuts). Blank lines are left out (stanza breaks aren't tapped); a line of only "♪" is an instrumental gap, stamped like a line and saved as an empty LRC line. Pasted LRC keeps its times. Editing the text after stamping keeps the stamps of the unchanged lines (longest common subsequence, `SyncDraft::setText`). - **Senkronla**: entering it the first time seeks to 0 and plays. Space / Enter (or *Damgala*) stamps the cursor line with the song position and moves on; later lines stamped at or before that time lose their stamp (they come next). ⌫ goes back a line (its stamp is redone) and replays from shortly before the line above it; ↑ / ↓ move the cursor, Delete clears its stamp, ⇧← / ⇧→ nudge the line stamped last by 0.1 s, ← / → seek 5 s, P pauses, Ctrl+Z undoes (200 steps). Speed chips 0,5× / 0,75× / 1× (`Player::setSpeed`). The list (`StampList`) marks the cursor line in the accent, the line playing now with a dot and a stamp earlier than the line above it in the warning color; a click moves the cursor, a double click plays from its stamp. Stamps are song time: `lyricsClockMs + lyricsOffset` (the SponsorBlock cuts taken out, the per-track offset not applied); saving resets the offset (`setLyricsChoice`). - **Önizle**: the result as Now Playing shows it (the playing line large, the others dimmer by distance, the same 150 ms lookahead); unstamped lines get times between their neighbours (`SyncDraft::toLyrics`). ⇧← / ⇧→ (and the chips) nudge the playing line; a click plays from a line. - **While it is open** the song repeats (`RepeatMode::One`) so the next one doesn't start; the repeat and any speed it set are put back when it closes, and at exit (a persist hook) if the app quits with it open. A song change under it (media keys, the remote) swaps the controls for "Şarkıyı çal"; saving still goes to the song it was opened for. - **Kaydet** (enabled when every line is stamped in order): `Offsets::storeText` writes `lyrics\<track id>.lrc` (UTF-8 with BOM, `[ti:] [ar:] [al:]`) and `setLyricsChoice(File)` makes it the song's own lyrics, exactly what "Dosyadan yükle…" does: it wins over every online source, survives restarts, and the views reload. For a download or a local file the .lrc also goes next to the audio file (`writeLyricsSidecar`); a sidecar already there is kept as `<stem>.lrc.bak`. Esc, *Kapat* and the scrim ask before throwing away unsaved stamps. - **Dışa aktar…**: an `IFileSaveDialog` for `<Artist> - <Title>.lrc` (`SHADETUBE_LYRICS_EXPORT` answers it in tests). - **LRCLIB'e gönder…** (needs a title, an artist and a length of 1-3600 s): a second dialog says what goes public (title, artist, album, length, line count) and that it can't be taken back; only *Herkese açık olarak gönder* sends it. Then, on a Low worker: `POST /api/request-challenge` → `{prefix, target}` (64 hex digits, 5 minutes), the proof of work (`lrclib::solve`: n with SHA-256(prefix + decimal n) ≤ target as big-endian numbers, LRCGET's algorithm; our own SHA-256, one block per try, `hardware_concurrency` threads up to 8; the target LRCLIB hands out, `000000FF…`, takes about 2^24 tries: 3 s in a Debug build, well under a second in Release), then `POST /api/publish` with `X-Publish-Token: <prefix>:<nonce>` and `{trackName, artistName, albumName, duration, plainLyrics, syncedLyrics}`. 201 → a thank-you toast; `IncorrectPublishTokenError`, another 4xx (its message shown), 429 / 5xx / offline → an error toast. Nothing is ever sent without that button. `SHADETUBE_LRCLIB_URL` points the flow at a mock server. **Sözden şarkı bul**: - **Source**: Genius' lyrics search, the site's own JSON endpoint (`genius.com/api/search/lyric?q=…&per_page=10`, no key). Measured on 2026-11-27 with 13 fragments (English, Turkish with and without its letters, Spanish, German): the right song first for all 13, with the passage it matched (`highlights[].value` + `ranges` in UTF-16 units). YouTube Music's search had it in its first two rows for 12 (some only as a video, a cover or a lyric video; nothing for the German one) and names no passage; Deezer's search had it first for 6; LRCLIB's `q` searches only title / artist / album (0 of 13). - **Parsing** (`parseGeniusLyricSearch`): song hits only; Genius' translation and romanization pages ("Genius Türkçe Çeviriler"…) and instrumentals dropped; matches clearly worse than the best (fewer exact words or more typos by more than one: `nb_exact_words` / `nb_typos`) dropped; equally good ones ordered by page views (the original before its covers); one entry per song (`foldTitle`: case, accents, Turkish i, brackets and " - …" versions out). The snippet is the context line with most highlighted characters, or two neighbouring lines when the fragment ran over a line end ("Akşama doğru azalırsa yağmur / Kız Kulesi ve Adalar"). - **In the active catalog** (`lyricsearch::resolve`): each hit is looked up by "<title> <main artist>" (Spotify `searchMore(Tracks)`, YouTube Music's songs search, MusicBrainz `recording:"…" AND artist:"…"`), in parallel, and the first playable track that is the same song (`lyrics::sameSong`: folded titles equal or one running on by whole words, an artist matching, a leading "The" ignored) stands for it. On MusicBrainz (a request a second) only the first four are looked up. Two hits that are one catalog song are shown once. A hit the catalog doesn't have (or wasn't asked for, or couldn't be asked) shows the source's title and cover, dimmed; choosing it runs a normal search for it. - **Fallback**: when Genius can't be asked (offline, a bot check instead of JSON), YouTube Music's songs search for the line (its rows are the catalog's own in YouTube Music mode, looked up otherwise), with a note that no line can be shown. Genius answering "nothing" is shown as nothing (no fallback: YouTube Music always answers something). - **Search page** (one `ResultKind`-independent tab, `kLyricsTab` in `tabKinds_`): the *Sözler* chip is offered after the catalog's chips for queries that read like a line of lyrics (`looksLikeLyrics`: three words or 18 letters; never for a name); when the catalog has nothing for such a query the tab is shown alone. The search runs only when the tab is shown: the source's songs first (rows at once, "KATALOGDA ARANIYOR…"), then the lookups (the rows fill in); answers are kept for the run (12 queries per catalog). Rows (`HitRow`): cover, title, artist · album, the line in quotes with the matched words in fg.primary at 620, a note when not playable; Enter / a click plays it with the other found songs after it (context "Sözden bulunanlar"), the menu key / right click opens the song's menu; arrow keys move between rows like the other results. `Route{Search, "lyrics:<query>"}` opens the page on the tab (the route is retargeted that way while it is shown, so Back returns to it); with an empty box it explains what to type instead of the genre tiles. - **Command palette**: "Sözden şarkı bul" (the Search page in that mode) and, while the typed text reads like lyrics, "Sözlerde ara: “…”" (not kept in the recent picks). - **Privacy**: only the typed line goes to Genius (with the app's User-Agent, nothing about the user); the catalog lookups are the usual catalog searches. **Dev**: `SHADETUBE_OVERLAY_DEMO` step `lyricsync` opens the synchronizer for the playing song (`key=Ctrl+Enter` steps on, `key=Space` stamps); `--route "search:lyrics:<line>"` opens the tab; `lyrictools_test` (5.2). ### 3.59 Song recognition ("Şarkıyı tanı") ShadeTube listens for a few seconds to what this PC plays (a video in the browser, a game, a stream) or to the microphone (music in the room), identifies the song and offers to play it, like it, add it to a playlist or start its radio. Module `src/recognize` (`st_recognize`: core + audio's `Resampler`), app side `app/Recognition` (standalone) and `app/RecognizeUi` (`Recognize.h`). - **Backend**: Shazam's recognition service, the endpoint its own apps use (`POST https://amp.shazam.com/discovery/v5/en-US/US/iphone/-/tag/<uuid>/<uuid>?sync=true&...`, JSON body `{"signature": {"uri": "data:audio/vnd.shazam.sig;base64,...", "samplems": n}, "timestamp", "timezone", "geolocation": {}, "context": {}}`, the iPhone app's `X-Shazam-Platform` / `X-Shazam-AppVersion` headers). No account, key or server of ours. Picked because it is the only service that needs no key and is robust to noise and partial excerpts: AcoustID / Chromaprint needs an application key, a whole-track fingerprint and an exact recording (useless on a microphone excerpt); AudD and ACRCloud need a key / paid account. It is a **private** API: Apple's terms don't allow third-party use, it may change or start refusing us without notice (section 7), and it rate-limits per address (HTTP 429 for about a minute after 4 requests within ~1.5 s, and during development also after a few dozen requests within half an hour even when they were 20 s apart). - **Signature** (`recognize/Signature`, pure): our own implementation of the format documented by SongRec (reverse engineering) and ShazamIO; no code taken from either (THIRD_PARTY_NOTICES.md). 16 kHz mono in 128-sample hops; per hop a Hann-windowed 2048-point FFT, the power spectrum spread over 3 bins and carried back 1 / 3 / 6 hops; a bin of the spectrum 46 hops back is a peak when it stands above its neighbours in that spread history (fixed bin and hop offsets) and above 1/64; magnitude `ln(p) * 1477.3 + 6144`, frequency refined by a parabola to 1/64 bin; four bands (250-520, 520-1450, 1450-3500, 3500-5500 Hz). Binary layout: a 48-byte header (magics, CRC-32, sizes, the sample rate id, sample count + 0.24 s), then per band its peaks as (hop delta, magnitude, frequency) with an escape for gaps of 255 hops. `Signature::decode` reads it back (tests). Cost: ~1 FFT per 8 ms of audio, ~2 MB of spectra while a session runs. - **Request / answer** (`recognize/Shazam`): `identify()` on the shared transport; `parseAnswer()` reads `matches` (offset, time / frequency skew of the first) and `track`: title, subtitle (artist), images (cover), isrc, genre, the SONG section's Album / Label / Released rows (asked in en-US so the row titles are English), the Apple Music link. Only the signature goes out: no audio, no location, a fixed time zone, fresh random ids per request. - **Capture** (`recognize/Capture`, own thread `st-capture`, COM MTA): *Bilgisayarın sesi* first opens a process-loopback client (`ActivateAudioInterfaceAsync(VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK)`, `PROCESS_LOOPBACK_MODE_EXCLUDE_TARGET_PROCESS_TREE` on our own pid, Windows 10 2004+ / 11): everything played on the PC except ShadeTube itself, asked for 16 kHz mono float (the audio engine converts), so the app never recognizes its own playback. Without it, the default render endpoint's loopback (ShadeTube's sound included: the listening view then warns while ShadeTube plays). *Mikrofon*: the default capture endpoint (eConsole). Shared mode, a 1 s buffer drained every 20 ms; any format is mixed to mono and resampled to 16 kHz (`audio::Resampler`). A new default device or a lost one reopens on the current default without stopping (an `IMMNotificationClient` flag, like WasapiOutput); none for 4 s = NoDevice. A microphone denied by Windows' privacy settings is AccessDenied (the state offers `ms-settings:privacy-microphone`). Silence: an output held in exclusive mode by another app never reaches the mix, so a silent system sound is checked with a shared-mode client on the default endpoint (`Capture::outputHeldExclusively`: AUDCLNT_E_DEVICE_IN_USE) and reported as DeviceBusy. Nothing is stored: samples live in memory until the session takes them. - **Session** (`recognize/Session`, own thread `st-recognize`): feeds a `SignatureGenerator` and asks the service at 4, 7 and 11 s of audio (each signature covers everything heard so far, at most 12 s: 15 s or more answers nothing); a request runs on a short-lived thread of its own, so `stop()` returns within ~50 ms and the capture stops at once whatever the network does. The first answer with a song ends it, unless it came from a short signature with a skew above 5e-4: a few seconds can also match a copy or a track sampling the song (seen live: Billie Jean's groove matched an unrelated release at 4 s once), so the next, longer signature confirms (its answer wins; with none the first one stands, after the last checkpoint). No song at the last checkpoint = NotFound; the loudest block of the first 3 s under -54 dBFS = Silent (no request at all). Failures: NoDevice, DeviceBusy, AccessDenied, Capture, Network, RateLimited (429), Service. Events go to the UI thread through `Dispatcher::post` guarded by the dialog's Lifetime. - **Catalog** (`app/Recognition`, standalone): the song becomes a track of the active catalog: Spotify (`Api::search`), YouTube Music (`source::quickSearch`, one request) or MusicBrainz (`isrc:` field search first, then the text search); the first hit whose folded title (`mb::detail::searchableTitle`, accents / case / punctuation dropped) is the song's and whose artists include one of the credited ones ("A & B", "A feat. B", "A, B" split; the whole credit also counts) wins, a "Song (Live)" style prefix match only when nothing fits exactly. None: the song by name (`import:<hash>`, as imports name such songs) with the recognized cover, which the player matches on YouTube like any imported song. - **UI** (`app/RecognizeUi`): a dialog of the overlay family (560 DIP; a fixed-height stage so states never resize it): the source chips (the choice is remembered; the microphone is opened only once the user picked it), the stage (listening: a 56-bar wave of the capture's block peaks in the accent, newest on the right, ~25 fps through `invalidateAfter`, a still level shape with Hareketi azalt; the status, a 12 s progress line; the result card: cover, title, artist, album · year · genre, *Çal* (closes the dialog), the heart (`Library::canLike`), *Listeye ekle* (the playlist menu), *Radyo* (`radioAvailable()` and a seed: Spotify or YouTube Music songs; disabled with a reason otherwise), "Yanlış mı? Tekrar dene", a note when it is the song ShadeTube plays; the not-found / silent / failure states as compact `MessagePanel`s), the privacy line ("Ses bu bilgisayardan çıkmaz; ... yalnızca sesin parmak izi gönderilir."), and *Son tanınanlar*: `recognized.json` (newest first, 20 at most, a song recognized again moves up, the resolved track kept; *Temizle* clears it). A history row shows its card again. Capture starts when the dialog opens and stops with a result, a state, a source switch or the dialog (and at exit, `persistHooks`). - **Entry points**: the outlined button next to the Search page's field, the command palette (from the `recognize-song` action) and the `recognize-song` shortcut: unbound by default, may also get a global key (`kGlobal`); a global press brings the window up first. Icon `recognize` (tools/icons.py: five strokes around the middle line). - **Tests**: `recognize_test` (5.2): offline the synthetic signal (seven tone pings with a single loudest moment each: exactly seven peaks, right band, within 4 Hz and 20 ms; the same at -6 dB 2048 magnitude units lower; any feeding pattern gives the same peaks; silence none), the binary format against `fixtures/synthetic.uri`, recorded answers (`answer_match.json`, `answer_nomatch.json`), the session with test audio and a fake service, the catalog matching and the history store; live modes against the service and the devices. Dev: `SHADETUBE_RECOGNIZE_DEMO` and `SHADETUBE_RECOGNIZE_LOOPBACK` (5.4). ### 3.60 Import from Deezer, Apple Music and TIDAL `app/ServiceImport` reads a list of another service without an account (standalone: core + catalog + JSON); `app/CatalogMatch` finds its songs in the active catalog (standalone: core, catalog, spotify, ytmusic, musicbrainz, `PlaylistIO`); `app/PlaylistTransfer` runs the flow (3.21). Both standalone files are compiled by `services_test`. - **Links** (`app/Links`, `Kind::Service*`, `Link::service` names the service): `deezer.com/[<lang>/]{playlist,album, track}/<digits>`; Deezer's short links `link.deezer.com/s/<code>`, `deezer.page.link/<code>`, `dzr.page.link/<code>` (`ServiceShortLink`); `music.apple.com` (also `geo.` / `embed.` / `itunes.apple.com`) `/<storefront>/{playlist,album, song}/[<slug>/]<id>`, an album link with `?i=<song>` being the song (id `"<storefront>/<id>"`); `tidal.com` / `listen.tidal.com` `/[browse/]{playlist/<uuid>,album/<n>,track/<n>}`, `/album/<a>/track/<t>`, `embed.tidal.com/ {playlists,albums,tracks}/<id>`. Their artists, mixes, podcasts and Apple's private `library/` links are Unsupported (a toast names what is supported). Search's link row and Ctrl+V (`LinkOpener`) label them ("Deezer çalma listesi" …) and hand them to `transfer::openServiceLink`. - **Reading** (`svc::read`, a worker; every request through a `Fetch` = the shared transport, retried twice on a transport failure, 429 or 5xx): - *Deezer*: the public API, no key. `api.deezer.com/playlist/<id>` (name, description, cover, `nb_tracks`, creator), then `/playlist/<id>/tracks?index=0&limit=500` following `next` (each row has its ISRC; the header's embedded list stops at 400). Albums: `/album/<id>` (UPC, release date) + `/album/<id>/tracks` (the embedded list has no ISRC); songs: `/track/<id>` (all contributors). Errors come as `{"error":{…}}` with HTTP 200: code 800 "no data" = missing or private, 4 = the 50-requests-per-5-s quota (waited out). A short link is fetched (redirects followed) and the landing page's canonical / `og:url` link names the list; an expired one lands on `deezer-links-404`. - *Apple Music*: there is no keyless official API. The web player's catalog API `amp-api.music.apple.com` answers with the developer token its own web bundle carries (a JWT with kid `WebPlayKid`, valid ~10 weeks; the one seen on 2026-11-27 expires 2027-01-15): the music.apple.com page names the bundle (`/assets/index~….js`), the token is read from it and kept in memory until it expires (a 401 / 403 reads the bundle again once). `/v1/catalog/ <storefront>/playlists/<id>?include=tracks&limit[tracks]=300` + `/tracks?offset=N&limit=300` pages (ISRC per song; music videos skipped), `/albums/<id>`, `/songs/<id>`; requests carry `Origin: https://music.apple.com`. Without a token (or when amp-api keeps refusing it) the page's own `serialized-server-data` is read instead: header and songs without ISRC, **at most 300** (a 424-song list showed 300 and counted 300: the page cannot tell it is cut, so a full page is reported as possibly partial). The storefront of the link is used; a list missing there is a 404. - *TIDAL*: TIDAL's own JSON:API `openapi.tidal.com/v2` with a client-credentials token (`auth.tidal.com/v1/oauth2/token`) of the public client the signed-out tidal.com web app uses (its id and key sit in the web bundle's client table; kept 3 h). When that client is refused, the bundle named by the list's tidal.com page is read for the current pair. `/playlists/<uuid>?include=coverArt,owners` + `/relationships/items?include=items,items.artists,items.albums` (20 rows a page, `links.next` cursor); `/albums/<id>` + its items; `/tracks?filter[id]=`. A row whose track is not included (no longer on TIDAL) or a video is skipped and counted. Country `US`. The older `api.tidal.com/v1` with the well-known `x-tidal-token`s now answers 404 / "a user is required" for everything; the embed player's page lists only the first 50 songs. - **Matching** (`catmatch::matchAll`, a worker): Spotify (logged in): `isrc:<code>` search (exact), else title + artist, two at a time ~100 ms apart. YouTube Music: a songs search per song (`ytm::searchKind`), four at a time; a 429 waits 4 s once. MusicBrainz: `mb::recordingsByIsrc` (20 ISRCs per Lucene `isrc:A OR isrc:B …` search, rate limited like every MusicBrainz request), then a search by name for the rest (at most 150 per import). `score()` compares title words without edition noise (remastered, feat., radio edit, years; Spotify's " - Remastered 2011"), artists (the best pair: Apple gives one "A & B" string) and length; a live / remix / acoustic … version on one side costs 35. Search hits count from 70, ISRC hits from 40 (the code is exact, the spelling may differ). A song nothing fits stays known by name (`import:<hash>`, like a CSV row: MatchService finds its video when it plays). Twelve failed lookups in a row give the rest up (reported). Albums (`findAlbum`): Spotify `upc:` then title + artist, MusicBrainz by barcode (`mb::releaseGroupByBarcode`, UPC / EAN with and without leading zeros) then by name, YouTube Music by name. - **Flow**: a playlist link opens a progress dialog ("Çalma listesi içe aktarılıyor": reading N / M, then matching N / M with the matched and ISRC counts, a 2 px line; "Vazgeç" / Escape / closing the app cancels), then the 3.21 preview with the service's summary ("100 şarkı okundu · YouTube Music: 98 eşleşti · 2 bulunamadı"), the first six songs not found with their positions and "Bulunamayanları da ekle" (on: they are added by name). "İçe aktar" creates the local playlist with the list's description and its cover (fetched on the worker, `pledit::squareJpeg`). An album link opens the catalog's album when `findAlbum` has one, else goes through the same import; from the import dialog an album is always imported. A song link plays its match (or the song by name). Errors toast what happened (private, missing or region-locked, the service refusing anonymous reading, no answer). - **Measured** (2026-11-27, YouTube Music catalog, `services_test live-set ytm`): Deezer "Top Worldwide" 100 songs read in 1.3 s, 98 matched in 20 s; Deezer "500 Greatest Songs" 500 songs in 3.6 s, 498 matched in 94 s; Apple Music "Today's Hits" 50 in 3.2 s (token read included), 50 matched in 8 s; Apple Music "Berlioz: The Complete Works" 424 in 2.0 s, 366 matched (86 %, classical titles) in 76 s; TIDAL "Test Trax" 132 in 3.4 s, 129 matched in 34 s. MusicBrainz catalog (`live-set mb`, on a day MusicBrainz answered 503 to ~260 requests): 96 / 100 (77 by ISRC) in 64 s, 456 / 500 (327 by ISRC) in 6.5 min, 50 / 50 (49 by ISRC) in 6 s, 166 / 424 (29 by ISRC; classical) in 7 min, 126 / 132 (107 by ISRC) in 68 s: the time goes into the one-a-second name searches and the 503 back-offs. ### 3.61 Visualizer "Görselleştirici": a full-window view that draws what plays. `app/Visualizer` (the view, `initVisualizer`), `audio/VisualAnalysis` (the analysis, standalone: `visualizer_test`), the tap in `audio/Spectrum` + `AudioEngine::waveform`, `ui::Window::setFullscreen` and `OverlayLayer::coversWindow` (3.3). - **Opening**: the `visualizer` action (default key **V**, *Ayarlar › Klavye*; so also the command palette), the button after video mode in Now Playing's utility row, the player bar's button (between video mode and the lyrics; shown only while the bar's center column keeps its 380 DIP with it, i.e. on wide windows) and a click on the spectrum strip the bar shows during Now Playing's cross-fade. Nothing playing: a toast. It is a modal overlay like the full-screen lyrics (one of the two at a time: opening either closes the other; `initVisualizer` wraps `ctx().toggleLyricsFullscreen`). Esc, the close button or the key again close it; leaving it also leaves full screen. - **Modes** (`Settings.visualizerMode`: `bars` | `ring` | `wave` | `aurora`, default `ring`; chips in the top strip, keys 1-4, M / Shift+M), cross-fading in 240 ms by alpha (no layer): - *Spektrum*: 24-96 pills (one per ~15 DIP) standing 3 DIP above a `hairline.subtle` baseline at 80 % of the area, in the accent at 45-100 % by level; a faint reflection (5-12 %) under the line; the peaks as 2 DIP `fg.primary` dashes that hold 350 ms and then fall with gravity. - *Halka*: the cover in a circle (23 % of the area's shorter side, `hairline.default` outline, a placeholder disc meanwhile, fading in when it arrives) with the spectrum mirrored around it (bass at the top, the deepest bands below ~50 Hz left out, each line a 1-2-1 mix of its neighbours), a radial accent glow that swells with the bass, the cover breathing 2 % with the beat and a 1.5 DIP ring leaving it on every beat (0.9 s). - *Dalga*: the oscilloscope view across the area, tapered to the middle line at both ends like the seek wave (3.29), 2 DIP accent, and the last four shapes (one kept every 45 ms) trailing at 26 / 16 / 9 / 5 %. - *Aurora*: three curtains in the cover's colours (the accent, then the most saturated palette colours of another hue, `CoverBackdrop::palette()`; lightness 0.64 on dark themes, 0.6 and less opaque on light ones, where deeper tones turn muddy), each with a sharp lower edge and a long fade upwards, undulating and streaked by slow rays, lit by bass / mids / treble; computed on the CPU at one texel per 12 DIP (a 1462 × 822 DIP window: 123 × 70 texels) about 30 times a second while sound plays (`exp` from a table), uploaded and stretched; kept off the top strip and the corner. 64 motes drift up (positions from the drift clock alone), brighter with the treble. The backdrop under every mode is Now Playing's (3.40), so text contrast and the grain are the same. - **The rest of the view**: the song in the bottom-left corner (title, artist, a 2 DIP progress line with the time; a station: the CANLI badge; paused: "DURAKLATILDI"), the sung lyric line above it centered (`Settings.visualizerLyrics`, L or the lyrics button; synced lyrics of songs only, fetched read-only through `lyricsQueryFor` / `lyrics::fetch`, the lyrics views' 150 ms look-ahead, a 320 ms rise and cross-fade between lines). The top strip (label, chips, lyric line, full screen, close) is a caption area like the full-screen lyrics' and fades after 2.5 s without the mouse; the pointer hides with it. - **Full screen** (F, F11, double click, the button): `Window::setFullscreen` as browsers do it: a maximized window is restored first, `WS_CAPTION | WS_THICKFRAME` go, the window covers its monitor (`DWMWCP_DONOTROUND`), the NC hit test answers `HTCLIENT` (no resize borders, caption drag or snap layouts); leaving restores style, rect and maximized state. `App::saveMainPlacement` leaves it first, so the saved placement is never the monitor. - **The tap** (`audio/Spectrum`): the engine already pushed the mono mix of every device block (after the crossfade and the equalizer, before the volume; shared and exclusive output, any source: songs, files, stations, episodes) for the spectrum strip. Its history is now 4096 samples in a seqlock (an odd sequence while a push writes; atomics with relaxed order, fences around), so the engine thread never waits and never allocates; `snapshot()` copies and retries up to 8 times when a push landed meanwhile (a push takes microseconds every 10-20 ms) and reports how many samples were pushed in all. `AudioEngine::waveform(samples, count, &info)` (rate, position; false when not playing) and the old `spectrum()` read it; the 2048-point FFT moved to `audio/Fft` for both. - **Analysis** (`viz::Analyzer`, one `update()` per painted frame; 0.035 ms in Release when new audio arrived, else only the smoothing): a Hann-windowed 2048-point power spectrum of the newest samples, normalised so a full-scale sine is 0 dB; 96 bands from 35 Hz to 16 kHz spaced on log(f + 100 Hz) (less room for the bass than pure log); a band takes its loudest bin, or, while narrower than a bin (below ~370 Hz at 48 kHz), the magnitude interpolated at its centre, so the bass rises as one smooth shape instead of steps of equal bars; +2.5 dB / octave around 1 kHz (-8..+9 dB); a ceiling that follows the loudest band (up in 0.12 s, down in 5 s, -32..+6 dB) over a 50 dB range with a 1.5 gamma; attack 35 ms / release 240 ms on the display clock; peaks held 0.35 s then falling at 2.4 /s². Bass (40-140 Hz), mid (250 Hz-2 kHz) and treble (2.5-10 kHz) in their own adaptive 30 dB ranges. Paused: the goals go to zero and the release runs faster, at rest after ~0.9 s (`resting()`). - **Beats** (`viz::BeatDetector`): on a fixed grid of the audio, every 512 samples at 48 kHz (10.7 ms), each step from the 2048 samples that ended there (the 4096-sample history covers frames up to ~40 ms apart), so 60 and 240 Hz displays and 10 / 20 ms device blocks give the same beats. Onset function: the mean over the 40-250 Hz bins of how much each rose (dB, floored at -75) against the spectrum 35 ms earlier (interpolated), averaged with the previous step; threshold: mean + 2.5 mean deviations of the last ~1.5 s + 2 dB; one beat per 260 ms at most, re-armed when the rise has passed, none while the bass is below -58 dB. The pulse is 0.35..1 by how far over the threshold, decaying in 0.18 s. Latency after the kick: 33-60 ms in the tests (the window's taper); the picture is ahead of the sound by the device buffer (≤ 40 ms shared), so the two roughly cancel. - **Oscilloscope**: a 1/2000 s box low pass, a trigger on the first rising zero crossing (hysteresis 4 % of the envelope) so a periodic sound stands still, 24 ms decimated to 320 points, auto-gained (fast up, 1.5 s down, never below 0.03 so the hiss of a quiet passage stays small). - **Frames and cost**: while sound plays the view asks for every display refresh up to ~125 a second (`frame::requestNext`); on faster displays every second or third one (`frame::requestNextEvery(n)`: the frame is presented with sync interval n, `WindowTarget::end(n)`, so the pacing is even; any plain `requestNext()` in the same frame wins). 240 Hz: 120 frames a second; 60 / 120 / 144 / 165 Hz: all of them. The audio changes every 10 ms (the device period), so frames beyond that would only interpolate the smoothing at full GPU cost. A timer can't pace this: the loop's `MsgWaitForMultipleObjects` wakes on the system tick, which gave an uneven 75-95 frames a second. Nothing else is painted meanwhile: `coversWindow()` is true once it has faded in, so `Window::paintLayers` starts at it (the page, the player bar, Now Playing and their timers stay quiet). Paused: it settles in about a second, then asks for no frames at all (a play / pause or track change repaints through `playerChangedHooks`). Reduce motion or Windows' animation effects off: slow smoothing (250 / 900 ms) at 10 frames a second, no beat ring or breathing, still curtains and motes; the backdrop doesn't drift. Hidden and minimized windows never render (3.3). The curtain bitmap has a device hook; the analysis, lyrics and layouts go with the view. - **Measured** (Release; the Intel UHD of an i7-14650HX driving a 2560 × 1440 240 Hz panel at 175 %; the synthetic song; one 10 s sample each after the view settled, so ±a few points; CPU in % of one core, GPU = the process's 3D engine): a 1920 × 1080 px window (1097 × 617 DIP) — Spektrum 8 % / 27 %, Halka 16 % / 34 %, Dalga 18 % / 21 %, Aurora 4 % / 30 %, at 105-130 frames/s, painting 0.16-0.5 ms; full screen 2560 × 1440 — 8 % / 31 %, 12 % / 36 %, 13 % / 38 %, 6 % / 37 %, at 123-134 frames/s; paused (after settling) 0.5 % / 1 %; reduce motion 1.2-1.5 % / 3-5 % at 10 frames/s. Every frame at 240 Hz (before the pacing above) cost 19-23 % / 32-53 % in the window. Now Playing on the same machine, for comparison: 4-18 % / 24-33 % at 54-83 frames/s (synced lyrics). The analysis is 0.035 ms (`visualizer_test` timing); the rest is Direct2D: the backdrop and its grain are two full-window passes, Aurora adds its stretched curtains, Halka its glow and ~180 lines, Dalga five stroked polylines (the trail ones at half the points). Dev: `SHADETUBE_VIZ_MODE` (the mode for this run, not saved), `SHADETUBE_VIZ_LOG=1` (every 5 s: mode, size, frames/s, paint time, analyses/s, backdrop renders/s; `visualizer` lines), `SHADETUBE_VIZ_SHOTS=<folder>;<ms>;<count>;<gap ms>` (consecutive frames as PNGs, to judge motion). Open it with `SHADETUBE_KEYS_DEMO=3000:action:visualizer`; music to react to: `visualizer_test wav <file>` writes 90 s of synthetic drums + bass + chords + arpeggio (drop it with a `cover.png` into a folder and play that with `SHADETUBE_PLAY_FILES`). ### 3.62 Lyrics rendering `gfx/TextShape` (display text as geometry) and `app/LyricsRender` (`lyricsview::`: drawing, the karaoke fill, the lines under a line, the motion model) are shared by Now Playing's lyrics tab, the full-screen view and the wide mini player. Tested by `lyricsview_test`. - **What was wrong** (measured on 175 % and 100-150 % interface scale, dark / light / pastel; before / after crops in the round's notes). (1) DirectWrite draws the app's font in its `NATURAL_SYMMETRIC` grayscale mode below ~100 px (every Now Playing size, the full-screen view below 64 DIP at 175 %): glyph bitmaps with **15 partial coverage levels** (counted on rendered lines), which is fine for UI text but leaves visible steps on the round edges of 50-110 px lyric glyphs; and `Canvas::text` puts every line on whole pixels, so a gliding line moves in 1 px steps. (2) The karaoke fill drew the sung line twice - whole, then in the accent through an *aliased* axis-aligned clip per row: a hard vertical cut that moved in whole pixels, and every glyph edge under it antialiased twice (the accent over the first draw's edge), a pale rim around the sung letters on dark grounds and a dark one on light. (3) The sung line in Now Playing switched layouts (28 / 500 → 44 / 800) and the colors in one frame, so the line popped and everything under it jumped; the mini player's next line switched style at the start of its slide and every moving line went through an opacity layer. DirectWrite's `OUTLINE` mode (continuous coverage) for all lyric text fixed (1) but doubled the frame's CPU in Now Playing (3.9 → 8.0 million UI-thread cycles a frame). - **`gfx::TextShape`**: a layout's glyph outlines (`IDWriteFontFace::GetGlyphRunOutline` through a custom `IDWriteTextRenderer`, the ellipsis' inline object included) become one filled **geometry realization** per visual row (`CreateFilledGeometryRealization`, per-primitive antialiasing, the flattening tolerance of the scale it is built for and the largest zoom it will be drawn at). Per frame a row is one `DrawGeometryRealization` with any brush, at any fractional position and under a scale transform - continuous coverage (244 levels against 15), the same ink and place as DirectWrite's own outlines (within 0.25 px and 1 %; `lyricsview_test`). Each row's baseline is moved onto the pixel grid of its scale, so a line at rest on a whole-pixel origin keeps crisp baselines. A layout with color glyphs (emoji) is refused (`usable()` false) and drawn as text. The shape holds its layout (identity + width + scale decide whether it fits); device objects: a weak registry drops every realization on the idle release and on device loss, and the views build them again. - **Drawing** (`lyricsview::draw`): the line's shape once built, as text at the same place until then (and for emoji lines). Shapes are built on first use, at most 3 a frame (~0.3-0.7 ms each): opening a view builds the lines on screen over a few frames. A line scrolled away releases its layout and shape; the views drop them all when they close. Lines at rest sit on whole pixels: tops, gaps and heights rounded to the device pixel grid (`snap`, `ceilPx`) and the follow scroll's target too, so the spring lands exactly there. - **Motion** (`LineMotion`): every line has an emphasis (1 = the sung line) and a brightness (`Dim`: the sung line 1, sung lines `past`, coming ones `future`, 3+ lines away `distant` times that), each its own `ui::Anim` (460 ms, Standard) turning from wherever it is when the sung line changes - several changes in a row or a seek never snap. The first line of fresh lyrics lands at once; *Hareketi azalt* makes every change instant. Heights follow the emphasis, the scroll heads for where the sung line will be once it settled. - Now Playing: a growing / shrinking line is drawn twice at the same visual size - the small layout scaled up and the big one (`Big`, made on demand for the lines in a change) scaled down - cross-faded in a short stretch around the middle (`smoothstep(0.35, 0.65)`), so the weights' different letter widths and wraps show together only for ~60 ms; alphas are set so that where both cover a pixel it gets the line's alpha. The line's height is what is drawn of it. - Full screen: lines not sung rest at 90 % (scaled around their top center), the sung line grows to 100 % and its fill: `drawFill` draws each row once with a gradient brush - the accent up to where the sung part has reached, the line's color after it, a soft edge 0.6 em wide - instead of the clip; a line handing over keeps its full fill while the accent fades out with its emphasis. The fill repaints at ~60 frames a second while it plays (it was 30). - Mini player (wide): the sung line moves up and fades, the next one rises into its place growing from the next line's style into the sung line's (cross-faded like Now Playing), the line after it fades in from below; no layers, `motion::slow`. - **Cost** (Debug, 1440 × 900 DIP at 175 %, a playing local file with synced lyrics, million UI-thread cycles a frame with `SHADETUBE_FRAME_CYCLES=1`, medians of three 12 s runs; "text" = the same motion drawn as text with `SHADETUBE_LYRICS_SHAPES=0`): Now Playing 3.76 (text 5.11; before this change 3.9 without any motion); full screen 6.15 (text 10.44; before 7.3 at half the fill's frame rate). Memory in Now Playing after 14 s: commit 75 vs 88 MB, GPU 56 vs 68 MB (text at changing sizes fills DirectWrite's glyph cache); a realization is ~110-170 KB of GPU memory for a 30-character line at 44-64 DIP, Japanese lines alike; 12 shapes live with the Now Playing tab open (`SHADETUBE_NP_LOG` prints the count and the rows built). - **Not shared**: the lyrics share card (3.37) paints its own text into an export bitmap (static, no motion). ### 3.63 Lyrics romanization `lyrics/Romanize` (standalone: rules, Windows' Japanese analyzer, the cache; `romanize_test`) and `app/LyricsRomanization` (a view's state, like `LyricsTranslation`). - **In the views**: a chip "Romanizasyon" left of "Çeviri" in Now Playing's lyrics toolbar and the full-screen view's top controls, offered when the lyrics are in Japanese (any kana), Korean or Cyrillic (`romanizableScript`, off the UI thread with a cached answer's lookup). `Settings::lyricsRomanize` is shared by both views (`sync()` as they paint). The Latin line goes **under the original line, above its translation**, in the translation's style a little brighter, never instead of it: the karaoke fill follows the original's word times, a Japanese line without kanji readings still needs the original next to it, and readers of the script keep it. The header note says what is shown ("ROMANİZASYON · KORECE", "… · JAPONCA · KANJİ OKUNUŞU YOK"). Not in the mini player (two lines only) or the share card. - **Korean** (Revised Romanization, 2000), per word (a run of Hangul syllables): syllables split into initial / vowel / final, then within the word: liaison (a final read at the next vowel, double finals split, ㅇ stays, ㅎ drops: 한국어 hangugeo, 읽어 ilgeo, 괜찮아 gwaenchana), palatalization (같이 gachi, 굳이 guji, 닫히다 dachida), aspiration with ㅎ (좋고 joko, 많다 manta, 축하 chuka), final neutralization (꽃 kkot, 읽다 ikda, 맑게 malge), nasalization (국물 gungmul, 합니다 hamnida, 없는 eomneun), the liquid rules (신라 silla, 설날 seollal, 종로 jongno, 독립 dongnip). **Skipped**: rules that need the word's grammar or the dictionary - ㄴ insertion (맨입 maennip), tensification (not written in RR anyway), nouns keeping ㅎ after ㄱ ㄷ ㅂ (묵호 Mukho: written as aspirated), the ㄼ exceptions (밟다), hyphens for ambiguity, capitals for names; nothing happens across spaces. - **Japanese**: kana → modified Hepburn (yōon, っ doubling / tch, ん n' before vowels and y, ー repeats the vowel, extended katakana ファ ティ ウィ シェ ヴァ, Japanese punctuation and fullwidth forms to Latin). Kanji need readings: `Windows.Globalization.JapanesePhoneticAnalyzer` (C++/WinRT, offline) gives words with kana readings and phrase starts; romaji are spaced by phrase, particles ending a phrase stand apart (は wa, へ e, を o). It is an STA-only class (the worker MTA gets "single-threaded class activation from MTA is not supported"), so a reader owns a short-lived STA thread for one song's lines, at most 100 characters a call. It answers **nothing** without Windows' Japanese language data (checked on the development PC, a Turkish Windows 11 without it: empty word lists; `IFELanguage` / MSIME.Japan reverse conversion likewise returns S_FALSE there): the process then remembers and falls back to romanizing the kana with the kanji kept as written, spaced from the romaji (`readings` false; not cached, so installing the language later gives readings). The analyzer path is covered by a fixture reader in `romanize_test`; with real readings it was not observed on this PC. - **Cyrillic**: Russian - BGN/PCGN without diacritics (е ye at a word's start and after vowels / ъ / ь, ё yo, й y, ы y, х kh, щ shch, signs dropped); Ukrainian - the official 2010 table (г h, ґ g, и y, і i, є ї й ю я ye yi y yu ya at a word's start, ie i i iu ia inside, зг zgh, the apostrophe dropped). The table is chosen per line: a line with і ї є ґ is Ukrainian, one with ы э ё ъ Russian, any other line follows the song (the majority of those lines, else the source's "uk", else Russian); other Cyrillic alphabets use the Russian table with a few letters of their own, and a Russian letter in a Ukrainian line keeps its Russian reading. Case follows the source (Ж → Zh, ЖИЗНЬ → ZHIZN). - **Chinese is not offered**: Han text without kana stays as it is. Pinyin would need a reading per character (Unihan kMandarin, ~20 000 characters, a few hundred KB) and, for the many characters with several readings, word-level choices (a phrase dictionary of several MB); Windows has no offline Chinese phonetic analyzer to ask. - **Cache**: `cache/lyrics-romanized/<key>.json` = `{v, fp, n, script, lang, readings, lines}`, the fingerprint of the lines as for translations; a rule change bumps `v`. Everything runs off the UI thread (`async`, Normal priority). ### 3.64 Rule-based playlists (Kurallı listeler) Playlists the user builds from rules ("released after 2020, played fewer than 50 times, artist is not X, liked, longer than 3 minutes, sorted by last played, at most 100 songs"). `app/RuleLists` is the pure part (definitions and their JSON, the song pool, the evaluation; standalone, `rules_test`), `app/RuleListsPage` the app side (the store, the engine, the list page, the editor, menus, import / export), `app/RuleSources` the cached Spotify / saved-album collections. - **Universe** (`rules::Source`, a definition picks any of them; all by default): the liked songs (Spotify's while signed in, from the collection cache; else the local ones), the user's playlists (local ones signed out, Spotify's signed in, as the sidebar shows them), saved albums whose track lists are known (collection cache; their tracks get the album's release year), Yerel dosyalar (year from the tags), the downloads and every song of the listening history (`ListenStats`: this PC's and the imported plays). **De-duplication**: copies with the same catalog id are one track (interned once, its metadata completed from the others: cover, length, video); tracks with different ids merge by the history's song identity (folded title + first artist, `ListenStats::keysFor`), so a song liked on Spotify, downloaded, kept as a file and heard 40 times is one row. The row plays the first copy in this order: local file, download, liked, playlist, album, history (a local file / download plays from disk). Facts of a merged song: year = any known, added = the earliest `addedAt` of its library copies, liked date from the liked copy, liked = a liked copy or the account's liked ids, downloaded / local file / explicit = any copy, playlists = every playlist slice it is in, plays / skips / first / last played from the history, BPM from 3.65. - **Fields and operators**: title / artist / album (contains, does not contain, is, is not, starts with; artist: any of its artists), release year and BPM (>, <, between, =, ≠, known, unknown), length in seconds (`m:ss` in the editor), plays and skips (a play = a stream by `ListenStats`' rule; a skip = a stored play that wasn't one: this PC's under 30 s, the imported histories' short rows; scrobbles never are), last / first played (in / not in the last N days, after / before a date, never), date added / liked (the same without "never"), liked / downloaded / local file / explicit (yes, no), in / not in playlist X, source catalog (Spotify, YouTube Music, MusicBrainz, local file, other = imported). "All / any" over the rows plus one level of groups with their own "all / any". **Unknown values** never match a comparison (only "unknown"); a date that means "never" (never played) matches "not in the last N days" and "never"; sorting puts unknown values last in either direction. Left out: genre (the local scanner doesn't keep it and catalogs give none per song), ratings and "added by" (no data), audio features other than BPM (no source), a release year for Spotify / YouTube Music playlist and liked songs (`catalog::Track` carries none: only local files and saved albums have one). - **Order and limit**: any field ascending / descending, or random seeded by the list and the local day and keyed by song (stable all day, a new song doesn't reshuffle the others); at most N songs or N minutes (songs taken in order until the next would pass the minutes; unknown lengths count 3:30). - **Store** (`rule-lists.json`, per account): `{"v":1,"lists":[{"id","created","updated","def":<definition>, "last":{"count","ms","covers","done"}}]}`; "last" is the latest evaluation, so the sidebar and the Library show counts and covers at once after a start. A definition (also the exported file, *Kuralları dışa aktar…*): `{"shadetube.rulelist":1, "name","match":"all|any","groups":[{"match","rules":[{"field","op","text"?,"a"?,"b"?}]}],"sort":{"by","desc"}, "limit":{"kind":"none|songs|minutes","value"},"sources":[...]}` with names, not numbers; reading drops rules with an unknown field / operator (counted, toasted on import), clamps limits and values, keeps at most 40 rules and refuses files that aren't rule lists or are of a newer version. - **Engine** (UI thread + one job at a time on a Low worker; the pool is touched only by jobs): every input change (the local library store, the session, Yerel dosyalar, downloads, the history, BPMs, the collection cache, the day) posts one coalesced `kick()`; the job carries only what changed, by fingerprints computed on the UI thread without copying (track ids / added times / names of each local collection, the local library's generation, the downloads' done ids, the liked ids as an order-free hash, the history's size / plays / newest play, the BPM store's revision, the cache's fetch times). The job applies the slices (folding them: the expensive part, off the UI thread), merges once, applies facts without a merge (play statistics: only the songs whose counts changed when the history only got plays) and evaluates again only the lists whose dependencies moved (`rules::depsOf` × the pool's revisions per `Dep`; relative dates and random orders also at a new day). It returns each changed list's summary and the full songs of lists a page shows (`watch`) or the editor's draft (first 50). The history is aggregated on the UI thread at most every 15 s (one pass over the plays). Nothing is evaluated before the history, the local library, the BPM store and (signed in) the library snapshot are loaded, and summaries are not saved while the collection cache is still fetching (they are evaluated again when it settles), so counts don't jump after a start. With no list and no editor open the pool is released and nothing is fetched. - **Collection cache** (`app/RuleSources`): fetched only while a list (or the editor's draft) draws from that source, one collection at a time on a Low worker (Spotify pages 300 ms apart, collections 1.5 s apart, a 429 pauses Spotify fetches 10 min, a failure waits 15 min); again when the library says it changed (another track count, a playlist edit made here; Liked Songs at most every 5 min), or when old (playlists / Liked Songs 6 h, albums 7 days); collections gone from the library are dropped with their files. Track lists live in `<account>\rule-sources\<fnv>.json` (one cover per track, no row uids), the index in `rule-sources.json`; in memory only the index (a job reads a list when it changed). - **UI**: the sidebar lists rule lists after the playlists with a filter mark (the playing bars while one plays) and their song count, the "+" menu has *Yeni kurallı liste…* / *Kurallı liste içe aktar…*, the Library's playlists tab shows them as cells ("Kurallı liste · 42 şarkı", the card menu). The list page (`smart:rule:<id>`; `#play` starts it) is a collection page: generated cover (four covers above a band, like the smart lists'), a line saying how it is made, play / shuffle / *Kuralları düzenle* / download (queues the songs not downloaded yet: a one-off, not a sync rule) / "…" (queue, *Çalma listesi olarak kaydet* = the current result frozen through `promptNewPlaylist`, export through `transfer::exportTracks`, copy, rules export, delete). The editor (`smart:rule-edit:<id>`, `smart:rule-new`): the name, the rows (field ▾ · operator ▾ · value box(es) or a playlist / catalog picker · ×), groups in an outlined box with their own "all / any", *Kural ekle* / *Grup ekle*, sort ▾ + direction, limit ▾ + number, the sources as check / plus pills and the live preview (count, length, the first 50 songs) evaluated in the engine at every change. Every control is a Tab stop (text boxes, dropdown buttons, segmented controls), Enter in the name saves. - **Measured** (Debug build). `rules_test`: 5 000 songs over 23 slices (6 667 distinct tracks): preparing the slices 326 ms, the merge 76 ms, facts 34 ms, one evaluation with 4 rules + sort + limit 4.8 ms, a text rule 2.2 ms, a random order of all 3.8 ms; pool ~7.0 MB (`Pool::memoryBytes`, ~1 KB per distinct track: the interned track with one cover, its folded texts, the indexes). 50 000 songs: 3.2 s / 0.79 s / 0.33 s / 51 ms, ~70 MB. In the app on a 5 000-song sandbox (1 200 likes, 12 local playlists, 12 local files, 69 415 plays over 4 902 songs; four lists): the first job (everything prepared, four lists) 265-435 ms on the worker, later jobs after one input changed (a BPM landed, a play) 8-31 ms; nothing on the UI thread beyond the fingerprints and the history aggregation. ### 3.65 Tempo (BPM) The tempo of songs, for the track tables (a column, sorting, a range filter), Now Playing and the rule lists (3.64). `audio/Tempo` (the estimator and the file analysis; `tempo_test`), `app/BpmStore` (the store; `rules_test`), `app/Bpm` (the worker, lookups, settings rows, the tag editor's hand-over). - **Sources**, in order: a BPM tag in the file (ID3 `TBPM`, MP4 `tmpo`, Vorbis `BPM` / `TEMPO`; read by `audio/TagWriter` for local files and downloads), else ShadeTube's own analysis of audio it already has: local files, downloads and the song cache (`player/AudioCache::songs()`). No catalog offers a tempo without credentials ShadeTube doesn't have: Spotify's audio features are a Web API call (an app token, closed to new apps since 2024; the web player token is rate-limited there, 3.5), MusicBrainz has no tempo, AcousticBrainz is shut down, the BPM databases want an API key. Nothing is asked on the network. - **Estimator** (`audio/Tempo.h` has the details): mono at 11.025 kHz, 512-point frames every 128 samples; onset strength = log-compressed spectral flux over 20 log-spaced bands, minus its 1 s moving average, rectified, smoothed over 5 frames; its autocorrelation; a comb score (the autocorrelation at P, 2P, 3P, 4P) × a broad log-normal prior around 120 BPM picks the period; an explicit octave check doubles it when the events halfway are about as strong (0.78 of the beat's; past 180 BPM 0.92, and the comb must agree) and halves it when P is a subdivision; the period is refined over up to 8 harmonics' peaks (0.1 BPM resolution); a held tone / noise gives no tempo (mean onset strength, the autocorrelation as the confidence). - **Worker** (`app/Bpm`, UI-thread scheduling from the housekeeping tick, one job at a time, Low priority, the thread at below-normal priority while it runs; Linux: a thread of its own at nice +10): nothing in the first minute, nothing while the player resolves / buffers a song; tags in batches of 25 files every 3 s; one analysis (70 s of the song from 20 % in) every 12 s at most (≈ 5 a minute); `Settings.bpmAnalysis` off (*Ayarlar › Yerel müzik › Tempo (BPM) analizi*) = tags only. Candidates are listed again when the local library's generation, the downloads or the song cache change (and every 30 min); a file is done when the store has its id with the same stamp (size + last write time), so a changed file is looked at again. No toast or progress: the settings row counts "2.212 şarkının temposu biliniyor: 3 etiketten, 2.209 analizden. 4 dosya sırada." - **Store** (`bpm.json`, per PC, saved on a worker at most every 30 s and at exit): entries `{b, s: t|a, c, t, f (stamp), i: [ids], k: song key}`; keys like the other per-track data: a local file's `local:` id, a download's catalog id, a cached stream's `yt:<video>` and the catalog ids it played for, plus the song identity (folded title + first artist), so the same song from another source shows its tempo. A tag beats an analysis for the same id; an analysis that found no beat is kept (bpm 0) so the file isn't tried again. Lookups (`bpm::of`): id, then video, then song key, remembered per id until the store changes; workers get a shared snapshot. - **UI**: the track table's *BPM* column (offered in every list through the column header's menu, an empty cell when unknown, sortable with unknown last), *BPM aralığı* in the same menu (Sakin 60–90, Yürüyüş 100–125, Tempolu 125–145, Koşu 150–175, *Özel aralık…*, a dot on the column label while one is set) and `bpm:150-175` / `bpm:>140` / `bpm:<100` / `bpm:128` (±2 %) in any list's search box (`TrackTable::setFilter` takes them out of the text); "TEMPO · 128 BPM" at the top of Now Playing's *Hakkında*; the tag editor's *BPM* field next to the year (writes `TBPM` / `tmpo` / `BPM`, 0 removes it; the store learns the new value at once). - **Validation**. Synthetic (`tempo_test`, 50 signals): click tracks 60-200 BPM and odd tempos 20 / 20 exact (within 2 %); drum loops 70-180 BPM 18 / 19 (rock at 70 comes out 140: its eighth hats); triplet swing 3 / 3; the traps give the tempo or its octave by design (half-time 140 / 150 → 70 / 75, drum'n'bass 174, loud sixteenths at 92 / 120 exact); noise, silence and a held tone give none; a noise floor, 44.1 kHz input, a 1 % drift and a 127.3 BPM loop (within 0.6) pass. Overall 47 / 50 exact, 50 / 50 within an octave. The sandbox's synthesized local songs (MP3, FLAC, WAV at 76-168 BPM): 9 / 9 analysed exact, the 3 tagged ones read from their tags. Real songs played through the app in a sandbox (YouTube Opus streams from the song cache, analysed by the app's worker and again by `tempo_test file`), against their published tempos. A first set of 12: Get Lucky 116 → 116.0, Billie Jean 117 → 116.7, Another One Bites the Dust 110 → 110.4, Eye of the Tiger 109 → 108.8, Uptown Funk 115 → 115.0, Blinding Lights 171 → 171.0, Rolling in the Deep 105 → 105.0, Take On Me 169 → 168.5, Stayin' Alive 104 → 103.4, Africa 93 → 92.9, Happy 160 → 159.9 and Levitating 103 → 206 (doubled); the 0.92 rule for doubling past 180 BPM was made for that song (103.0 after it, the synthetic results unchanged). Then 8 songs not used before: Somebody That I Used to Know 129 → 129.0, Lose Yourself 171 → 171.4, Believer 125 → 125.0, Viva la Vida 138 → 138.1, Smells Like Teen Spirit 117 → 115.7, Wake Me Up 124 → 124.0, Shape of You 96 → 191.9 (doubled) and Never Gonna Give You Up 113 → 181.8 (wrong: its envelope has no peak near 113, confidence 0.36), i.e. 6 / 8 within 2 %. Shape of You led to the last rule (past 180 BPM the comb must agree too; 96.0 after it, nothing else changed). So: 19 / 20 within 2 % now, two of the fixes tuned on these songs; the honest holdout figure is 6 / 8 exact, 7 / 8 within an octave. `SHADETUBE_TEMPO_DEBUG=1` prints a file's candidates. - **Cost** (Debug): an MP3 / FLAC / WAV song decodes in 46-75 ms (70 s at 11 kHz) and estimates in 120-140 ms; a cached Opus stream took 2.8-11 s to decode in Debug (the built-in decoder and resampler unoptimized, other builds running), so the worst case is a quarter of one core at below-normal priority with one song per 12 s; Release was not measured. `tempo_test`'s 70 s envelope: 130-360 ms, the estimate 4-8 ms. ### 3.66 Headphone correction (Kulaklık düzeltmesi, AutoEq) A parametric correction per output device, after the 10-band equalizer. `audio/ParametricEq` (the filters, the parser; `audiodsp_test`), `app/AutoEq` (standalone: the AutoEq index, search, downloads, the per-device store; `autoeq_test`), `app/HeadphoneEqSettings` (the settings rows, the search dialog, the import). - **Filters**: peaking, low-shelf and high-shelf biquads (and low / high pass) from the RBJ Audio EQ Cookbook with the Q AutoEq and Equalizer APO use, up to 20 per profile, double precision, transposed direct form II, interleaved float PCM. Clipping-safe: the gain in front of them is the profile's preamp, lowered further when the combined response still rises above 0 dB anywhere in 20 Hz-20 kHz; the output limiter catches what is left. Coefficients are recomputed when the output rate or channel count changes (exclusive mode changes it per track). Checked against scipy's evaluation of the same biquads and against AutoEq's own published curve for the HD 600 (oratory1990) at 44.1 / 48 / 96 kHz. - **Engine**: `AudioEngine::setDeviceEq` takes the enabled profiles by WASAPI endpoint id (a versioned snapshot under a mutex); the engine thread applies the profile of the endpoint it has open (`WasapiOutput::deviceId`) at the next block, with a filter state of its own (and another for the preview voice), so changing the output device, or Windows changing the default one, switches the correction with it. No profile for the device = no stage. - **Profiles** (`autoeq.json` in the profile folder, UI thread; a damaged file is kept as `autoeq.json.bad`): one per endpoint id with the device's name at the time, the profile's name, source and index path (credits), the filters, the preamp and whether it is on. *Ayarlar › Ses › Kulaklık düzeltmesi (AutoEq)*: the toggle, then a panel for the device playing now (the engine's open endpoint, else the chosen output device, else the Windows default; followed every 0.5 s while the page is open): its name, the profile, "AutoEq · source · N filtre · ön yükseltme X dB", the frequency response as a thin line (20 Hz-20 kHz log, ±12 dB grid; the accent when on, tertiary when off) and *Kulaklık ara…*, *Dosyadan içe aktar…*, *Ölçüm sayfası* (the entry's AutoEq page), *Kaldır*. Turning the toggle on without a profile opens the search. - **AutoEq data** (`https://raw.githubusercontent.com/jaakkopasanen/AutoEq/master/results/`), fetched on demand only: `INDEX.md` (~0.9 MB, ~8800 entries) when the search dialog opens, kept in `cache\autoeq` and refreshed after 7 days (a stale copy is used when GitHub can't be reached); one `<model> ParametricEQ.txt` when an entry is picked (cached per entry). The dialog filters as you type (every word of the query, case / accent folded; names starting with it first; a model's measurement sources stay together in AutoEq's order of preference, oratory1990 first), shows at most 120 rows with the source, rig and form (Kulak üstü / Kulak içi / Açık kulak içi), and says where the measurements come from. Offline it shows the error with *Yeniden dene*. AutoEq is MIT-licensed; the profiles are not bundled (THIRD_PARTY_NOTICES.md). - **Import** (`parsePeqText`): AutoEq's `ParametricEQ.txt` and Equalizer APO configuration files (`Preamp:`, `Filter N: ON|OFF PK|LSC|HSC|LS|HS|LP|HP Fc … Gain … Q …`, `BW Oct`, `Channel:` sections: filters for only some of the channels are skipped). A `GraphicEQ:` line is counted as unsupported and a file with no usable filter is refused with a toast; lines it can't read are counted ("N satır atlandı"). ### 3.67 Podcast chapters, transcripts and speech processing `app/PodcastChapters` (standalone parsers; `podcasts_test`), `app/PodcastExtras` (the service around the playing episode), `app/PodcastChapterList` (Now Playing's *Kısımlar* tab), `audio/SpeechDsp` (`audiodsp_test`). - **Chapters**, loaded on a worker when an episode starts (the last 16 episodes' results kept): the feed's `<podcast:chapters>` JSON (Podcasting 2.0; `toc: false` entries and ones without a start skipped), else the audio's own tags: ID3v2.3 / 2.4 `CHAP` frames (with `TIT2` and `WXXX`, in the top-level ordered `CTOC`'s order when there is one) or Nero `chpl` chapters in an MP4's `moov/udta` (QuickTime chapter text tracks are not read). A downloaded episode is read from disk; a streamed one with one ranged request for the head (256 KB, more for a bigger ID3 tag up to 4 MB, or up to an MP4's `moov` when it comes before `mdat`). Chapters are sorted, given ends, and clamped to the duration. A failed request (offline) is asked again next time. - **Chapters in the UI**: thin ticks on the seek waves (`ui::Slider::setMarks`, the player bar and Now Playing), the chapter's title in the seek hover tip, the *Kısımlar* tab (time + title per row, the playing chapter marked in the accent and kept in view, click / Enter seeks) with previous / next chapter buttons in the tab bar (`skipChapter`: "previous" more than 3 s into a chapter goes back to its start). - **Transcripts**: the feed's `<podcast:transcript>` links, fetched when Now Playing's first tab (*Döküm* for episodes) needs them, best format first: WebVTT (`<v Speaker>` voices, inline word times), SRT (a "Name:" prefix as the speaker), Podcasting 2.0 JSON (word segments grouped into sentences at a speaker change, a sentence end or a 1.5 s pause), HTML (`<cite>` / `<time>` / `<p>`), plain text unsynced. They become `lyrics::Lyrics` (`transcriptToLyrics`): a line per cue with "Name: " when the speaker changes, word times kept when they spell the line, and a long timed cue (some publishers time whole paragraphs) cut into lines of about 90 characters at sentence ends or between words, timed by their words or their share of the cue. The lyrics view then highlights the current line and seeks on a click as for songs; translation, *Yanlış sözler mi?* and the sources' footer are off for episodes. The last 4 transcripts stay in memory. - **Speech processing** (`audio/SpeechDsp`, `StreamSource::speech`, `AudioEngine::setSpeech` while it plays): *Sessizliği kısalt* shortens pauses (5 ms chunks with their peak below -42 dBFS) longer than 0.3 s to 0.3 s, keeping the start of the pause and the breath before the next word; it is a pull stage after the time stretcher whose blocks are contiguous in the track, so positions, seeking and the progress stay exact. *Ses netleştirme* is a speech curve (70 Hz high pass, -2.5 dB at 300 Hz, +3.5 dB at 2.8 kHz) and a gentle stereo-linked RMS compressor (-24 dBFS, 3:1, 6 dB knee, +7 dB make-up). General switches in *Ayarlar › Ses › Podcastler* (`Settings.podcastTrimSilence` / `podcastVoiceBoost`), a per-show override in the show page's more menu (*Genel ayar* / *Bu programda açık* / *kapalı*; `podcasts.json` `shows`). Changes apply to the playing episode at once. Music, radio and the preview voice never get them. - **Time saved**: the engine counts the trimmed frames (`silenceTrimmedMs`), the app adds them to the playing show (`addSavedTime`), the settings row shows the total ("Şimdiye kadar … kazandırdı") and the show page its own share from 10 s on. - **Network**: chapter files, transcripts and range requests go through the podcast client (public hosts only, unless the feed was added by URL on the local network; capped bodies: 512 KB chapters, 8 MB transcripts). - **Dev**: `SHADETUBE_PLAY_EPISODE=<feed URL>[|<index>]` plays a feed's episode at startup; `SHADETUBE_NP_TAB=chapters`. ### 3.68 Proxy Ayarlar › Bağlantılar › Proxy: **Sistem** (the default and the old behaviour: WinHTTP's automatic proxy, i.e. WPAD / PAC / the Windows setting), **Kapalı** (always direct), **HTTP** or **SOCKS5** with a server, a port, an optional user name + password, *Yerel adresleri atla* and *Bağlantıyı test et*. `core/Proxy` holds the setting, the WinHTTP sessions, the bridge and the test; `core/ProxyProtocol` the wire formats (authorities, the SOCKS5 greeting / RFC 1929 login / request / reply, CONNECT, request and response heads, local names); `app/ProxySettings` the rows, `proxy.dat`, the startup apply and the failure toasts. - **Stored**: `settings.json` `proxyMode` (`system` / `off` / `http` / `socks5`), `proxyHost`, `proxyPort`, `proxyUser`, `proxyBypassLocal`; the password DPAPI-encrypted (this Windows user) in `proxy.dat` in the profile, like the Spotify cookie. It is never logged; the log names the mode, the server and "with a user name". The mode and the toggle apply as they change; the text fields on Enter or with the test (the button reads *Uygula ve test et* while they are edited), so typing a host doesn't reconnect the app on every key. A pasted `socks5://host:1080` or `host:port` is split into the two fields. Applied at startup before the first request (`main.cpp`). - **A session per kind**: WinHTTP refuses `WINHTTP_OPTION_PROXY` on automatic-proxy sessions and their requests (error 12011), so the way is fixed when a session opens. `proxy::openSession(agent, flags)` opens one for the current kind: *Automatic* (Sistem; `DEFAULT_PROXY` before Windows 8.1), *None* (Kapalı) or *Bridge* (`NAMED_PROXY 127.0.0.1:<bridge port>`, no bypass list). `proxy::SessionSet` keeps one session of each kind for a user and hands out the current one per request (`http::getLimited`, AltSource, InternetRadio, podcast media; HttpStream and JamMqtt open theirs per connection). YoutubeExplode gets `http::client()`'s `ProxiedClient`, one `createDefaultHttpClient` per kind: `HttpClientOptions::proxy` empty = automatic, `"direct"` = no proxy at all (new in `external/YoutubeExplode`: `WINHTTP_ACCESS_TYPE_NO_PROXY`, curl `CURLOPT_PROXY ""`), a name = that proxy. - **The bridge**: WinHTTP speaks no SOCKS and can't give a named proxy credentials once per session, so HTTP and SOCKS5 both go through an in-process loopback HTTP proxy (`127.0.0.1:<ephemeral>`, a thread per connection, started on first need). It serves only this process and its descendants (WebView2): the peer's owning PID (`GetExtendedTcpTable`) must be ours or have us among its parents. It takes `CONNECT host:port` and absolute-form `http://` requests and opens the way on: an HTTP proxy gets a CONNECT with Basic auth (or the absolute request itself, with `Proxy-Authorization`); a SOCKS5 proxy gets the name (ATYP domain: no DNS on this PC, like `socks5h`) and RFC 1929 user / password. Plain HTTP answers get `Connection: close` (one request per connection; ICY answers pass as they are). A failure answers `502` with `X-ShadeTube-Proxy: <reason>` and reports a `proxy::Problem` (`Unusable`, `NameNotFound`, `Unreachable`, `Timeout`, `AuthRequired`, `AuthFailed`, `Protocol`, `Refused`); `app/ProxySettings` turns those of the proxy itself into one toast per run of failures (the same problem at most once a minute). An "HTTP proxy" that closes, resets or answers with something other than HTTP, and a "SOCKS5 proxy" that doesn't answer the greeting within 6 s, are `Protocol` ("HTTP mi, SOCKS5 mi?"). - **Raw sockets**: `proxy::openConnection(host, port, timeout, cancel, error)` is the one way to a TCP target outside WinHTTP: direct for Sistem / Kapalı, otherwise a tunnel through the proxy (CONNECT / SOCKS5), never around it. HttpStream's Shoutcast v1 path uses it. - **No leaks**: with HTTP / SOCKS5 set, every request goes to the bridge and the bridge never falls back to direct. An incomplete setting (no server or port) gives the sessions a proxy name that never resolves (`shadetube-proxy-unavailable.invalid`), so requests fail. `http::isLocalHost` (getLimited's local-target check) does no DNS query while a proxy is set (the LAN's own names count as local), and internet radio skips its own SRV lookup of the radio-browser servers (the fixed list is used). WinHTTP never sends loopback targets (`127.0.0.0/8`, `localhost`, `::1`) to a named proxy: they stay direct with or without *Yerel adresleri atla*. That toggle makes the bridge connect directly to local names: no dot, `.local` / `.lan` / `.home.arpa` / `.internal` / `.localdomain` / `.home`, private, link-local and loopback addresses. Discord RPC (a local pipe), the phone remote, the LAN servers and casting (3.74 Cast to device: SSDP, DLNA control, the Cast channel, the media server) are not proxied; while a proxy is set, `cast::tcpConnect` reaches only local targets (an IP literal on the LAN or a local name), so an address from a device's answer can't send a connection past the proxy. A cover the app serves to a device is fetched through the proxy (`http::getLimited`); what a device fetches by itself is its own traffic. - **Live changes**: `proxy::configure` bumps `proxy::generation()`. The bridge's tunnels of an older generation end within 200 ms (each relay loop checks it; a `shutdown()` from another thread blocked, so none is used), and the next request opens through the new kind's session. Long-lived readers check the generation and reconnect: HttpStream (so progressive audio, live radio and video), ProgressiveBuffer, podcast downloads and JamMqtt (a clean DISCONNECT, then a new connection the new way). - **WebView2** (the Spotify login): `proxy::browserArguments()` goes into `CoreWebView2EnvironmentOptions`' `AdditionalBrowserArguments`: nothing for Sistem, `--no-proxy-server` for Kapalı, and for HTTP / SOCKS5 `--proxy-server=http://127.0.0.1:<bridge>` with `"--host-resolver-rules=MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"` (no name resolution of its own), `--disable-features=DnsOverHttps` (Chromium sends its DNS-over-HTTPS probes past any proxy: one went straight to the system's DoH server before this was added) and `--force-webrtc-ip-handling-policy=disable_non_proxied_udp`. The bridge holds the credentials, so WebView2 never meets an authentication challenge. A browser process keeps its arguments: an open login window uses a new setting once it is opened again. - **SMTC**: `RandomAccessStreamReference::CreateFromUri` lets Windows fetch the cover itself, past the proxy; in Kapalı / HTTP / SOCKS5 the app fetches it (`http::getLimited`, 4 MB) and hands Windows a memory stream. - **The test** (`proxy::test()`): with a proxy, first a tunnel to `www.youtube.com:443` (its failure names the problem), then `https://www.youtube.com/generate_204` through the normal transport; the row shows the result and the time ("YouTube 575 ms'de yanıt verdi"). - **Verified**: `proxy_test` (offline: the wire formats, the bridge against fake HTTP and SOCKS5 proxies with and without auth, wrong passwords, dead / wrong-kind proxies, bypass, live changes, the browser arguments). The app in sandbox profiles through local Python proxies (HTTP and SOCKS5, with and without auth, logging every connection) while a watcher listed every TCP connection of the app and its child processes: search (MusicBrainz and YouTube Music), covers, playback, lyrics, SponsorBlock, video mode, a podcast episode, internet radio (also switched from Kapalı to HTTP mid-stream: it reconnected through the proxy), Jam's MQTT, the updater and the Spotify login page all went through the proxy, nothing direct; names reached the SOCKS5 proxy unresolved. A dead proxy port: requests failed with the toast, nothing direct. The connection test: a working proxy and a refused password. ### 3.69 Customize Home (Ana sayfayı düzenle) The Home's shelves in the user's order, hidden ones left out, and a "Sabitlenenler" shelf of pinned collections at the top; one layout per Spotify account. `app/HomeLayout` (the model and its store; `homecontrols_test`), `app/HomeCustomize` (the page's sections, the editor, pins, the support card 3.73), `app/HomePage` (the ids, which fetches to skip). - **Ids**. Every movable part of Home is a *section* with a stable id: `pinned`, `support`, `new-releases`, `smart`, `recent`, `playlists`, `albums`, `artists`, the logged-in feed's `spotify:<section uri>` (`Shelf::id`, filled by `parseHome`; a shelf without one is `spotify:<upper-cased title>`), the open catalog's `mb:trending`, `mb:for-you`, `mb:artists`, `mb:albums`, YouTube Music's `ytm:for-you` and `ytm:<upper-cased title>` (`#2`, `#3` for a repeated title). Placeholders and errors (`spotify:loading`, `library:loading`, `net:loading`, `net:error`) are *fixed*: never listed, never hidden, always at their natural place. A section with nothing in it takes no room and is not listed (unless hidden: then it is listed so it can be shown again). - **Arranging** (`homelayout::arrange`): the page adds its sections in its own (natural) order; ids the user placed keep the user's order, an id the layout has never seen (a new feature's shelf, a personalized Spotify shelf with a new id) goes right after its natural predecessor, and ids not on the page now keep their slot in the saved order, so a shelf that comes and goes (Yeni çıkanlar) returns where it was put. `move()` saves the on-screen order with that one move and keeps the absent ids next to the same neighbours. Caps: 200 order entries, 100 hidden, 48 pins. - **Editing**: *Ana sayfayı düzenle* (the button under the last section, or the command palette, which opens Home first) swaps the sections for a list of rows: a grip to drag (the others make room, the row glides to its slot, reduce motion snaps), ↑ / ↓ buttons (reachable with Tab, for the keyboard), a switch to show / hide, a *GİZLİ* badge, *Varsayılana dön* (the natural order, everything shown; pins stay) and *Bitti*. Every change is saved at once (`home-layout.json`, write-then-rename) and the page re-arranges behind the list. Leaving Home ends editing. - **Fetches**: on the open catalog (MusicBrainz) a hidden `mb:trending`, `mb:albums`, `mb:artists` or `mb:for-you` is not fetched at all, nor YouTube Music's `ytm:for-you` (the related-artists request); when one is shown again only that catalog part is fetched again (the page doesn't jump). The logged-in Spotify feed and YouTube Music's own feed are one request each, so hiding their shelves saves no request. - **Pins**: *Ana sayfaya sabitle* / *Ana sayfadan kaldır* in the menus of album, playlist, Liked Songs and artist cards (Home, Search, the browse pages), the album / playlist / Liked Songs page header and the artist page's ⋯. A pin keeps what its card shows (name, subtitle, picture), refreshed from the library when it has the item; newest first. - **Dev**: `SHADETUBE_HOME_DEMO=edit` (5.4) opens the editor once Home has its content. ### 3.70 Headphones, Bluetooth and calls Playback pauses when the output it plays on goes away, and calls can lower or pause it. `app/AudioFocus` (the rules and the COM watcher; `homecontrols_test` covers the rules), `app/AudioFocusUi` (the app side, the settings rows). A hook of its own: the engine's device handling (`audio/WasapiOutput` reopens the stream on another device) is untouched. - **Watcher**: its own MTA thread with an `IMMNotificationClient` (default render device changed, device state changed) and `IAudioSessionManager2::RegisterDuckNotification` on the device in use (re-registered when Ayarlar › Ses picks another one); events are posted to the UI thread. A device is *personal* when its `PKEY_AudioEndpoint_FormFactor` is headphones / headset / handset or its enumerator is Bluetooth (`BTH…`). - **Output lost** (*Kulaklık çıkınca duraklat*, `Settings.pauseOnDeviceLoss`, on): the device in use is removed / disabled / unplugged, or (following the default) the default moves from a personal device to a non-personal one: pause, toast *Ses aygıtı ayrıldı*. Speakers to anything, headphones to headphones and plugging in never pause. *Yeniden bağlanınca devam et* (`resumeOnDeviceReturn`, off): the same device back within 30 min plays on (1.5 s later, so the engine has reopened), unless playback was started or paused by anything else meanwhile. - **Calls** (*Aramalarda*, `callAction`: `none` / `duck` / `pause`, default none): Windows reports a communications stream starting / ending (Teams, Zoom, Discord) only while *Sound › Communications* is not "Do nothing". *Sesi kıs* lowers the volume to 30 % and restores it after the call (unless the user changed it meanwhile); *Duraklat* pauses and plays again 0.6 s after the call, only if ShadeTube paused. With duck / pause the session opts out of Windows' own attenuation (`SetDuckingPreference`) so the two don't stack. A quit during a ducked call saves the full volume. - **Dev**: `SHADETUBE_AUDIOFOCUS_DEMO=unplug|call` (5.4) feeds fake events through the same path 4 s after start. ### 3.71 Snoozed songs (30 gün ertele) A song the user is tired of for a while. `app/Snooze` (the store and matching; `homecontrols_test`), wired in `app/Radio.cpp` next to the kara liste (3.6), `app/AppContext.cpp` (the track menu), `app/Components` (the row badge), `app/Shell.cpp` (the queue panel), `app/PlaybackSettings.cpp` (*Ertelenenler*). - **Rules**: until it expires the player never picks it by itself: auto-advance, next / previous, a header-played or shuffled list, the repeat wrap and the prefetch pass over it (`Player::shouldSkip` = blocked or snoozed); song radio, endless playback's seeds and smart shuffle's candidates leave it out. A row the user clicks still plays. - **Matching**: the id, or the same recording elsewhere: title + first artist folded, durations within 3 s when both are known, another catalog when one is unknown (the blocklist's rule), so a snoozed Spotify song stays snoozed as its YouTube Music copy. - **UI**: *30 gün ertele* / *Ertelemeyi kaldır* in the song menu (its tooltip says how many days are left); lists and the queue panel dim the row and show *ERTELENDİ · 12 GÜN* (rounded up; 1 in the last hours); Ayarlar › Kara liste › *Ertelenenler* lists them with *Kaldır*. - **Store**: `snoozed.json` per account (`{version, songs: [{id, n, a, a0, d, t, u}]}`, newest first, at most 2 000, rewritten on each change, a damaged file kept as `.bad`). Expiry needs nothing: an entry past its time stops matching and the housekeeping tick prunes it (lists repaint through `snooze::revision()`). ### 3.72 Private session (Gizli oturum) While it is on, plays leave no trace. `app/PrivateSession` (the rules and the state; `homecontrols_test`), `app/PrivateSessionUi` (the title-bar chip, the menu item, the settings row). - **What stops** (each recorder asks `privsession::records()`): the play history (Kitaplık › Geçmiş, Home's recent shelf), the listening stats (and through them Senin için, kurallı listeler, Blend profiles and the year in review), the Library's recently played collections, the Radyo page's recent stations, Last.fm / ListenBrainz scrobbling (a scrobble in progress is dropped when it starts) and the Discord presence (cleared). ShadeTube never reports plays to Spotify, so Spotify's recently played is untouched either way. Listen together, the queue, the song cache and podcast progress go on as usual. - **On / off**: the account menu (title bar), the tray menu and the command palette (*Gizli oturumu başlat / kapat*); a toast says what it does. While on, a *GİZLİ OTURUM* chip (lock, accent outline) sits next to the account tag; its menu shows when it ends and *Gizli oturumu kapat*. The tray tooltip gets a "Gizli oturum" line. - **Ending**: after 6 hours (`Settings.privateSessionEnds = "6h"`, the end time kept in `privateSessionUntil`, so it survives a restart) or with the app (`"restart"`: never saved). The housekeeping tick ends a session whose time is up (toast). Ayarlar › Bağlantılar › Gizlilik picks which. ### 3.73 Support card (Bir kahve ısmarla) A quiet way to support the developer: `https://buymeacoffee.com/berkayay`. `app/HomeCustomize` (`openSupportPage`, `addSupportCard`). - **Home**: a card with a thin outline (accent cup, *ShadeTube'a destek ol*, one line, *Bir kahve ısmarla*, a ×), placed right after the first section with content; it is the `support` section, so the editor (3.69) moves or hides it. × hides it for 60 days (`Settings.supportCardHiddenAt`) with a toast naming Ayarlar › Hakkında. - **Always reachable**: Ayarlar › Hakkında (*Destek ol*), the command palette (*ShadeTube'a destek ol*) and the tray menu. - The link opens in the default browser (`ShellExecuteW`); every open is logged (`support opening <url>`), and `SHADETUBE_NO_BROWSER=1` (5.4) only logs it (tests). ### 3.74 Cast to device Songs, episodes and stations play on a Chromecast / Google or Nest speaker / Android TV (CASTV2), a DLNA media renderer (smart TVs, AV receivers, network speakers) or a Sonos speaker (UPnP); not Spotify Connect. ShadeTube stays the controller: the queue, next / previous, seeking, likes, lyrics, Now Playing, the phone remote, the media keys and scrobbling keep working on the device's position. The standalone core is `app/Cast*` (no app dependencies; `cast_test` compiles it): `CastProtocol` (pure: the XML reader, SSDP / mDNS / UPnP description / SOAP / DIDL-Lite / protocolInfo, CASTV2 protobuf messages and framing), `CastNet` (WinSock helpers, a small HTTP/1.1 client, the Schannel TLS client, the adapters), `CastDiscovery`, `CastMedia` (the media server), `CastRenderer` (`UpnpRenderer`, `CastV2Renderer`). `app/Casting` is the app side; `audio/MediaFeed` makes what the device fetches; `player/RemoteOutput` is the player's output while a device plays. - **Discovery** (`cast::discover`, read-only, ~3 s on a worker): from every IPv4 adapter that is up (UDP sockets bound to the adapter, `IP_MULTICAST_IF`, TTL 2), three rounds 1 s apart of SSDP `M-SEARCH` for `urn:schemas-upnp-org:device:MediaRenderer:1` and `…:ZonePlayer:1` and one mDNS question (PTR `_googlecast._tcp.local`, the unicast-response bit, sent from the ephemeral port: answers come back unicast, RFC 6762 6.7, so nothing listens on 5353). A UPnP answer's description is fetched (≤ 256 KB, 3 s, up to 32 at once): a device with an AVTransport service, the root or an embedded MediaRenderer (Sonos: the ZonePlayer's, named by its `roomName`), `URLBase` and relative control URLs resolved. Cast answers: TXT `fn` (the name), `md`, `id`, `ca` (bit 1 video = a TV icon; groups, "Google Cast Group", are listed as such), SRV port (groups have their own), A record (else the sender's address). Devices are merged by id (`upnp:<uuid>`, `cast:<id>`) as they arrive; the picker updates live. A search starts when the picker opens and the list is older than 30 s, and with *Yeniden ara*. Nothing connects at startup: the last device (`Settings.castDevice*`: id, name, kind, `ip:port` or the description URL) is listed first even before a search found it (a UPnP one is described again when picked). - **UI**: the player bar's `cast` icon beside the volume (lit in the accent while a device plays, its tooltip names the device) opens the picker (`ui::Menu`): *Bu bilgisayar* (`laptop`; checked when nothing casts), the devices (`tv` / `speaker` icon, the hint "DLNA" / "Chromecast" / "Sonos" or *Bağlanıyor…*, the one in use checked), *Cihazlar aranıyor…* / *Cihaz bulunamadı*, *Yeniden ara* (`MenuItem::keepOpen`: the menu stays and its rows are replaced as devices come, `Menu::replaceItems`). While a device plays, a pill with its name follows the title in the player bar where there is room, Now Playing's title bar reads "ŞİMDİ ÇALIYOR · <LİSTE> · SALON TV" with the device in the accent, its cast icon beside the knob is lit, and the phone remote's label says it (`device` in the state JSON). The command palette has *Cihazda çal…* (the picker), *Cihazda çal: <device>* for each known device and *Bu bilgisayarda çal*. Toasts: *Cihazda çalıyor: …*, *Bu bilgisayarda çalıyor*, *Cihaz bağlantısı kesildi: … — bu bilgisayarda duraklatıldı*, *Cihaza bağlanılamadı: …*, the firewall hint below. Icons `cast`, `tv`, `speaker`, `laptop` (3.43). - **The player** (`Player::setRemoteOutput`): the current item is opened again on the output at the same position (playing on if it played; the resolve is the normal one, so YouTube / cache / file choices don't change), the local engine stops; back to this PC the same way. Every engine call the player makes for the playing item goes through the `out*` helpers: open / preload / play / pause / seek / stop, the tag, the position, the duration and the clock (lyrics, the seek bar and SMTC extrapolate it like the engine's). The output reports through the engine's `EngineEvents` (state, ended with the gapless next tag, errors), so the player's advancing, recovery and error handling are the same code. While casting: the volume knob and the volume keys are the device's volume (the saved local volume is untouched), speed is 1 (the speed control does nothing), the spectrum / waveform / visualizer have no data, the buffer bar is empty, crossfade and previews are off, and the equalizer, loudness normalization and the limiter don't apply (the device gets the stream or plain decoded PCM). AutoMix (3.80) is off too: no early prepare for an analysis, `crossfadeMs` 0, the device's own gapless move, no AUTOMIX badge. Podcast silence trimming and voice boost (3.67) don't reach the device, so no saved time is counted for it. A queue switch (3.77) goes through the output: a paused or empty queue stops the device; a playing one opens its song there at its own position. Headphones, Bluetooth and calls (3.70) concern this PC's sound: losing the headphones doesn't pause the device and a call doesn't lower its volume or pause it (a call that lowered this PC's volume gives it back when playback returns here). - **Media** (`CastMedia::MediaServer`, only while a device is connected): an HTTP/1.1 server on this PC's address that routes to the device (`localAddressFor`: a UDP `connect` + `getsockname`; `SHADETUBE_CAST_BIND` overrides), an ephemeral port, every path `/<128-bit random token>/<n>.<ext>`; GET / HEAD / OPTIONS, one byte range (`a-b`, `a-`, `-n`; 416 past the end), keep-alive, `transferMode.dlna.org: Streaming`, `contentFeatures.dlna.org`, CORS for the Cast receiver, at most 24 connections, 64 KB writes (a paused device that stops reading is dropped after 5 min). Only the current item, the prepared next one and their covers are published (`retainOnly`). What an item is (`audio/MediaFeed`): when the device plays the format (Cast: AAC / MP4, WebM / Opus, MP3, FLAC, Ogg, WAV; DLNA / Sonos: the MIME types of its ConnectionManager sink, with aliases like `audio/x-m4a` = `audio/mp4`; a renderer that lists nothing gets MP3 only) the stream's own bytes (YouTube's download through the same `ProgressiveBuffer` as local playback, so the song cache fills as usual; a local file or download read from disk); otherwise the track decoded to 16-bit stereo PCM, as WAV (`audio/wav` with a 44-byte header) or, for a renderer that lists `audio/L16` and not WAV, big-endian `audio/L16;rate=…;channels=2` (the type needs the rate: the decoder opens first). PCM is decoded where the device reads (a seek / a new range far from the decoded position seeks the decoder; gaps are silence), at the length the duration gives. A refused original (DLNA 714 / 715 / 716, Cast `LOAD_FAILED` / an ERROR before playing) is tried once more as PCM. Stations go by their own URL (Cast also takes HLS; `.pls` / `.m3u` playlists and non-HTTP URLs can't be handed over: an error, the player moves on). Covers: Cast fetches web (`http(s)`) pictures itself; local and DLNA covers are served (read or fetched on the first request, ≤ 8 MB). DIDL-Lite: `musicTrack` (or `audioBroadcast`), title, artist / creator, album, `albumArtURI`, `res` with protocolInfo (DLNA.ORG_PN for MP3 / AAC_ISO / LPCM, OP=01 seekable by bytes, CI=1 for decoded, the streaming flags) and the duration. - **DLNA / Sonos** (`UpnpRenderer`, one worker thread): connect = GetTransportInfo, GetProtocolInfo, GetVolume. Load = SetAVTransportURI with the DIDL-Lite (once more after a Stop when the device says 701 / 705), Play, and a Seek (REL_TIME, else ABS_TIME on 710) once it plays when it starts mid-song. Polls GetTransportInfo + GetPositionInfo every second (500 ms while loading), GetVolume every 5 s; the position between polls is extrapolated. Gapless: the next item goes out with SetNextAVTransportURI as soon as the player prepares it (not for L16, whose type is known only when it plays); the move is seen in TrackURI; a device that refuses it once isn't asked again, and the next item then loads when the device stops at the end. STOPPED after playing near the end (within 5 s of it, counting the time it played on since the last position: a late poll, from a slow device or a busy PC, still sees an end) = ended; STOPPED earlier (the TV's remote) = paused, and play continues there. Someone else's URI playing = taken over. Not playing 15 s after a load = failed; ERROR_OCCURRED = failed. 4 unanswered requests in a row (2 while loading) = lost. - **Chromecast** (`CastV2Renderer`): TLS 1.2 to port 8009 through Schannel (the device's self-signed certificate is not checked: devices on the LAN), CastMessage protobufs hand-encoded (fields 1-6, 4-byte big-endian length; ≤ 1 MB). CONNECT + GET_STATUS to `receiver-0`; LAUNCH of the Default Media Receiver (`CC1AD845`) on the first load, then CONNECT to its transport and media LOAD (contentId / contentUrl, BUFFERED or LIVE, the duration, metadataType 3 with title / artist / albumName / images, autoplay, currentTime). PLAY / PAUSE / SEEK / STOP on the media session, SET_VOLUME on the receiver; a PING every 5 s, the media status asked every 5 s (and pushed by the device); 20 s without a byte = lost; a RECEIVER_STATUS without our session (another sender / app) = taken over. IDLE FINISHED = ended; IDLE CANCELLED (stopped at the device / by another sender) = paused (play loads it again there). No queue on the device: the next item loads after FINISHED (a short gap). Close = receiver STOP (when stopping) + CLOSE, then an orderly TLS end. - **Falling back**: lost (the device stops answering, closes the connection or is taken over) = the player goes back to this PC paused where the device was, with a toast; connecting fails = a toast, nothing changes. A device that never fetched anything from the media server when an item fails (after the PCM try) can't reach this PC: it is stopped, the player goes back to this PC paused, and the toast says to allow ShadeTube in Windows Firewall. An expired YouTube URL under the device = the player's usual re-resolve. *Bu bilgisayarda çal* (the picker, the palette) = back here at the device's position, playing on; the device stops. Picking another device = the same, then that device. Leaving the app stops the device (`persistHooks`, at most 2.5 s). - **Firewall**: like the phone remote (3.23), the media server's first `listen` on a LAN address makes Windows Firewall ask; *Allow* on private networks is what the devices need (on a network Windows marks Public, the default answer blocks them: the firewall toast above). Discovery needs no rule (its answers are replies to its own queries). Testing with `SHADETUBE_CAST_BIND=127.0.0.1` and local mocks asks nothing. - **Dev**: `SHADETUBE_CAST_DEVICES` replaces discovery with given devices (`dlna:<description URL>` / `cast:<ip>[:port][=Name]`), `SHADETUBE_CAST_BIND`, `SHADETUBE_CAST_DEMO` (5.4). The test mocks used for this feature (not in the repository): a Python UPnP renderer (description, AVTransport / RenderingControl / ConnectionManager SOAP, a playback clock with SetNext, and a fetch of every URI it gets, its DIDL-Lite and cover) and a Python CASTV2 receiver (TLS with a self-signed certificate, the framing, receiver / media namespaces, LOAD with a fetch, FINISHED, refusals). Measured against them on 127.0.0.1 (Debug): connect 10-130 ms; an L16 item waits ~260 ms for the decoder before its load goes out; Cast's next item plays ~120 ms after FINISHED, UPnP moves on gaplessly (SetNext); a renderer that disappears is noticed in ~9 s (4 failed polls; refused connections on 127.0.0.1 take ~2 s each). ### 3.75 Concerts and upcoming releases Concert dates and announced (not yet released) albums of the artists the user plays and follows: a "Konserler" section and a "Yakında" card on artist pages, the "Yakınındaki konserler" and "Yakında" shelves on Home. `spotify/Concerts.cpp` (the requests and parsers), `app/ArtistEvents` (the model: cache, filters, dates; standalone), `app/ArtistEventsUi` (the scan, the shelves, the artist page's parts, the settings rows); `artistinfo_test`. - **Source: Spotify's public artist pages**, no account. The other concert sources need a key: Bandsintown refuses app ids it didn't issue (tried 2026-12-02), Songkick and Ticketmaster's Discovery API want an API key, setlist.fm a key (and lists past shows); MusicBrainz' event data is sparse. Spotify's web player answers its logged-out token (`fetchAnonymousToken`: `get_access_token?reason=init` without a cookie; `Api::query` then sends no `Cookie`) for artist overviews and concerts, each concert with its ticket sellers. Logged in, the session's Api is used instead. Requests (Pathfinder, 3.5): `queryArtistOverview` now asks `preReleaseV2: true` and carries `goods.concerts` (the first ten, soonest first, with venue and city, and `totalCount`) and `preReleaseV2.data` (the countdown album: name, type, cover, `preReleaseEndDateTime`; the older `preRelease` shape is read too) → `ArtistPage::concerts / concertsTotal (0 = all shown) / upcoming / upcomingAt`; `ArtistConcerts` (`{artistUri, geoHash: null, includeNearby}`: every concert, city only, and the place Spotify locates the connection in); `concert` (`{uri, authenticated: false}`: the ticket offers, provider + URL + sold out). Both hashes are in the registry and heal like the others. - **Scan** (`ArtistEventsUi.cpp`, housekeeping tick, Low priority): one minute after start, then at most every 12 h; up to 30 artists — the most played (`topArtists(20)`), then the followed ones (Spotify's when logged in, else the local library's) — one overview each with 1.5 s between them; an artist answered in the last 12 h (an artist page opened meanwhile) is skipped. A non-Spotify artist (MusicBrainz / YouTube Music) becomes a Spotify artist by MusicBrainz' `open.spotify.com/artist` url-rel, else an artist search whose result has exactly the same folded name (kept 30 days, a miss too). After the artists: `ArtistConcerts` of the first one for the location's name. A 429 stops the scan until Retry-After (at least 30 min), a scan that got nothing waits 45 min; any error is silent (the shelves keep the last answers). The cache (`cache\artist-events.json`, write-then-rename, up to 80 artists) is read at start; Exit cancels a running scan. - **Yakınındaki konserler** (Home, after "Yeni çıkanlar"; shelf id `concerts`): the cached artists' concerts that haven't begun (3 h grace) in the cities of *Ayarlar › Bağlantılar › Konserler › Konser şehirleri* (commas or semicolons; compared folded: case, accents, Turkish ı / İ, punctuation), else in the city Spotify places the connection in (the logged-out token: by IP; shown in the setting's description and as the shelf's meta). Spotify's `nearby` list is not used for the filter: for the logged-out token it returned every concert of the artist (any country), so the app filters by city itself. A country can't be set: Spotify's concert data names the city only. Cards: the artist's picture, the date as the badge ("20 ARA"), "Pazar 21:00 · Volkswagen Arena" (weekday and time in the venue's own time zone, as Spotify lists them); open = the tickets (below), the context menu "Sanatçıya git". Up to 20, soonest first, one card per concert. - **Yakında** (Home, after it; shelf id `upcoming`): Spotify's announced albums of the cached artists whose release time is ahead, then MusicBrainz' future-dated release groups of the played / followed MusicBrainz artists (one search per 15 artist ids, `firstreleasedate:[<tomorrow> TO 2100-12-31]`; MusicBrainz also matches bare years there, so only dates after today count: a full date after today, a month after this month, a year after this year). Same album and artist from both: Spotify's. Badge: the countdown ("8 GÜN KALDI", "3 SA 12 DK KALDI") when Spotify gives the exact time and it is under 14 days away, else the date. Open: a Spotify pre-release album has no playable page yet, so it opens `open.spotify.com/album/<id>` in the browser (its pre-save page); a MusicBrainz one opens the album page. - **Artist pages**: the features column gets a "YAKINDA · 10 ARA 2026" card first (Spotify's countdown album, else the nearest future-dated album / single of the discography; "Albüm · 8 gün kaldı"), and "Son çıkan" no longer picks a release dated after today (`browse::newestRelease(page, today)`). "Konserler" (before the discography; header meta "13 KONSER", "Tümünü gör" opens `open.spotify.com/artist/<id>/concerts` when Spotify has more than shown): up to five rows — a hairline date box (the month in the accent), the venue (else the title), "Cumartesi 19:00 · İzmir · <festival name>", a "YAKININDA" badge when the city is one of the active cities, "FESTİVAL" outlined for festivals — focusable, Enter / click = tickets; "Bilgiler: Spotify" under them. A Spotify artist's page fills it from its own overview (and refreshes the cache); a MusicBrainz / YouTube Music artist's page asks Spotify's overview of the same artist (its url-rel, the cached name lookup or an exact-name search) in the background and shows the section only when there are concerts. Nothing is shown when there are none or the request fails. - **Tickets**: `concert` is asked when a concert is opened. One offer opens its URL in the browser; several open a menu (provider, "TÜKENDİ" for sold-out ones, last) with "Spotify'da gör" under a separator; none (or a failure) opens the concert's Spotify page (`open.spotify.com/concert/<id>`), which lists the sellers too. - **Settings**: *Ayarlar › Bağlantılar › Konserler*: "Konserler ve yakında çıkacaklar" (`Settings.artistEvents`, on; off = no scan, no shelves, no artist page parts) and "Konser şehirleri" (`Settings.concertCities`; saved on Enter with a toast, applied to the shelf at once). The description says what Spotify sees: which artists are looked up. - **Notification**: none of its own. The new-release notification of followed Spotify artists (3.34, `NewReleases`) already fires on release day. - **Dev**: an `artist-events.json` in the `SHADETUBE_SPOTIFY_DEMO` folder stands in for the cache (shown, never scanned or saved); with that folder's `artist.json` the artist page shows the overview's concerts / countdown (5.4). ### 3.76 About the song ("Şarkı hakkında") What a song is about and the songs it is connected to: Genius' description, the songs it samples / is sampled in, interpolates / is interpolated by, covers / is covered by, remixes / is remixed by, live versions; each related song playable from the active catalog. `lyrics/SongFacts` (Genius' search + song page), `musicbrainz` (`songRelations`), `app/SongInfo` (the provider chain and cache; standalone), `app/SongInfoUi` (the dialog); `artistinfo_test`. - **Where**: the track menu's "Şarkı hakkında" (after "Krediler"; songs with a title and an artist, not radio stations or podcast episodes) and a "Şarkı hakkında ↗" link beside "Tüm krediler" in Now Playing's *Hakkında* (under it when the column is narrow; also when the song has no credits). - **Genius** (no key: the site's own JSON, as the lyrics search of 3.58): `genius.com/api/search/song?q=<title> <main artist>&per_page=10`, the hit that is the same song by one of the track's artists (`lyrics::sameSong`; translations and Genius' own pages skipped), then `/api/songs/<id>?text_format=plain`: `description.plain` (Genius' "?" placeholder and bare links dropped) and `song_relationships` (`samples`, `sampled_in`, `interpolates`, `interpolated_by`, `cover_of`, `covered_by`, `remix_of`, `remixed_by`, `live_version_of`, `performed_live_as`; translations out, each song once, at most 12 per kind) with title, artist, year and cover. - **MusicBrainz** when Genius names no related song (unknown song, or a description only): the recording found by title + artist (+ length; the credits' ranking, 3.46), looked up with `recording-rels+work-rels`: "samples material" forward = samples, backward = sampled in; "remix" forward = remix of, backward = remixed by; its work (the "performance" relation) looked up with `recording-rels`: a cover recording gets the original (the first non-cover, non-live recording by another artist), an original gets the covers (one per artist, medleys and partial ones out). Genius' description stays when MusicBrainz adds the relations ("Bilgiler: Genius · MusicBrainz"). - **Cache**: `cache\songinfo\<track id or a hash of title|artist>.json`, 30 days for an answer, 3 days for "nothing known"; a failure (offline) is not cached; 32 answers in memory. - **Dialog** (600 DIPs, `ui::Dialog`): "<title> · <artists>" under the heading; skeleton lines while loading; the description's paragraphs; one group per relation kind ("ÖRNEKLEDİĞİ ŞARKILAR · 2") of 56 DIP rows (cover, title, "artist · year"); a scroll bar always shown for long answers; "Genius'ta aç" (leading) when Genius knows the song. States: "Bu şarkı hakkında bilgi yok." (Genius and MusicBrainz know nothing), a note when there is a description but no related song, "Şarkı bilgisi yüklenemedi. Bağlantını kontrol et." when offline (opening it again retries). - **Playing a related song**: a row looks the song up in the active catalog (`lyricsearch::findInCatalog`: Spotify's track search logged in, else YouTube Music's or MusicBrainz' song search; the first playable hit that is the same song) and plays it (context "Şarkı hakkında"), closing the dialog. Not found: the row says "Bu katalogda yok · aramak için seç" and a second activation opens Search for "<artist> <title>". Rows are focusable (Tab, Enter). - **Dev**: `SHADETUBE_OVERLAY_DEMO=songinfo@3000[=Artist - Title]` opens the dialog for the playing song, a sample one, or that song (5.4). ### 3.77 Several queues Up to ten named play queues ("Çalışma", "Parti"), one of them active. `player/Queues` (the set and its JSON; standalone, `queues_test`), the queue model's part of `player/Player` (its "Several queues" section: switching, new, move, rename, delete), `app/QueueSwitcher` (the picker's menu, the name dialogs, the palette entries). - **The set** (`QueueSet`): entries `{id, number, name, state}`; the active entry's state lives in the Player itself (items, play order, slot, position, context, shuffle, repeat), the others in their `QueueState`. An unnamed queue is "Sıra <n>" (its number, never reused while it exists); names are trimmed to 40 characters. At most `kMax` = 10: "Yeni sıra" / "Kuyruğu yeni sıraya taşı" then say so in a toast. - **Switching** (the rule): the queue left keeps its song and position; the queue switched to continues from its own slot and position: playing when something was playing (or loading to play), else shown paused like a restored session (the first Play resolves it); an empty queue stops playback. A playing switch is an ordinary track change (history, scrobbling and the views follow); a paused one counts as nothing played. A toast names the queue. - **New queue**: an empty queue becomes active and the music stops (the old queue keeps its place). **Move the upcoming songs** ("Kuyruğu yeni sıraya taşı"): everything after the playing slot goes, in its play order, to a new, inactive queue with the same context, shuffle and repeat; the playing song keeps playing (endless playback may refill the active queue as usual). **Delete**: asks when the queue has songs; deleting the active queue switches to its neighbour (the previous one, else the next) by the rule above; the last queue can't be deleted. - **Shuffle and repeat are per queue**: each queue keeps its own; `Settings.shuffle` / `repeat` mirror the active one (they are what the player bar shows and what a restart restores). - **UI**: the queue panel's "Şimdi çalıyor" row (and Now Playing's *Sıradaki* tab) shows the active queue's name as a dropdown (`Button::setDropdown`); its menu lists the queues (the active one checked, the song count as the hint), then *Yeni sıra…*, *Kuyruğu yeni sıraya taşı…*, *Sırayı yeniden adlandır…*, *Sırayı sil*. The command palette offers "Sıraya geç: <ad>" for each other queue, "Yeni sıra" and "Kuyruğu yeni sıraya taşı". - **Persistence** (`session.json`): the active queue stays at the top level in the old format (old files load as a single queue), the others under `"queues": {"active", "nextId", "list": [{"id", "num", "name", "state"}]}`; each queue saves at most 500 slots of its play order (100 behind its slot). Every saved item carries its item rank (`"o"`), so a shuffled queue unshuffles to its context's order after a restart. A damaged list falls back to the single active queue (unknown active id, duplicate / invalid ids skipped, at most ten kept). - **Listen together**: the host's active queue is the session's queue. Guests see no picker and no palette entries, and the player refuses their `SwitchQueue` / `EditQueues` commands (the same toast as shuffle / repeat). - **Tests**: `queues_test` (the set, its JSON including damaged files, and a real Player on generated WAVs: switching while playing / paused, empty queues, new, move, delete, shuffle order per queue, restore after a restart). `SHADETUBE_OVERLAY_DEMO` steps `queuemenu`, `queuenew`, `queuemove`, `queuedelete` (5.4). ### 3.78 Radio builder ("Radyo oluştur") Saved stations made of several picks, played as an endless queue. `musicbrainz/LbRadio` (ListenBrainz LB Radio: the prompt, the answers' parsing, the requests), `app/StationMix` (the station model, `stations.json`, the batch mix; standalone), `app/Stations` (the store, the fetching, the endless queue), `app/StationsUi` (the builder dialog, the Radyo page's section, the palette entries); `stations_test`. - **A station**: up to 5 picks (artists, songs, genres / tags, moods), a name (empty = the picks' names, "Massive Attack, Teardrop, Trip hop +1"), the "Tanıdık ↔ Keşif" knob (0..1) and an optional era (years, either end open). Moods are MusicBrainz / ListenBrainz tags with a translated name (chill = Sakin, happy, energetic, melancholic, romantic, dark, uplifting, dreamy, party); the genre chips are LB tags too (the Radyo page's translated genre names). Stored per account in `stations.json` (`accounts::file`, written on every change; at most 50), newest played / created first. - **Where**: the Radyo page's "Senin istasyonların" section (the stations' tiles: a mosaic of the picks' pictures, the name, the picks, the knob and era; a click plays, the pencil / the menu edits or deletes; an invitation to build one while there are none), "Radyo oluştur" in its header and in the command palette, "İstasyonu çal: <ad>" for each station, and "Bununla radyo oluştur…" in a song's menu (the song as the first pick). - **The builder** (a dialog): the name, the picks as removable chips (a click, Enter, Delete or Backspace removes; Left / Right move along the row, one Tab stop), a search of the active catalog (`source::quickSearch`: four artists and six songs; Down goes from the field into the hits; Enter / a click adds or removes), a pane of genre and mood chips while nothing is searched, the knob (a slider; its value as "%60 keşif") and the era as decade chips (one click picks a decade, a second widens it to the range between them, a third starts over, "Tümü" clears it). *Kaydet*, *Kaydet ve çal*, and *Sil* when editing. - **Discovery: LB Radio**. ListenBrainz builds LB Radio from a troi prompt (`/1/explore/lb-radio?prompt=…&mode=…`; `lbradio::prompt` makes "artist:(Massive Attack) artist:(Portishead) tag:(trip hop,chill)::or" from the picks). Since 2026 that endpoint answers only with a user token (401 "you need to provide an Auth token" otherwise), so it is used only while ListenBrainz is connected (Ayarlar › Bağlantılar; the token goes in that request only, never cached). Otherwise, or when it fails / brings fewer than 10 songs, the station is made of LB Radio's own public blocks: `/1/lb-radio/artist/<mbid>` for each artist (the artist's and similar artists' recordings in a popularity range; 8 / 5 / 3 similar artists for 1 / 2-3 / 4-5 artists, 4 recordings each) and `/1/lb-radio/tags?tag=…&operator=or` for the genres and moods (150 recordings), interleaved, then named by `/1/metadata/recording?inc=artist+release` in batches of 50 (title, artists, length, ISRCs, release group, first release year, Cover Art Archive cover). A song pick counts as its artist. Artists are found by MBID: the pick's own (MusicBrainz catalog), else a MusicBrainz artist search by name (the exact folded name, else the first hit), saved into the station afterwards. The knob picks troi's mode: < 0.34 easy (popularity 60-100), < 0.67 medium (30-80), else hard (0-50). The blocks are cached 30 minutes (the answers are random per call); a fresh fetch skips the cache. - **Familiar songs**: the user's own songs by the artists the station is about (its picks' and the ones LB Radio brought): liked songs, the history, everything ever played (ListenStats), local files; a picked song always. - **The mix** (`stations::mix`, per batch of 30 when a station starts, 25 when its queue runs low): the familiar share is 0.75 × (1 − knob) (so full "Tanıdık" still brings a quarter of new songs), spread evenly through the batch (Bresenham), the other pool filling in when one runs dry. Left out: blocked songs (the blocklist, 3.6), songs already in the queue (same id, or the same folded title + artist), songs outside the era (a discovery song needs a known year in it; a familiar song without a year stays only if its artist has a discovery song in the era), duplicates (a song in both pools stays familiar). One artist at most 3 times per batch and never twice in a row when it can be helped. Each pool is lightly shuffled with a seed (every song moves a few places from its rank), so a station sounds different every time. A station with a picked song starts with that song. - **The active catalog**: the batch's new songs are found in it through `app/CatalogMatch` (Spotify while signed in, else YouTube Music; ISRC first, then title / artist / length); on the MusicBrainz catalog they stay recordings. A song not found stays the MusicBrainz recording (the player finds it by name). Works signed in and out. - **Endless**: the queue's context is "station:<id>" ("<ad> radyosu"); `Radio.cpp`'s queue-low check hands such a queue to `stations::queueLow` whatever `Settings.endlessPlayback` says (repeat off; at most 2 playable songs left; one request at a time). The fetched discovery pool is kept for the session per station definition and fetched fresh (up to 6 times) when fewer than 25 of its songs are left unqueued. A batch for a queue that was replaced meanwhile (another queue generation, or the station's queue no longer active) is dropped. - **Tests** (`stations_test`): the prompt (reserved characters, empty terms), the knob → mode → popularity mapping, LB answers from fixtures (a payload-wrapped JSPF with string / list identifiers, a track without one and a duplicate; the 401 body; the tag radio; the artist radio's turn-taking; recording metadata; recording → track), the mix (share, extremes, determinism, blocklist, exclusions, duplicates, artist cap and spacing, the era with open ends and unknown years) and `stations.json` (round trip, damaged entries, limits, names, summaries, definition keys). `stations_test live`: an artist radio, a tag radio (an unknown tag gives none), metadata for 30 recordings and the explore endpoint's 401 without a token. `SHADETUBE_OVERLAY_DEMO` steps `stationbuilder[=id|first]` and `stationstart=<id>` (5.4). - **Checked live** (December 2026, a sandbox profile, signed out, YouTube Music catalog): a station of Massive Attack, Portishead and "trip hop" at 60 % discovery and 1990–2009: 191 new songs from the LB blocks in 4 s, a batch of 30 (no familiar songs in an empty profile), 25 of 30 found in YouTube Music in 6 s, playing as "Gece yolculuğu radyosu". ### 3.79 Content filters (İçerik filtreleri) and genres Three filters on top of the blocklist (3.6): AI-generated music, explicit songs, genres. `app/ContentFilter` (the AI list, matching, the user's corrections, the policy every surface asks; standalone, `contentfilter_test`), `app/ContentFilterUi` (the list's cache and refresh, the menu items, *Ayarlar › İçerik filtreleri*), `app/Genres` (genre keys / labels, tag values, aggregation, the artist-genre store; standalone) and `app/GenreLookup` (the background MusicBrainz lookups, the snapshot every reader uses, the settings row). - **The AI list**: CennoxX/spotify-ai-blocker's `SpotifyAiArtists.csv` (MIT; community submissions plus loved.music's hand-verified list and Zoundhub, ex Soul Over AI, both CC BY 4.0, and eye-wave/spotify-ai-blocklist, GPL-3.0; about 11 000 Spotify artists), else loved.music's own CSV (CC BY 4.0) when the first fails. The credit is in the settings row. Fetched from GitHub raw only while the filter is on (or on *Şimdi güncelle*), 30 s after the start at the earliest, with `If-None-Match` (a 304 only stamps the check); refreshed when 7 days old (a failed try waits 6 h); kept in `cache\content-filters\ai-artists.txt` + `.json` (source, ETag, times, entries, last error). Offline the last copy stays in use; an answer with under 50 entries or under half of the copy in use is refused (a truncated or broken file). The parser takes CSV with a header (`artist` / `name` / `id` / `spotify_id`…, quotes, a BOM, unquoted names with commas), one link / URI / id per line (`#` / `!` comments) and JSON (Spicetify's trashbin, loved.music's, arrays). In memory only while the filter is on (~0.8 MB): sorted 22-character ids, plus "weak" names. - **Matching** (`aiVerdict`): the user's corrections first (by id, then by name across catalogs), then the list. A Spotify credit matches **by id only** (a real artist who shares a listed name is never caught); a list entry without an id matches by name everywhere; a credit from another catalog (YouTube Music, MusicBrainz, a local file) gives a *weak* name match when the folded name is listed once, has 3+ letters and no two listed artists share it. Weak matches only keep a song out of automatic picks; badges and "Gizle" need a certain verdict (listed id, name-only entry, or the user's mark). - **Policy** (`Settings.aiFilter` = `off` / `mark` / `hide`, `Settings.skipExplicit`): `keepOutOfPicks(track)` = kara liste, or a skipped explicit song, or (filter on) a likely-AI credit: radio seeds and answers, autoplay / endless (`app/Radio`), smart shuffle and *Geliştir* (`app/SmartShuffle`), Senin için lists (`app/SmartListsPage`), blends, Home's shelves (Spotify shelves, the open catalog's trending / fresh / for-you rows, YouTube Music's related artists), new releases (page and shelf) leave them out; cards are judged by their artists (`CardItem::artists`, now filled by the Spotify and YouTube Music card parsers). `skipsInPlayback` (the player's `shouldSkip`) = kara liste or skipped explicit: AI songs in the user's own lists still play. *İşaretle*: an "AI" badge in track rows (after the E), the queue panel, search cards, the top result, similar-artist cards and the artist page's label. *Gizle*: search results (songs, albums, artists, the top result) and an artist page's top songs / similar artists drop them (an AI artist's own page keeps its songs). Any change bumps `filters::revision()` (folded with the blocklist's), which the track tables compare, and calls `Player::skipRulesChanged()` + `endlessCheck()`. - **Corrections**: "Yapay zekâ değil" / "Yapay zekâ olarak işaretle" in the song menu (one item per credit, a submenu for several) and the artist page's ⋯ menu while the filter is on; `content-filters.json` (`{id, n, ai, t}`, a damaged file kept as `.bad`), listed in the settings card with *Kaldır*. Marking a listed artist "not AI" stores `ai: false`; marking it AI again just removes that. - **Explicit songs**: Spotify's `contentRating.label == "EXPLICIT"` (GraphQL) / `explicit` (Web API shapes) and YouTube Music's `MUSIC_EXPLICIT_BADGE` (already parsed, now covered by fixtures) set `Track::explicitContent`; MusicBrainz and local files carry none, so they always play. With *Atla* the rows are dimmed like blocked ones (track tables, the queue panel; the E badge stays), skipped by the player and kept out of picks; a row the user clicks plays. The E badge was already drawn in track rows; the queue panel now has it too. - **YouTube's "altered or synthetic content" label** was looked for in live InnerTube answers for AI-made songs on the list (The Velvet Sundown and others: YouTube Music's search, `next` for 10 videos and `player`, and youtube.com's own `next`): none carries it or anything like it (YouTube shows it as "How this content was made" in the watch page's description), so it is not used. Album / artist / playlist `browse` answers were not probed. - **Genres**: Spotify sends no genres to the web player's GraphQL (artist overview, album, track; only the deprecated Web API had them), YouTube Music has none per song or artist, and moods exist only as YouTube Music's browse categories (playlists, not songs), so there is **no mood data** and none is invented. Sources: a local file's genre tag (`Music.Genre` through the property system for MP3 / M4A / FLAC / WMA, Vorbis `GENRE` for Ogg / Opus; split on `; , / | \`, ID3v1 codes like `(17)` named) stored in the local index (a 15th column; an older row loads with `genresRead = false` and its file is read again once by the next scan), per artist the three most common over their files; else MusicBrainz' curated genres of the artist (`inc=genres`, votes ≥ a quarter of the top one, at most 5): `mb::artistGenres(mbid, name)` takes the artist found by an exact-name search (score ≥ 90, the namesake with the most tag votes), two requests per artist. `app/GenreLookup` asks one artist every 20 s (a minute after the start; 5 min after a failure): the Library's artists, its albums' first artists, the 200 most liked artists, the playing song's artist first, the albums / artists a Library tab shows. Answers (also "none") are kept in `artist-genres.json` (by name and MBID; 180 days, "none" 30 days; 20 000 at most) and published as an immutable snapshot (`genrelookup::snapshot()`, revision + subscribe) that workers read. `Settings.genreLookup` off = local tags only. - **Genre UI**: chips over the Library's *Albümler* / *Sanatçılar* tabs ("Tüm türler" + the genres at least two of the tab's items share, most common first, hidden while fewer than two; an album by its first artist), combined with the search box and the count; `tür:rock` / `genre:"hip hop"` in any track table's search box (`TrackTable::setFilter` takes it out like `bpm:`; a song's genres: its file's tag, else its artists'); the rule lists' **Tür** field (3.64): contains / is / is not / does not contain over the song's genres (folded, `-` / `_` as spaces), an unknown genre matches nothing (not even "is not"), `DepGenre` re-evaluates lists when the snapshot changes without a merge. - **Settings**: card *İçerik filtreleri* (id `filters`, before *Kara liste*; the command palette lists it): *Yapay zekâ ile üretilmiş müzik* Kapalı / İşaretle / Gizle; the list's status (entries, when it was fetched, the source, the last error) with *Şimdi güncelle*; *Düzeltmelerin*; *Müstehcen içerik* İzin ver / Atla; *Türleri MusicBrainz'den öğren* with the number of artists whose genres are known. - **Verification**: `contentfilter_test` (parsing every shape, ids, matching, corrections, policy, picking as Radio / smart shuffle do, search results and cards, the cache and fetch with canned answers, genres; `live` fetched the real list: 11 160 entries, 10 797 weak names, ~776 KB, Velvet Sundown listed, Radiohead not), `rules_test genre`, `mb_test` (genre / namesake fixtures captured 2026-12-02), `ytmusic_test` / `spotify_test` (explicit flags), `localfiles_test` (genre tags of every format, the index column, old rows read again). In a sandbox: the list fetched by the app (11 160 artists), the settings card, AI / E badges and dimming in a track table and in search (a name correction marking The Velvet Sundown), the Library's genre chips, `tür:rock` in the history, and two live MusicBrainz lookups (Air resolved to the French duo by tag votes; The Velvet Sundown has no MusicBrainz genres). ### 3.80 AutoMix DJ-style, beat-matched transitions between songs (what Apple Music's AutoMix and Spotify's Mix do): the transition mode *AutoMix* in *Ayarlar › Ses › Şarkılar arası geçiş* (3.4). `audio/AutoMix` (analysis, plan, crossover, mixer, `decodeMono`; the header has the details), `AudioEngine` (the analysis job, the plan, the mix), `audio/TimeStretch` (tempo per block, beat anchors), `Player::transitionFor` / `maybePrefetch`, `app/AudioSettings` (the choice), `app/Shell` (the badge); `tests/automix`. - **When**: a crossfade the Player would make anyway (`crossfadeInto() > 0`: not inside an album playing in order, not for podcast episodes, not at another speed than 1x, not with repeat-one) with `Settings.transition == "automix"`; not for a listen-together guest (smart instead: its song changes follow the host's), never for radio (live). The next song is preloaded 75 s before the end instead of 25 s so the analysis has time. - **Analysis** (`MixJob`: a thread `st-automix` at below-normal priority per song pair, started when the next song is preloaded): waits until both songs' bytes are all there (local files, downloads and the song cache at once; a stream when its download has finished, usually long before), decodes the incoming song's first 40 s and the outgoing song's last 50 s to mono at 11 025 Hz through the engine's `Decoder` on the shared buffer, then `analyze()`: the tempo from `audio/Tempo`'s estimator (3.65); a fine onset function (spectral flux of 256-point frames every 16 samples = 1.45 ms, 12 log bands, the low band weighted up); the beat phase from a grid search (the period ±0.5 % in 21 steps × every phase frame), then least squares over the beats found near the grid (parabolic peaks), up to three passes. The **steady span**: a beat is a hit when its peak is at least 0.3 × the song's typical beat and 1.15 × the strongest point between beats; 8-beat windows with 70 % hits (1.3 ×) form runs of at least 16 beats; the first run for the incoming song, the last for the outgoing one, extended over adjacent hits. Silence, speech and beatless intros / outros fall outside it. **Downbeats**: the beat of four where the low band hits hardest and the sound changes most. **Bars**: every downbeat in the span with its level (dB RMS) and how much its 8 band levels change against the two bars before; **phrase starts**: bars whose change stands out on a period of 8 bars (≥ 1.6 × the median), else single outliers. - **Plan** (`plan()`, on the engine thread once the job is done and the outgoing song's position known; the mix may start 1 s from then at the earliest): the incoming song's tempo factor is the one of ×1, ×½, ×2 that brings it closest to the outgoing tempo, within 8 % (snapped to 1 under 0.015 %); the **mix-in point** is its first downbeat of steady beat (at most 40 s in); the **overlap** is 8 bars, else 16, else 4, within 7-24.5 s, carried by the incoming song's steady beat and at most half of either song; the outgoing song's music ends where its steady beat or its sound ends, or a bar into a fade-out (bars 9 dB under the tail's median), and the **mix-out point** is the latest phrase-start downbeat (within 8 bars of the latest possible one) whose overlap ends by then, or the one whose overlap ends with the music. The engine logs the analysis (time, tempos, beat RMS) and the plan, moves the incoming song's read position to 40 ms before its mix-in point and stops reading the outgoing song exactly at the mix-out frame. - **Mix** (`startAutoMix`, at that frame): the incoming song becomes the current track at the plan's tempo through `TimeStretch`, its frames dropped up to the mix-in point less the stretcher's mean lead, with **beat anchors** (its beats over the overlap, `beatFrames`): WSOLA joins near a beat put it where the tempo says, so beats stay within ~1 ms (±10 ms without). Both songs run through a 4th-order **Linkwitz-Riley crossover** at 160 Hz: their highs cross with equal-power curves over the overlap, the lows come from one song at a time and **swap on the middle downbeat** (an equal-power swap within the half beat before it), so two kicks and two basslines never stack. Every track opened in AutoMix mode already runs through its crossover's allpass (flat, a phase shift in the lows) from its first frame, so nothing is switched when its mix starts; a song opened before the mode was picked is eased into it over one beat. Loudness gains apply per song as in any crossfade; the equalizer, volume and limiter follow the mix. After the overlap the incoming song's tempo returns to 1 at most 0.5 % a second (at least 2 s). Events as for any crossfade: `onEnded(A, B)` when the mix starts; positions follow the incoming song from its mix-in point (a skipped intro shows as e.g. 0:14). `AudioEngine::automixing()` (an atomic, true while the overlap plays) lights the player bar's *AUTOMIX* badge after the artist line. - **Fallback** (logged as `automix A -> B: <why>; smart crossfade instead`): no steady beat at either end, tempos more than 8 % apart (and not at half / double), the beat starting more than 40 s in, no mix point that fits, a decode or download error, no plan by the time the smart crossfade would start (`no plan in time`), the mix-out point gone by, another speed than 1x. The smart crossfade then runs over `crossfadeSec` from the incoming song's start. - **Interruptions**: a seek before the mix plans again from the new position (one past the mix-out point leaves the smart crossfade); pause, seek, skip, previous, open and stop during the mix behave as during any crossfade (the outgoing song fades out, the stretcher's tempo goes back to 1 behind the fade); a speed change ends the overlap within 0.3 s and a stall of the incoming song within 50 ms (`Mixer::release`, no jump in the gains); a changed queue (another next song) drops the job and starts a new one. A song shorter than twice the overlap gets a shorter one or none; a song ending inside an overlap leaves the outgoing one fading under what follows (3.4). - **Together with**: loudness normalisation (per song), exclusive mode (both songs must decode to the same output format, as for any crossfade), video mode and the visualizer (positions and the waveform tap follow the mix), listen together (the host mixes; guests load the host's next song when the host's mix starts and correct to its position, crossing with the smart crossfade themselves). - **Validation**. Offline (`automix_test`, synthetic songs: kicks, a click marker of its own pitch on every beat, hats, a crash every 8 bars, a bassline, a pad): 13 grids at 90-174 BPM, after silent / spoken / pad intros, before beatless outros and fade-outs, every tempo exact, the beat phase within 0.2-1.4 ms (max 2.0) of the truth, every downbeat right, 4 / 4 phrase starts on 8-bar boundaries; a pad, speech and silence give no beat. Plans: mix points on true downbeats (the planned beats within 0.9 ms of the truth over the overlap), every refusal reason. Renders (as the engine does, 48 kHz): heard beat alignment of the two songs' markers over the overlap 0.6-1.5 ms mean, at most 1.8 ms (one beat of the equal-tempo pair, where no stretcher runs, measured 4.6 ms; not looked into), without anchors 4.3-6.7 ms mean and up to 15.6 ms; the bass swap (the other song's lows 28-34 dB under before / after it), the level over the overlap within -2.4 .. +2.4 dB of the outgoing song's, no step at the start. The real engine (`automix_test engine`, a WAV pair at volume 0, its output read back through the waveform tap): the switch, the clock running at 124 / 128 during the overlap, no lost samples, the heard mix's beats aligned within 1.1 ms mean (max 1.5 ms over 31 beats); a mix cut 1.5 s in by a speed change is over in ~0.3 s (B then at 1.25 × its ramp, 1.222), by a seek or an open in one block (the tempo back to 1, the position where asked), with `onEnded(A, B)` only and no error. The app (a sandbox profile, *AutoMix*, 6 s, `SHADETUBE_PLAY_FILES` with the songs `automix_test songs <dir>` writes, 44.1 kHz WAVs on a 48 kHz device): 124 → 128 BPM analysed in 1.0-1.6 s (Debug), mixed over 8 bars at ×0.9688 from the outgoing song's last full phrase into the incoming one's first steady downbeat (past its spoken intro, 6.3 s in), the badge lit during it; 128 → 174 BPM and 174 BPM → a pad fell back to the smart crossfade ("the tempos are too far apart", "no steady beat at its start"), each over 6 s. Analysis cost (Debug): 0.8-2.6 s per pair in the app, 4.3 s for 50 s in `automix_test` while other builds ran. ### 3.81 Word-by-word lyrics and the lyrics sources Lyrics timed per word (per syllable where the source has them) from more online sources, asked in an order the user sets. `lyrics/WordSources` (the formats, the matching, the sources' order and their clients; standalone, core only), `lyrics/Lyrics` (the chain and its cache), `core/Inflate` (zlib), `app/LyricsRender` (the fill), `app/LyricsSourceSettings` (the settings rows), `app/LyricsPicker`. Tests: `wordlyrics_test`, `lyricsview_test` (`words`), `lyrics_test`. - **Sources** (all keyless; checked live on 2026-12-02; the ids are `Settings::lyricsSources`'): - `betterlyrics` - Apple Music's TTML from Better Lyrics' public cache: `GET https://api.betterlyrics.org/getLyrics ?s=<title>&a=<artist>&al=<album>&d=<seconds>` → `{"ttml": "<tt …>"}`; on a network error or 5xx the same request to its mirror `lyrics-api.boidu.dev`. A song nobody played with the Better Lyrics extension answers 401 (a key is needed, none are issued): "none". The TTML's `<body dur>` more than 5 s off the track's length = another version: "none". Mostly under 1 s; popular songs. - `apple` - Apple Music's TTML through the Paxsenix proxy: the song's Apple id from Apple's public iTunes Search (`itunes.apple.com/search?term=<title artist>&entity=song&limit=10[&country=<cc>]`, best match by `matchScore`), then `lyrics.paxsenix.org/apple-music/lyrics?id=<id>` → `ttmlContent`. Catalogs differ (many Turkish songs are only in Turkey's): the catalog the song's letters point to (kana jp, Hangul kr, Han tw, Cyrillic ru, ğ ı ş İ tr), then the US one, then the app language's (`Query::storefront`: tr de es fr br ru ua id jp kr), each only when the one before had no match. An Apple id is the same song in every catalog. 0.4-3 s; reaches songs Better Lyrics hasn't cached; Paxsenix answers 503 when busy (a failure: asked again next time). - `lrclib`, `spotify` - as before (3.16); LRCLIB records with enhanced-LRC stamps fill word by word too. - `kugou` - `lyrics.kugou.com/search?ver=1&man=yes&client=pc&keyword=<artist - title>&duration=<ms>&hash=` → candidates {id, accesskey, song, singer, duration} (song and singer sometimes swapped: both readings are matched; "title - artist" as the keyword finds nothing for many songs); the best two by score → `lyrics.kugou.com/download?ver=1&client=pc&id=&accesskey=&fmt=krc&charset=utf8` → base64 KRC: `krc1` + the bytes XORed with a fixed 16-byte key + zlib, inflated by `core/Inflate` (the updater's ZIP reader uses it too now). KRC lines are `[start,dur]<offset,dur,0>word…` (word times from the line's start); `[offset:]` applies; credit lines ("作词:…", "Lyrics by: …") and a "title - artist" line at the top are dropped; "纯音乐" = instrumental. 0.5-2 s. - `netease` (off by default) - `music.163.com/api/cloudsearch/pc?s=<title artist>&type=1&limit=10` (Referer `https://music.163.com/`; `code` must be 200) → `music.163.com/api/song/lyric/v1?id=<id>&lv=-1&kv=-1&tv=-1&rv=-1&yv=-1 &ytv=-1&yrv=-1`: its YRC (`[start,dur](start,dur,0)word…`, absolute times; JSON credit lines dropped) when there is one, else its line LRC (credits dropped), `pureMusic` = instrumental. Mostly line-level outside Chinese pop, ~1.4 s. - Not used: Musixmatch's richsync (needs a user token taken out of its desktop app, against its terms), QQ Music's QRC (its client's DES keys), the "lyricsplus" worker (gone). - Every request: `User-Agent: ShadeTube/0.13`, nothing about the user; at least 1 s between Better Lyrics requests, 2 s Paxsenix, 0.5 s iTunes, 0.5 s KuGou, 1 s NetEase (per source, process-wide). - **Order** (`Settings::lyricsSources`, "" = the default `betterlyrics,apple,lrclib,spotify,kugou,-netease`; "-" = off): `parseSourceOrder` drops unknown and repeated ids and puts a source the setting doesn't name (a new one, an older settings file) at its default place with its default state. `lyricsQueryFor` passes the ones switched on as `Query::order`. **The chain** (`fetch`): the user's pick (3.46), the file's own lyrics (3.16), then the sources in that order, each answer ranked (word by word or instrumental 3, synced lines 2, plain text 1): the first rank-3 answer ends the walk; after synced lines only the word-level sources further down are asked (LRCLIB's lines, then KuGou's words for Şımarık); a better rank replaces the answer, a tie keeps the earlier source. The cached answer joins as the first one, so a cache entry with lines and every source already tried answers without a request. Spotify is asked where it stands in the order (its provider is the app's, 3.16). - **Matching** (`matchScore`, -1 = reject): titles folded like Search's lyrics finder (`foldTitle`: case, accents, Turkish ı / İ, punctuation, a bracketed or dashed "(2023 Remaster)", "feat. …" removed): the same title 50, one running on by whole words 35, most words shared 25, else reject; a version word on one side only (live, remix, acoustic, instrumental, karaoke, cover, sped up, slowed, demo…) rejects. Artist: any credited artist against any of the candidate's (split at , & / feat. x and "and"; "The" ignored) 30, else reject - except a candidate whose artist is missing or in another script (米津玄師 / Kenshi Yonezu), allowed with the very title and a length within 2 s (10). Length within 1 / 2 / 3 s 20 / 15 / 10, further = another recording: reject; unknown 5. The best score wins, the closer length breaks ties; KuGou tries its best two. - **Formats** (`parseTtml`, `decryptKrc` + `parseKrc`, `parseYrc`, `parseLrc`): a word keeps the space after it in its text (`Word::text`) and gets an end (`Word::endMs`) when the source has one; lines get `endMs`. TTML: `itunes:timing` Word (spans with begin / end, the text between spans kept as spaces), Line (no words, the line's end kept) or None (unsynced); both clock forms (`1:02.5`, `62.5s`, `00:01:02.500`); entities; `ttm:role="x-bg"` spans = **background vocals** (`Line::bgText` / `Line::bg`, parentheses dropped, their own word times; a `p` of only them becomes the line); `x-translation` / `x-roman` spans skipped; agents (`ttm:agent`): people alternate `Voice::One` / `Two` in order of appearance, a group is `Both` (**duets**); the head's translations (`iTunesMetadata/translations`) become `Lyrics::translations[<lang>]` by `itunes:key` (the Çeviri chip shows them like Spotify's, 3.16). Enhanced LRC: a stamp after the last word (`…word<00:13.80>`) is its end, and one before a pause ends the word before it. - **Cache** (`cache\lyrics\<id>.json`, still v2; older builds read the lines and words and ignore the rest): per line `words` ([time, text, end]), `wend`, `voice` (1 = second voice, 2 = both), `bg` ({t, w}) and `ends`; `tried` names every source asked. A cached answer from a source the user has since switched off is dropped and the walk starts over; a source that failed (network, 5xx, 503) is not recorded, so it is asked next time. The views ask for a new track at the same time (Now Playing, the full-screen view, the mini player): a per-track lock (64 hashed slots) makes one walk and the others read its cache entry. - **Drawing** (3.62's machinery): `wordRanges` turns a line's words into text ranges (the space after a word is not sung) with start / end times (its end, else the next word's start, else ~110 ms a letter, 400 ms at least, within the line); `fillRows` puts the fill's front per visual row, **pixel-linear through the word being sung** (hit-test widths), steady between words; *Hareketi azalt* fills whole words and the views repaint only at the next word's start. While a word-timed line is sung the views repaint every frame (~16 ms), otherwise as before. Now Playing: the fill in the accent over the line's color, the header says "ŞARKI SÖZLERİ · KELİME KELİME"; the full-screen view: its gradient fill per word; the wide mini player: both of its lines. Duets: the second voice's lines go to the right (full screen: first voice left, both centered; Now Playing: both voices left), each line scaling from its own side (`voiceAlign`, `anchorX`). Background vocals: a smaller, dimmer line under the main one (Now Playing 20 / 600, 17 in the narrow layout; full screen 0.6 of the line's size) with its own word fill. Lyrics without word times look as before (the line sweep). **Romanized lines and translations under a line have no word fill** (their words don't line up with the original's times); the original line above them fills word by word. The mini player shows neither background vocals nor duet sides (two lines, room for one voice). - **Settings** › **Şarkı sözleri** (a new card, `settings:lyrics`; the lyrics switch and the translation language moved there from Oynatma): "Söz kaynakları", a row per source in its order - the position, the name, a KELİME KELİME / SATIR SATIR tag, a line about it, ▲ / ▼ buttons and a switch; Alt+Up / Alt+Down move the source of the row in focus, and the focus moves with it; "Varsayılana dön". Applies from the next song (the next `fetch`). - **Picker** ("Yanlış sözler mi?", 3.46): the word-level sources switched on are searched beside LRCLIB, in parallel (`searchWordSource`: up to two results each; the track's own title / artist / length while the field holds what it was opened with, else the words typed; Better Lyrics only by the track), and listed above LRCLIB's results as they arrive; a row names its source and tags KELİME KELİME lyrics. Picking one caches it as `<id>~<source>` (`rememberSourcePick`) and stores `Choice::Kind::Source` (`{"k": "source", "s": "<id>"}` in `lyrics-offsets.json`; an unknown source id is ignored); `fetch` then serves that cache entry, else asks that source again. - **Downloads**: the `.lrc` next to a download and the MP3's lyrics frame (3.16) are written as enhanced LRC when the lyrics have word times (`[00:12.00]<00:12.10>Hello <00:12.60>world<00:13.80>`, the last stamp the last word's end). - **Live check** (`wordlyrics_test live`, 2026-12-02, as for an app in Turkish; lengths from Apple's catalog, LRCLIB's where Apple has none): 20 songs - Blinding Lights, Bohemian Rhapsody, Shape of You, bad guy, Someone Like You; Şımarık, Kuzu Kuzu, Gülpembe, Geceler, Firuze, Bir Derdim Var; Despacito, Bailando; Dynamite, Gangnam Style; Lemon, 夜に駆ける; 99 Luftballons; Alors on danse; 晴天. | source | word by word | lines or plain text | none | failed | time a song | | --- | --- | --- | --- | --- | --- | | Better Lyrics | 13 | 0 | 7 | 0 | 0.1-2.5 s | | Apple Music (Paxsenix) | 15 | 2 | 3 | 0 | 0.5-2.6 s | | LRCLIB | 0 | 20 | 0 | 0 | 0.2-2.6 s | | KuGou | 16 | 0 | 4 | 0 | 0.6-1.6 s | | NetEase | 4 | 14 | 2 | 0 | 0.6-2.0 s | | the chain, default order | 19 | 1 | 0 | 0 | 0.4-2.2 s | With the default order 19 of the 20 get word-by-word lyrics: 13 from Better Lyrics, 3 from Apple (Gülpembe, Lemon, 99 Luftballons), 3 from KuGou (Şımarık, Bailando, 晴天, each after LRCLIB's lines). Only Bir Derdim Var has none anywhere (Apple and NetEase have its plain text, LRCLIB its lines). Turkish songs (6): Better Lyrics 3, Apple 3 word by word (Kuzu Kuzu, Gülpembe, Firuze; Firuze only in Turkey's catalog), KuGou 2 (Şımarık, Kuzu Kuzu), the chain 5. Before the catalogs were added Apple found 13 / 20; before KuGou's keyword became "artist - title" it found 4 / 20. ### 3.82 Musical key ("Ton") and Akıllı sırala The musical key of songs (a column, the rule lists, the tag editor, downloads' tags) and an order of a list that flows from song to song by key, tempo and energy, for own playlists, editable Spotify playlists, the queue and the rule lists. `audio/Key` (the key and energy estimator; `key_test`), `audio/KeyNotation` (keys as numbers, names, Camelot and Open Key codes, compatibility; standalone), `app/SmartOrder` (the order, pure; `key_test order`), `app/SmartReorder` (the dialog, the queue's entry). Everything else rides on 3.65's pipeline (`app/Bpm`, `app/BpmStore`): no new worker, store or file. - **Sources**: a key tag (ID3 `TKEY`, Vorbis `INITIALKEY` / `KEY`, MP4 `----:com.apple.iTunes:initialkey`; read and written by `audio/TagWriter` with the tempo tag; `key::parse` takes "Am", "A min", "A minor", "C#m", "E♭", "8A", "1m" / "1d" (Open Key), "C:min"), else ShadeTube's own analysis of the same 70 s excerpt the tempo decodes (one decode for both). Nothing is asked on the network: no catalog offers keys without credentials ShadeTube doesn't have (3.65). - **Estimator** (`audio/Key.h` has the details): spectral peaks of 8192-point frames (50 Hz-3.5 kHz, parabolic refinement), the excerpt's tuning against A = 440 as a weighted circular mean, an HPCP-style chroma (each peak adds to the fundamentals it can be the 1st-4th harmonic of, cos² spread, per-frame normalization) and a bass chroma (under 250 Hz); the 24 keys scored by the Pearson correlation with Temperley's and Faraldo's EDMA profiles, averaged, plus a small bonus for the tonic in the bass (tells a key from its relative). No key when the chroma is too flat (noise, drums, speech) or the best correlation is under 0.45. The confidence is that correlation. Energy (0..1, for the curve only): loudness, spectral centroid and onset density mixed 0.45 / 0.25 / 0.30. - **Store**: `bpm.json` entries gain `y` (the key as TKEY writes it, `""` = looked at, none found), `ys` (`t` tag / `a` analysis), `yc` (confidence) and `n` (energy). A tag's key beats the analysis'; a tempo tag keeps its entry and the key and energy of a later analysis land on it. Entries without `y` (0.12's file) and files with a tempo tag but no key tag are analysed again by the background worker (`Settings.bpmAnalysis` on). The tag editor's *Ton* field writes the tag and tells the store (`bpm::noteKey`); downloads get `TKEY` when the song's key is known (`audio/Downloader`'s request `key`). - **"Ton" column** (`trackcols::Key`, after BPM; dropped right after Plays when narrow; offered in every list through the column header's menu, off by default): Camelot "8A" or "A min" by `Settings::keyNotation` (`"camelot"` / `"musical"`; the column menu's *Ton gösterimi* and Ayarlar › Yerel müzik), sortable in Camelot order with unknown last. Rule lists (3.64): the field *Ton* with *eşittir* / *şununla uyumlu* (the same key, ±1 on the wheel, the relative) / *biliniyor* / *bilinmiyor*, and the sorts *Ton* (Camelot order) and *Akıllı sırala (ton, tempo, enerji)* (the limit takes the newest songs first, then they are put in flow order). - **The order** (`flow::order`, `app/SmartOrder.h` has the details): a transition costs 0.55 × the keys' harmonic cost (`key::harmonicCost`: same key 0, relative / one step 0.15, diagonal / two steps 0.45, ... a clash 1; low-confidence keys lean to the neutral 0.35 of an unknown key) + 0.45 × the tempos' (|log2 ratio|, half / double time counted as close, 12 % apart = 1). An energy target starts calm, peaks at 70 % of the list and eases out, spanning the list's own 10th-90th percentile energies. Greedy (lowest transition cost + 0.9 × distance from the target), then swaps and 2-opt reversals within 12 places while the total drops. Ties by a hash of the id: the result depends only on the set of songs, so sorting a sorted list changes nothing. Songs with neither a key nor a tempo go to the end in their order (the dialog says so). In the queue the playing song is the anchor for the first transition. - **Moves** (`flow::movesFor`): the old order → the new as few block moves as possible: the longest increasing subsequence stays, every other run of rows becomes one move after the row before it (−1 = the top). A shuffled 500-row list takes 39 moves. Used for Spotify, whose API moves rows, not orders. - **The dialog** (`smartreorder::open(Target)`; 760 DIP, ui::Dialog): a summary line, the energy curve before (a tertiary line) and after (accent) when energies are known, then *Şimdiki sıra* / *Yeni sıra* side by side (virtualized rows: title, artist, the key as a badge, accent when it fits the previous song, BPM in mono; unknown rows faded under a hairline), each headed by its count of compatible key transitions. The order is computed at once up to 400 songs, on a High worker above. *Uygula* is enabled when at least two songs are known and the order differs. After applying, a toast *Yeni sıra uygulandı* with *Eski sıraya dön* puts the old order back through the same path. - **Analiz et** (in the dialog, while songs lack a tempo or a key): `bpm::analyseNow(tracks, fetch)` analyses those songs now, ahead of the background rounds and also with the analysis setting off: audio already on this PC (local files, dropped files, downloads, the song cache) at once; with *Bu bilgisayarda olmayanları indir* (shown only when such songs exist; the box states the cost, "~4 MB per song", and the total) the others' YouTube audio is downloaded into the song cache as playing would (a temporary file, deleted after, when the cache is off), one at a time, 3 s apart, waiting while the player opens a song; a failure backs off 15 s, 30 s, 60 s and four in a row end the fetching ("YouTube isteklere yanıt vermiyor"). Below-normal thread priority, a 2 DIP progress line, *Durdur* cancels; closing the dialog cancels a run it started. The preview updates as results land (`bpm::subscribe`). - **Entry points**: the "…" menu of own playlists (applied with `Library::reorderPlaylist`, the column sort reset to the list's own order) and of editable Spotify playlists (the whole list is loaded first; the rows move at once on the page, then `Session::moveInPlaylist` per block of `movesFor`, one request after another; a failed request reloads the list and the toast says so); the queue panel's header button and its row menu (`openQueue`: the last run of list songs after the playing one, reordered by `Player::reorderUpcoming`, which refuses unless the same items are still upcoming); the rule lists' sort. Dev: `SHADETUBE_OVERLAY_DEMO` step `smartreorder` opens it for the queue, else for 24 sample songs; `SHADETUBE_KEY_DEBUG=1` prints the key scores and chromas. - **Validation** (`key_test`, synthetic, 106 signals): eight chord progressions in all 12 tonics, relative pairs 12 / 12 told apart, drums, noise down to 10 dB, 432 Hz / +45 cents tuning and other timbres 10 / 10, noise / drums / silence give no key: 100 / 106 exact (94 %), 5 relative, 1 fifth, MIREX score 0.962. The order: 120 songs' mean transition cost 0.710 → 0.267, a shuffled Camelot wheel 23 / 23 compatible neighbours, the energy curve's shape, determinism. In the app (sandbox): five generated songs in A min / C / E min / G / D min at 96-128 BPM were analysed from the queue by *Analiz et* (all five keys and tempos right) and ordered 9A → 9B → 8B → 8A → 7A; apply and *Eski sıraya dön* checked on the queue and on a local playlist. Real songs were not measured. - **Cost**: a 70 s excerpt's key + energy: 204 + 160 ms in Debug, 46 + 44 ms in Release (on top of the decode the tempo already does); a generated WAV through the whole file analysis 372 ms Debug, 67 ms Release. The order: 500 songs 113 ms Debug / 11 ms Release, 5 000 songs 1.6 s / 0.18 s. ### 3.83 Linux port — core The platform layer and the modules above it (catalog, musicbrainz, spotify, youtube, ytmusic, lyrics, player) build and pass their offline tests on Linux; Windows builds exactly as before. - **Split**: a module's shared code stays in `Foo.cpp`; what differs lives in `Foo_win.cpp` / `Foo_linux.cpp` (listed per platform in the module's CMakeLists.txt), small differences behind `#ifdef _WIN32`. `wchar_t` is 32-bit on Linux: `std::wstring` holds UTF-32 there, and `core/Utf` converts and folds case on both (GLib, with the Turkish i rules applied explicitly). Windows-only system libraries are linked through quoted generator expressions (`"$<$<PLATFORM_ID:Windows>:winhttp;crypt32>"`); Linux libraries come from pkg-config `IMPORTED_TARGET`s. - **Modules on Linux**: `ST_LINUX_<module>` (one line each in the top-level CMakeLists.txt, so owners don't conflict). `st_player` builds without `st_audio`, but a program that links it needs `ST_LINUX_audio` ON. - **Main loop** (`core/Dispatcher.h` holds the contract): the UI thread runs GLib's default main context (GTK's loop runs inside it); `post` / `postDelayed` / `cancelDelayed` are GLib idle / timeout sources there, and test programs without a window call `pump()`. The player's prefetch check and error advance use `postDelayed` on Linux (Windows: `SetTimer`, as before). - **HTTP**: `core/Http` and YoutubeExplode's CURL backend on libcurl. All handles share one `CURLSH` (DNS, TLS sessions); `http::networkChanged()` starts a new one (the old one is freed when its last transfer ends), which the os layer's network monitor calls before `Session::networkChanged`. Connections are not in the share (libcurl doesn't support sharing its connection cache between concurrent threads: parallel cover fetches crashed in it): each thread keeps its last easy handle (`curl_easy_reset` keeps its live connections) and reuses those; a new network drops them. A module with its own CURL handle (alternative sources, radio, podcasts) calls `http::prepareCurl(handle, url)` for the shared pool and proxy, and `proxy::reportCurl(handle, code)` after the transfer. - **Proxy**: libcurl speaks HTTP and SOCKS5 (`socks5h`, the proxy resolves names) itself, so Linux has no local bridge; `proxy::openConnection` gives a socket tunnelled through the proxy for raw TCP. Every transfer through the named proxy reports success or the kind of problem (name not found, unreachable, timeout, refused, credentials wanted or refused, not a proxy) to the status the proxy settings show. A setting change applies to the next request; long-lived connections watch `proxy::generation()`. - **Secrets at rest** (`core/Secret`; the sp_dc cookies, and for the app the proxy password, scrobbler and remote keys): Windows keeps DPAPI, byte for byte. Linux seals with AES-256-GCM under a per-profile master key kept in the Secret Service (GNOME Keyring, KWallet, the Flatpak portal): unlocked with the user's login like DPAPI's key, so a copy of the profile or disk is useless alone. With no Secret Service (a bare window manager, headless), the key is derived (HKDF-SHA256) from `/etc/machine-id`, the user id and a random 0600 `secret.salt` in the profile: that only stops the files from working on another machine or for another user; anything running as the user can read them. The blob header says which key sealed it. Empty secrets are refused on both (DPAPI takes no empty data). A sandbox profile (`SHADETUBE_DATA_DIR`), `SHADETUBE_SECRET_BACKEND=file` and `secret::useDerivedKeyOnly` (tests) never touch the user's keyring (`SHADETUBE_SECRET_BACKEND=keyring` tries it anyway, e.g. under a private `dbus-run-session`). - **Files**: `SafeFile` writes with fsync + rename + a directory fsync, mode 0600. `sanitizeFileName` makes portable names on Linux too (downloads, podcast episodes): Windows' characters and control characters become `_`, trailing spaces / dots go and the cut counts UTF-16 units, so a library on an exFAT / NTFS / FAT drive or a Samba share works and moves between the systems under the same names; device names (`CON`...) stay ordinary names there, a leading dot becomes `_` (no hidden files) and a name keeps within 200 UTF-8 bytes. Existing files are read and scanned by the bytes of their names. `envVar()` (`core/Env`) reads the environment the same way on both (Windows: `GetEnvironmentVariableW`, which also sees variables set at run time). The song cache (`player/AudioCache`) has small per-platform file helpers. - **Diagnostics**: a fatal signal writes a text report with a backtrace to `<appData>/crashes/` (no minidump); `MemoryStats` reads `/proc/self` and glibc's allocator. - **Unicode without Windows' NLS**: the track matcher's folding (YoutubeExplode `foldText`: NFKD, marks dropped, ligatures spelled out, lower case, punctuation as spaces), Cyrillic romanization and the translator's checks use GLib's tables. Language detection without ELS: the writing system (Hangul, kana, Han, Cyrillic, Arabic, Devanagari, Thai, Greek, Hebrew, Turkish letters), then the short words of the Latin-script languages the app translates; "" when unsure (Google detects the source). ANSI `.lrc` files are converted with GLib (Windows-1254 for a Turkish locale, else 1252). - **The app's own files** (everything in `src/app` that isn't window, desktop or audio code): Windows keeps its calls; the shared code goes through portable helpers instead of Win32. Text: `core/Utf` (`isAlnum`, `toLowerSimple`, `equalsIgnoreCase`, `compareText` with numbers in order, `sortKey`, `fromCodePage`, `fromUtf16`). Dates: `core/I18n` (`dayAbbrev`, `monthDayPattern`, `formatDate` with Windows' date pictures, `longDate`; Linux carries the 11 languages' month and day names, matching Windows' output). Stores: `safefile::replace` / `move`. Dev switches and timers: `app/WinCompat_linux.h` (ui's). File dialogs: `ui/FileDialog` (save dialogs start in the XDG Music / Documents / Downloads folders as the Windows ones start in the known folders); the clipboard: `ui/Clipboard` (pasting is asynchronous on Linux). The library's sort order (`LibrarySort`, in the UI's locale): ICU's collator (WebKitGTK's own dependency), weighted like Windows' linguistic sort (accents count, case doesn't, numbers in order). Playlists written on Windows import: relative paths with backslashes resolve, drive / network paths are kept as written. Local time for the listening stats: GLib's `GTimeZone` (historic DST rules, as Windows' dynamic time zones; the tests' Windows zone names map to tz names). The local library walks folders with `readdir` / `fstatat` and reads tags with `audio/TagWriter`'s reader (MP3 / FLAC / MP4) and the Ogg reader, the duration and the other formats through FFmpeg's demuxer; cover crops use GdkPixbuf. Paths are told apart exactly there (the index, `local:` track ids, dropped files, a folder's play context): `Song.mp3` and `song.mp3` are two files, while names and extensions still match without case. A folder on an `/etc/fstab` mount point that `/proc/self/mounts` doesn't list (`local::FstabMounts`, read once per scan) is unreachable and keeps its tracks: the mount folder an unplugged drive leaves behind lists fine but empty, with no error to go by. A BPM batch runs on a thread of its own at nice +10 (the pool's threads are shared, and a raised nice value can't be lowered again without privileges). A download record holding U+FFFD finds the file whose name isn't valid UTF-8 but reads back as it (`dlrec::findLossyPath` with `readdir`), and the file gets the valid name (`cleanedPath` drops the bad bytes). Podcasts' media transport and the radio directory use libcurl through `http::prepareCurl` (WinHTTP's timeouts, redirect checks and size limits kept); radio country names come from iso-codes (`dgettext("iso_3166-1")`); the metered-network check is `GNetworkMonitor`; SponsorBlock's hash is GLib's SHA-256. - **Tests**: `tests/TestEnv.h` (console, temp folder, environment, executable path, command line, running the UI queue, a millisecond clock) and `tests/TestSocket.h` (the Winsock names over BSD sockets) let a test program build on both; `Dispatcher::pump` replaces hand-written message loops. On Linux: `accounts altsource coreport credits links lyrics matching musicbrainz proxy scrobble ytmusic`, the app logic's `browse collections contentfilter library newreleases review rules smartlists`, then `history homecontrols network podcasts radio services sponsorblock stats userdata` and `collections`' `playlist_edit_test` (covers through GdkPixbuf), plus the Linux-only `localscan` (exact-case paths, fstab mount points) (the lyrics folder's `translate_test`, `lyrictools_test`, `romanize_test`, `wordlyrics_test`), and once `st_audio` builds also `lyrics_test`, `queues_test`, `queueundo_test` and `audiocache_test` (run with `SHADETUBE_AUDIO_BACKEND=null`). `smartshuffle`, `playback` and `preview` compile app sources and Media Foundation code and wait for those ports. ### 3.84 Linux port — ui The drawing (`st_gfx`), the widget toolkit (`st_ui`) and the app's pages draw the same pixels on Linux as on Windows: the same widgets, layout, themes, fonts, icons and animations, on cairo + Pango inside a GTK 4 window. Windows keeps Direct2D / DirectWrite / D3D11 unchanged. - **gfx**: `Canvas_cairo.cpp` (cairo's image backend: Linux draws on the CPU, so `Device` has nothing to create, lose or recreate; its release hooks still drop baked pictures when the window has been hidden a while), `Text_pango.cpp` (Pango + HarfBuzz with the bundled variable fonts registered in fontconfig; every line placed by the code itself to match DirectWrite's uniform line spacing, wrapping and "…" trimming, weight / optical size through the variable axes, Turkish casing), `Icons_rsvg.cpp` (the same SVGs through librsvg: tinted icons as 8-bit alpha masks per pixel size), `ImageDecode_linux.cpp` (libjpeg-turbo / libpng / libwebp, gdk-pixbuf for the rest), `Bitmap_cairo.cpp`. The app sees one API: `gfx::Matrix`, `gfx::Bitmap` / `BitmapPtr`, `gfx::TextLayout`, `Offscreen` (draw into a picture, read its pixels back: the share card, the cover palette, blurred backdrops), `encodePng`. A few Linux-only helpers stand in for Direct2D effects (`fillLinearGradient` with stops, `textGradient`). `Canvas::text` puts every line's baseline on a whole device pixel, as `DrawTextLayout` does without `NO_SNAP` (else a paragraph whose line height isn't whole pixels blurs every other line). - **ui::Window** (`Window_gtk.cpp`): one GtkDrawingArea in a GtkWindow with client-side decorations and a hidden stand-in title bar (the app draws its own, as on Windows; a visible empty one gets the theme's `.titlebar` min-height, 46 px in GTK's default theme, above the content). A press on a drag region moves the window (`gdk_toplevel_begin_move`; double click maximizes, right click the window menu, unless `onDragRegionDoubleClick` / `onDragRegionMenu` are set); an 8 px band inside the edges resizes it. Frames on demand: a GLib source looks at every window before the loop sleeps and queues a draw for one that needs a frame, painted at the frame clock's tick; an idle window costs no CPU. Keys arrive as `KeyEvent`s with Windows' virtual-key codes (`ui/Platform.h` keeps the Win32 names on Linux), text through GTK's input method. `resizeClient()` resizes around a content size (the desktop keeps the position). `ui::sys`: key / button state, the layout's character of a key (`keyChar`, shortcut labels), the desktop's animation switch. - **Platform glue** (`st_ui`, Linux only): `ui/Clipboard` (GdkClipboard; reading another app's text completes in a callback), `ui/FileDialog` (GtkFileDialog run modally: save / open / folder, filters, a default extension), `ui/NativeMenu` (a GtkPopoverMenu for windows too small for the drawn menus: the mini player). Files dropped from the file manager arrive through a GtkDropTarget (`onFilesDragOver` with the paths once GTK has them, `onFilesDropped`); `app/DragDrop` turns them into the same drag as Explorer's (the ghost, the targets' highlight, play / queue / import). - **App** (`App.cpp`): the UI thread runs GLib's default main context; `App::run` lets everything ready run (GTK input, the frame pump, `Dispatcher` posts and timers), does the app's timed work (housekeeping, the media controls' timeline, SponsorBlock, the dev switches) and sleeps in the main context until the next. "Sistem" theme: the desktop's `color-scheme` (`org.gnome.desktop.interface`), else GTK's dark preference or a `-dark` theme name, followed live. The main window's size and maximized state are saved; the desktop places windows (Wayland lets no app position itself). `--screenshot` renders through `Window::renderToPng` (cairo, the same layers as a frame), so captures work under WSLg too. `app/WinCompat_linux.h` keeps the pages' Win32 dev switches (`GetEnvironmentVariableW`, `SetTimer` on a GLib timeout, `_wtoi`, …) compiling unchanged. - **Mini player on Linux**: no position of its own (no snapping, remembered place or anchored corner): a mode switch resizes the window while the content cross-fades, the square grows from its right / bottom edges, the saved place keeps the size. The menu is native (`ui/NativeMenu`), a double click on the surface goes back to the main window. GTK 4 has no "always on top": the menu entry and the `mini-on-top` action are left out. - **Video mode on Linux** (3.41, on audio's FFmpeg decoder, 3.85): `VideoPlayer::frame()` hands the picture as BGRA rows in memory; `app/VideoMode` copies it into one cairo bitmap per new frame (`Picture::serial`), shared by the views that show it, and draws it with cairo's GOOD filter (a box filter when smaller, so no shimmer in Now Playing). The video window (`VideoWindow.cpp`) is a `ui::Window` on GTK: the picture is a drag region (moves the window; a double click toggles full screen through `Window::setFullscreen`, where the surface is client area as on Windows), F / Esc / Ctrl+W as on Windows. Only its size is remembered (the desktop places it); no "always on top" button. `SHADETUBE_VIDEO_DEMO` runs (`minimize` / `restore` through `Window::show`, `captiondblclick` through the drag region's double click; `nchit` is Windows-only). - **Frame cost on Linux** (every pixel is drawn on the CPU; GTK only shows the picture): - *GTK's renderer is cairo* (`GSK_RENDERER=cairo` set before the first window unless the user set one, `Window_gtk.cpp`): with a GL renderer the frame image is uploaded as a texture each frame, which on a software GL (llvmpipe: virtual machines, WSL) cost a core and ~130 MB of driver heap. Measured (Release, WSLg, 1440 × 900 at scale 1, 5 000 liked songs, 40 wheel notches): process CPU 128.6 → 13.8 %, frame CPU mean 10.6 → 6.7 ms (p95 14.2 → 9.2), late frames 20 / 184 → 4 / 165, first frames 94-136 → 26-30 ms, idle 3.5 → 0.3 %, private memory 175-193 → 48-61 MB (RSS 334-351 → 136-150 MB). - *Two frame images*: GTK's render node of the frame on screen keeps a copy-on-write snapshot of the image until the next frame replaces it, so painting into the same image copied it first; frames alternate between two (`Gtk::spare`), dropped while the window is hidden. Scrolling the list: frame CPU 6.7 → 5.5 ms (our paint 4.3 → 3.4), p95 9.2 → 6.7. - *Partial frames*: `Window::invalidateAfterShown(ms, area)` asks for a repaint of one area (the player bar's flowing wave and times, `PlayerBar::paint`). When nothing else asks for a frame, Linux paints only that area: the cairo clip and `Canvas::pushClip` (widgets outside are skipped), into the image of the frame before last after bringing it up to date (the last frame's own area again, or a copy after a whole frame). Overlays, layout, `requestNext` or any plain invalidation make the frame whole. Windows presents whole frames (flip model) and treats it as `invalidateAfterShown(ms)`. A song playing on Home: 34 whole frames a second at 7.1 ms (our paint 3.8), 26 % of a core → 37 partial ones at 3.1-3.5 ms (our paint 1.3), 13-16 %. A capture of the X11 window matched the app's own whole render except the times (`renderToPng`). - *Now Playing's backdrop*: the field stretched over the page (bilinear) plus the grain cost ~6 ms a frame at 2560 × 1440 but change only when the field renders (~12 / s); `CoverBackdrop::paintPlate` bakes both into one picture at the view's device size then (an `Offscreen` drawn again in place: `begin()` reuses the surface when nobody else holds its bitmap), which every frame copies. Now Playing playing at 1440 × 900: frame CPU 6.4 → 5.6 ms, process 37.6 → 29.4 %; full screen 2560 × 1440: 24.4 → 15.4 ms (our paint 17.1 → 10.0), 26 → 39 frames a second, 76 → 66 %; the visualizer full screen 41.6 → 24.2 ms. The plate costs its size in memory while shown (14.7 MB full screen). - Left: GTK's cairo renderer replays the drawing area's cairo node through a temporary image and blends it into the window buffer every frame (~1.5-2 ms at 1440 × 900, ~5 ms at 2560 × 1440, the whole window even for a partial frame: GTK 4.14 diffs a cairo node as changed everywhere). Idle is 0 % (no frame clock ticks: frames on demand). - `SHADETUBE_FRAME_STATS=1` logs every window's frames (count, partial ones, the UI thread's CPU per frame: mean, p95, max, our paint; frames that came later than 1.5 refresh periods after an animating one; size) per burst or every 5 s, and the renderer GTK picked. `SHADETUBE_MEM_DEMO` (`wheel` = `Window::simulateWheel`; `gpuclear` / `d2dcache` are Direct2D's) and `SHADETUBE_SCROLL_DEMO` run on Linux too; the memory demo's frame numbers are the UI thread's CPU per frame (`Window::onFramePainted`). - **HiDPI**: the frame image is the drawing area's size times `gdk_surface_get_scale` (fractional on Wayland with `wp_fractional_scale_v1`, an integer on X11 / `GDK_SCALE`), every widget draws at that scale (text, icon masks per pixel size, bitmaps), and the image is handed to GTK unscaled with the nearest filter: one image pixel per device pixel, also when a fractional scale puts the area's origin between device pixels (GTK 4.14's cairo renderer sizes the Wayland buffer at the exact fractional scale, `gdk_wayland_display_create_shm_surface`). Pointer positions are logical pixels and hit-test in DIPs, so input needs no scale. Checked with `GDK_BACKEND=x11 GDK_SCALE=2` (WSLg offers no fractional scaling: no `wp_fractional_scale_manager_v1`): a 2354 × 1324 image for a 1177 × 662 window, the X11 capture of it identical to the app's own render (`--screenshot`) but for the top rows of GTK's window edge. - **Texts that name Windows** say what Linux does (`#ifdef _WIN32`, a Linux key after each Windows one in every language): "masaüstü bildirimi", the desktop's animation switch, its light / dark preference and font, "Sistem dili" (the session's language), the desktop's scale, the proxy (environment variables, else GNOME's setting), the shortcut problems (the Super key, the media keys through MPRIS), the real XDG Music folder of the downloads (`/home/…/Müzik/ ShadeTube`), crash reports as `.log`. Rows that do nothing there are left out: the taskbar progress, the tray rows where the desktop shows no tray icons (the page is built again when the StatusNotifierWatcher's answer comes), "genel kısayollar" (`commands::globalHotkeysAvailable()`; no GlobalShortcuts portal client yet). The connect screen says "GTK 4 · CAIRO". - **Gated on Linux** (no dead buttons): the Mica row of Ayarlar › Görünüm (and "Mica" in that card's subtitle), the mini player's and the video window's "always on top", the pointer steps of `SHADETUBE_PREVIEW_DEMO`, Windows' touch press-and-hold switch. `SHADETUBE_OVERLAY_DEMO` runs on both: its `key=` / `type=` steps go through `Window::simulateKey` / `simulateText` on Linux. - **Packages**: `libgtk-4-dev librsvg2-dev libpango1.0-dev libcairo2-dev libharfbuzz-dev libfontconfig-dev libjpeg-turbo8-dev libpng-dev libwebp-dev` (most come with GTK). Tests on both: `uiport_test` (text layouts of the bundled fonts and hit testing, caret stops over clusters, an `Offscreen` render read back, and a gallery window in both themes with a menu, a toast and a dialog over it; `SHADETUBE_UIPORT_SHOTS` keeps the PNGs to compare the two platforms side by side). ### 3.85 Linux port — audio The playback engine, its DSP and everything around it run on Linux with the same code; what touches the system is split per platform (`Foo.cpp` shared, `Foo_win.cpp` / `Foo_linux.cpp`). Windows is unchanged. - **Platform layer** (`audio/Platform.h`, `Platform_linux.cpp`): events are `eventfd`s (pollable: the network code hands them to libcurl as an extra wait fd), `tickMs` is `CLOCK_MONOTONIC`, thread names via `pthread_setname_np`, copies out of the memory-mapped download file are guarded against `SIGBUS` (a truncated file), and the few HRESULT values the engine passes around are defined there. - **Output** (`MiniaudioOutput`, vendored miniaudio 0.11.26 in `external/miniaudio`): the same interface as `WasapiOutput`, so `AudioEngine` keeps its pull model — the engine thread fills a 40 ms single-producer ring and waits on the output's event; miniaudio's callback drains the ring (`padding` / `writable` / `getBuffer` / `releaseBuffer` are WASAPI's, emulated). Shared mode, 32-bit float, 10 ms periods. Backends: PulseAudio (PipeWire's pulse server too), then ALSA; only those and the null backend are compiled in, and miniaudio loads them at run time (no link dependency). `SHADETUBE_AUDIO_BACKEND=pulse|alsa|null` picks one; `null` runs the clock without a device (silent: tests and sandboxed runs use it). The device list (Ayarlar › Ses › Çıkış aygıtı, headphone correction per device) is miniaudio's enumeration: the id is the sink's name, "headphones" a guess from Bluetooth and the name. Device loss and rerouting come from miniaudio's notifications. **Exclusive mode** is Windows-only: its toggle and status are not shown on Linux. - **Decoding** (`Decoder_linux.cpp`): the built-in Opus / Vorbis decoders first (3.52), then FFmpeg: libavformat over a custom `AVIOContext` on the `ProgressiveBuffer` (`FfmpegIo`), libavcodec, libswresample to stereo float at the rate the engine asks for. Sample-exact like Media Foundation: positions start at the first presentable sample (an MP3's LAME delay), MP4 edit lists apply (a fragmented MP4's list is freed by `Fmp4Index` and the priming dropped here), an MP4's encoder padding past the container's duration is cut (at most 8192 frames), seeks into lossy streams start 200 ms early so the decoder is primed (the Track drops what precedes the target), and a seek to 0 goes back to the first packet. An MP3's length: FFmpeg 8's demuxer (libavformat 62) reports the exact one, older ones the whole frames, from which the encoder delay is subtracted (the library loaded at run time decides). `codecs_test` checks AAC and ALAC in M4A, MP3, FLAC and WAV made with FFmpeg's encoders: exact length, frame 0 first, seeks landing on the sample. - **Network**: `ProgressiveBuffer_linux` and `HttpStream_linux` on libcurl (multi interface, `curl_multi_poll` woken by the cancel event). Their handles are set up by core's `http::prepareCurl` (the process-wide DNS cache and TLS sessions, dropped on a network change; the proxy setting) and report each finished transfer to `proxy::reportCurl` (the proxy status in Ayarlar); a proxy change reconnects a running download or stream. "ICY 200 OK" answers are accepted (`CURLOPT_HTTP200ALIASES`). - **Live radio** (3.18): `LiveDecoder_linux` decodes MP3 / MP2 / AAC with FFmpeg (Opus / Vorbis built in), HLS AES-128 segments with libavutil's AES, and legacy ICY titles are decoded from Windows-1252 / Windows-1254 like on Windows. - **Downloads** (3.7): the MP3 encoder is FFmpeg's `mp3` muxer with libmp3lame; its Xing / LAME header carries the encoder delay and padding, so a downloaded MP3 decodes to the exact length. - **Tag editor core** (`TagWriter`): POSIX reads and writes, the temporary is a dot file that takes the original's permissions (and owner where allowed), is `fsync`ed and swapped in with `rename(2)` (whoever has the original open keeps its data); no write permission counts as read-only; a symbolic link has its target rewritten. SHA-256 through OpenSSL, ID3v1's Latin-1 best fit through GLib, ID3 UTF-16 with surrogate pairs (`wchar_t` is UTF-32 on Linux). - **Headphones, Bluetooth and calls** (3.70, `AudioFocus_linux.cpp`): a PulseAudio client reports sinks coming and going, the default sink moving and a sink switching between a headphone and a speaker port (pulling headphones out of a jack keeps the sink); "personal" is the port type, the form factor or Bluetooth. A playback or recording stream with the `phone` role (what VoIP apps set) is a call. - **Song recognition** (3.59, `Capture_linux.cpp`): libpulse-simple records the default sink's monitor (system sound, ShadeTube's own playback included: `ownSoundIncluded()`) or the default source, already converted to 16 kHz mono by the server; a failed read reopens on the current default for 4 s. - **Headphone correction** (3.66): the AutoEq store's write-then-rename uses `rename(2)`. - **Texts**: what names Windows in the audio settings has its own Linux wording, chosen with `#ifdef` (the default output device is "Sistem varsayılanı", the headphones line says the device looks like headphones, the call setting's note names the `phone` role, song recognition's microphone permission names the sound server). - **Video decoding** (3.41): `st_video` builds on Linux. `VideoDecoder` is split: the frame queue, slots, seeks and skips are shared (`VideoDecoder.cpp`), the decode thread is Media Foundation (`VideoDecoder_win.cpp`) or FFmpeg (`VideoDecoder_linux.cpp`). On Linux libavformat reads the `ProgressiveBuffer` through the same `FfmpegIo` as the audio decoder (a fragmented MP4's edit list freed by `Fmp4Index` and subtracted, as on Windows), libavcodec decodes in software with frame threads (H.264, VP9; AV1 through libdav1d or libaom, FFmpeg's own `av1` decoder being hardware-only) and libswscale converts to BGRA in the slot's memory (BT.709 / BT.601 and the range from the stream, as Media Foundation's processor picks them). A seek lands on the key frame at or before the target: libavformat indexes by decode time, so when the first frame after a seek starts past the target the decoder steps back a key frame (at most 3 times). Same-position rules as Windows (a seek ahead within the buffered part is a skip, a `skipUntil` drops frames without converting them). `VideoPlayer_linux.cpp` keeps the Windows scheduler and hands the frame out as `VideoPlayer::Picture` (BGRA, alpha 255, `stride = width * 4`, a `serial` that changes with the picture: on little-endian this is cairo's `CAIRO_FORMAT_RGB24`); it is never lost and never needs a software fallback. The official video's soundtrack and alignment (`Soundtrack`, `AudioAlign`, 3.42) decode with the audio module's FFmpeg decoder. Cost (720p H.264 at 25 fps, 4 CPUs): the four frame threads take ~1.3 % of a core each, the BGRA conversion ~0.4 ms a frame, and the decode thread waits for a free slot 99 % of the time; FFmpeg 6.1, 7.1 and 8 measured alike. A frame dropped on a slow machine is a paint that came late (the window side, the compositor), not the decoder. - **Video mode** on Linux: the window side draws `VideoPlayer::Picture` (app/VideoMode, 3.84); `video/Available.h`'s `kAvailable` is the switch the app hides every way into video mode with, `kDecoderAvailable` says the decoding side works. - **Tests**: on Linux `audio` (YouTube end to end), `audiodsp`, `autoeq`, `automix` (with the real engine on the null backend), `codecs`, `downloads`, `key`, `liveaudio` (the same mock Icecast / HLS server; fixtures made with libavcodec), `playback` (a write lease, `F_SETLEASE`, holds the file where Windows takes an oplock), `preview`, `recognize` (offline; its `yt` mode recognized a YouTube song end to end), `tags` (`tags_test_linux.cpp`: FFmpeg-made files), `tempo`, `video` (H.264 in a fragmented MP4 with an edit list and VP9 in WebM, made with libavcodec: every frame's color and time, seeks, the player at 1x / 2x and after a jump; its `play` mode played a YouTube video end to end) and `visualizer` build and pass; they run with `SHADETUBE_AUDIO_BACKEND=null`. `tests/common/TestPlatform.h` gives test programs the few Windows names they use (process id, ticks, `Sleep`, temp folder, environment, `wmain`, the UI queue's pump); `FfSampleFormats.h` asks an encoder's sample formats through `avcodec_get_supported_config` from FFmpeg 7.1 on (`AVCodec::sample_fmts` before). - **Checked on WSLg's PulseAudio server**, silently: playback into a temporary null sink at volume 0 (a "ShadeTube" sink input, 32-bit float, position advancing), capture from a null sink's monitor fed with a test tone (440 Hz read back, the microphone path through `PULSE_SOURCE`), the AudioFocus watcher with a null sink of headphone form factor and a phone-role recording of its monitor; public Icecast MP3 / AAC stations and an HLS stream played on the null backend. ### 3.86 Linux port — os The app's system integration on Linux, everything that isn't drawing: what Windows does with Win32, WinRT, WebView2 and DPAPI. Windows builds and behaves as before. The Linux files sit next to the Windows ones as `*_linux.cpp` (listed per platform in `src/app/CMakeLists.txt`, the binary is `shadetube`); shared files keep small `#ifdef _WIN32` parts. - **One instance** (`app/Instance.h`, `main_linux.cpp`): a `GtkApplication` (id `io.github.shadesofdeath.ShadeTube`, `SHADETUBE_APP_ID` for tests) owns that name on the session bus. A second launch hands over what it was started for and exits: nothing → the window comes back, `--open-link <url>` or a bare link (the desktop file's `%U`) → it opens, `--command play-pause|next|previous|mini` → it runs. App sets the handlers; what arrives while it is still starting waits for them. On the way out (`quit()`, and the first lines of `~App` like `kExitingProp` on Windows) `instance::beginExit()` gives the name up, so a later launch becomes the next instance and waits up to 20 s for the old process's `instance.lock`. `restart()` starts the program with `--restart-after <pid>` (an AppImage from its own file, `$APPIMAGE`). SIGTERM (the session ending, systemd, `kill`), SIGINT and SIGHUP quit like "Çıkış" (GLib's `g_unix_signal_add` on the UI loop → `quitApp`: settings, queue and window placements saved); a second signal, or one before App exists, ends the process the default way. - **Media controls** (`app/Smtc`, `Smtc_linux.cpp`): an MPRIS 2.2 player, `org.mpris.MediaPlayer2.ShadeTube` (a second copy, e.g. `--preview`: `.instance<pid>`), seen by GNOME's media card and lock screen, the media keys (gsd-media-keys), KDE, waybar and playerctl. It publishes the metadata (title, artists, album, length, track id, the cover as a `file://` URL: fetched through the app's own HTTP stack and proxy into `<cache>/mpris`, since desktops read local files reliably; a local song's own cover file as it is; none for a song without one), the playback state, position (`Seeked` on jumps), next / previous, volume, shuffle and repeat. Every method and writable property goes back to the player: Play / Pause / PlayPause / Stop / Next / Previous / Seek / SetPosition (ignored for another track id), Volume, Shuffle, LoopStatus, Raise, Quit and OpenUri (a `shadetube:` / Spotify / YouTube link). Changes go out as one `PropertiesChanged` per main-loop turn. The extra setters and callbacks exist on Windows too and do nothing there (SMTC has no such fields). - **Notifications** (`SongNotifier_linux.cpp`, `Tray::balloon`): `GNotification` through the GtkApplication (GNOME's `org.gtk.Notifications`, the portal in a Flatpak, `org.freedesktop.Notifications` elsewhere). The song notification (id `song`) is replaced by the next song and withdrawn when the song would have ended and at exit; its buttons are `app.song-next` / `app.song-like` with the song's key as the target (a stale notification never acts on another song), its body `app.show-window`. Shown only when no ShadeTube window has the focus and the mini player is hidden (a Wayland app can't tell whether another window covers it); Do Not Disturb is the desktop's. - **Tray** (`Tray_linux.cpp`, `StatusNotifier_linux.cpp`): a StatusNotifierItem with a `com.canonical.dbusmenu` menu (`/MenuBar`, the same entries as on Windows, refreshed on `AboutToShow`) and icon pixmaps of 22 to 64 px from the app's SVG; a click shows the window. It needs a watcher (KDE, Cinnamon, XFCE, waybar; GNOME only with the AppIndicator extension) and registers again when the watcher restarts. Without one `Tray::added()` and `Tray::shownInDesktop()` are false: App never hides to a tray nobody can see, and Ayarlar hides "close to tray" and "start in tray". - **Opening things** (`SystemOpen_linux.cpp`): URLs with `GtkUriLauncher`, files and folders with `GtkFileLauncher` (the OpenURI portal in a Flatpak, the desktop's default apps otherwise), "show in folder" through `org.freedesktop.FileManager1.ShowItems`. `ms-settings:` links (Windows' Settings pages) are dropped; a URL given to `sysopen::path` opens as a URL, as `ShellExecuteW` does. - **Spotify sign-in** (`LoginWindow_linux.cpp`): a GTK window with a WebKitGTK 6.0 web view and the WebView2 flow: accounts.spotify.com in a network session of its own, kept in the login's folder; after each load and cookie change the cookie manager is asked for open.spotify.com's cookies, and `sp_dc` closes the window. The app's proxy is given to the session (Sistem: the desktop's own setting). `SHADETUBE_LOGIN_URL` / `SHADETUBE_LOGIN_COOKIE_URL` point it at a local page: `login_test` serves one that sets a fake `sp_dc`. - **Start at sign-in** (`Autostart_linux.cpp`): an XDG autostart entry, `~/.config/autostart/io.github.shadesofdeath.ShadeTube.desktop` with `Exec="<exe>" --autostart` (`$APPIMAGE` or `/proc/self/exe`). The desktop's own switch for it (`Hidden` / `X-GNOME-Autostart-enabled=false`) shows in Ayarlar as the blocked state, like Windows' Startup apps. In a Flatpak the Background portal writes the entry. A sandbox profile never touches it (`SHADETUBE_AUTOSTART_DIR` names a test folder). - **Network** (`NetworkWatch_linux.cpp`): `GNetworkMonitor` (NetworkManager, the portal in a Flatpak, netlink otherwise); a change with the network available, or connectivity becoming full, fires once for changes close together. - **Discord** (`DiscordRpc.cpp`): the IPC is a unix socket, `discord-ipc-0..9` in `$XDG_RUNTIME_DIR`, its Flatpak (`app/com.discordapp.Discord`, `app/dev.vencord.Vesktop`) and Snap (`snap.discord`) folders, `$TMPDIR` and `/tmp`. - **LAN and the brokers** (Cast, the phone remote, listen together): POSIX sockets under the Winsock names (`app/SocketCompat_linux.h`; sends use `MSG_NOSIGNAL`), TLS through OpenSSL with the system's CA store (`NetStream_linux`: CASTV2, the MQTT brokers over `wss://`) and the RFC 6455 client `WebSocketClient_linux` over core/Proxy. Listen together's cryptography is OpenSSL with Windows' wire formats (`JamCrypto_linux.cpp`: AES-256-GCM as nonce ‖ ciphertext ‖ tag, P-256 public keys as X ‖ Y, SHA-256(Z ‖ label) as CNG's `BCRYPT_KDF_HASH`), so Windows and Linux share a session. What `JamCrypto::protect` and `RemoteAuth` keep on disk is sealed by `core/Secret` (3.83). - **Updates** (`Updater.cpp`, `AboutSettings`): the check and the "new version" notice stay, installing doesn't (the package manager, Flathub or a new AppImage does that): the notice opens the release page. The running version is the build's (`ST_APP_VERSION`). `Installer_linux.cpp`: no install of our own, so never "Kurulu" / "Uygulamayı kaldır"; the exe's location, the command line and starting a process (now, or once this one has exited). - **Windows-only features** are left out of the Linux UI: global hotkeys (the desktop's own shortcut settings can run `shadetube --command next`), the taskbar buttons and jump list, the in-app installer; texts that name Windows have Linux wording ("Oturum açınca başlat"). - **Tests on Linux**: `smtc_test` (MPRIS through a second bus connection: every property and method, the cover file, the name given up), `login_test` (the web view against the local fake page; `--shot <png>` saves the window), `desktop_test` (mock StatusNotifierWatcher, Notifications and FileManager1 services on the session bus; links and files opened by a test handler from a temporary XDG folder; the autostart entry), `jam_test`, `remote_test`, and `cast_test` once `st_audio` builds. `scrobble_test`'s Discord part uses a fake unix socket. They need a session bus and a display (WSLg is enough) and a sandbox profile. - **Packaging**: the desktop file `io.github.shadesofdeath.ShadeTube.desktop` (the app id, which MPRIS' `DesktopEntry` and the notifications refer to) with `Exec=shadetube %U` and `MimeType=x-scheme-handler/shadetube;`. A Flatpak needs `--own-name=org.mpris.MediaPlayer2.ShadeTube`, `--talk-name=org.kde.StatusNotifierWatcher` (the tray) and access to Discord's socket (`--filesystem=xdg-run/discord-ipc-0` or the Discord Flatpak's `xdg-run/app/com.discordapp.Discord`). ### 3.87 Linux port — packaging How the Linux build is installed and shipped. Identifiers, fixed: app id **`io.github.shadesofdeath.ShadeTube`** (the desktop file, the metainfo, the icons, the Flatpak, the GTK application id; the MPRIS name is `org.mpris.MediaPlayer2.ShadeTube`), executable **`shadetube`** (`OUTPUT_NAME` of the `ShadeTube` target, set in `cmake/LinuxPackaging.cmake`; the Windows exe keeps its name), name "ShadeTube". - **Install layout** (`cmake --install`, prefix `/usr` in packages): `bin/shadetube`, `share/applications/io.github.shadesofdeath.ShadeTube.desktop` (`Exec=shadetube %U`, `MimeType= x-scheme-handler/shadetube;` so `shadetube:` links open the app like the Windows URL protocol), `share/metainfo/ ….metainfo.xml` (AppStream: description, screenshots from `site/img`, releases, OARS), `share/icons/hicolor/ {16…512, scalable}/apps/….png|svg` (rendered by `tools/linux-icons.sh` from `assets/logo/app-icon.svg`; commit the output), `share/doc/shadetube/` (`copyright` = LICENSE, THIRD_PARTY_NOTICES.md, the fonts' OFL.txt). Everything else is embedded in the binary (`st_embed_assets`). The top-level CMakeLists includes `LinuxPackaging.cmake` on UNIX; without a `ShadeTube` target it installs the data files only. Checks: `desktop-file-validate`, `appstreamcli validate --no-net` (one pedantic note: the id has capitals, which Flathub accepts for existing ids). - **`tools/package-linux.sh`** `--deb --appimage --flatpak | --all` (`--rpm` on request only) `[--build-dir D] [--out dist] [--skip-build] [--jobs 8]`: a Release build with `-DST_BUILD_TESTS=OFF`, then the packages in `dist/` with a `.sha256` each and a `sha256: <hex> <file>` line per file (as `package.ps1`). Tools it downloads (linuxdeploy, appimagetool, the AppImage runtime, the FFmpeg and LAME sources) are pinned by version **and SHA-256** (the FFmpeg tarball's GPG signature is checked too) and cached in `~/.cache/shadetube-packaging`. - **.deb** (CPack, `dpkg-shlibdeps` fills `Depends`): FFmpeg's sonames change between Ubuntu releases (24.04 libavformat60, 26.04 libavformat62), so **one .deb per Ubuntu LTS**, built on that release; the revision says which (`ST_DEB_RELEASE`, default `1~<os-release ID><VERSION_ID>`; the file is `shadetube_0.14.0-1.ubuntu24.04_amd64.deb`, named as GitHub stores a release asset, which turns `~` into `.`). Recommends a Secret Service keyring, `xdg-desktop-portal` and `iso-codes` (the radio's country names) (and `libwebkitgtk-6.0-4`, which shlibdeps also puts in Depends while the login window links WebKitGTK directly). Debian 13 and Mint / Pop!_OS / Zorin use the build of their Ubuntu base. **.rpm**: CPack on the same Ubuntu build, so its automatic requires carry Debian sonames and symbol versions (`libavformat.so.60`, `libcurl.so.4(CURL_OPENSSL_4)`) and it installs on no current Fedora: it is built only with an explicit `--rpm` (not by default, `--all` or the CI) and is not a release file. A Fedora build (a `fedora:latest` container running `--rpm`) would fix that. - **AppImage** (for distributions without a .deb that don't want Flatpak): built with linuxdeploy **without its GTK plugin**. Bundling GTK 4 breaks more than it fixes: the bundled GTK is then older than the system's theme, input methods (IBus / Fcitx modules are built against the system GTK) and above all WebKitGTK, which cannot be relocated at all (its WebProcess / NetworkProcess helpers are found through a compiled-in libexec path) and must match the GTK in the process. So the AppImage needs **GTK ≥ 4.14, WebKitGTK 6.0, GLib, libcurl, libsecret, librsvg, libpulse and OpenSSL 3 from the system** (every distribution from 2024 on; WebKitGTK is linked, so without it the AppImage does not start: loading it with `dlopen` only for the login would lift that) and carries only what varies: its own minimal **FFmpeg 7.1** (`--build-suffix=-st`, so `libavcodec-st.so.61` can never clash with the system's FFmpeg; decoders, demuxers and parsers for what the app plays, plus the MP3 muxer and LAME 3.100 linked in statically for MP3 downloads; no network, no other external library, no AV1 decoder (video mode then picks VP9 / H.264): LGPL, the licenses and a source note with both tarballs' SHA-256 under `usr/share/doc/shadetube`; `FFMPEG_CONF` in the script keys the cached build, bump it when the configuration changes), and the build machine's **ICU** (the library sort's collator): its soname differs between distributions (`libicuuc.so.74` on 24.04, newer later) and so do its symbols, so the bundled one lives next to the system's that other libraries load (its Debian copyright file as `<package>-copyright`). **libjpeg-turbo 3.2** is linked into the binary instead (`build_libjpeg`: static, PIC; CMake `-DST_LIBJPEG_STATIC=<prefix>` in `src/gfx`, with `--exclude-libs,libjpeg.a` so no `jpeg_*` is exported; the script stops if the binary still needs or exports libjpeg). A bundled `libjpeg.so.8` under the system's soname would be the one the process loads for everybody: Arch's libtiff (via GTK) then missed libjpeg-turbo 3's `jpeg12_*` and the AppImage did not start (issue #7). Its license (IJG + BSD) is under `usr/share/doc/shadetube`. RUNPATH `$ORIGIN/../lib` (binary) and `$ORIGIN` (the libraries) are set with `patchelf`; linuxdeploy runs with `--exclude-library '*'` so nothing else is pulled in, and its `AppRun` symlink is replaced by a script that `exec`s `usr/bin/shadetube` (the process is then called `shadetube`, not `AppRun`); appimagetool 1.9.1 with the pinned type-2 runtime (static, no libfuse2 needed; `fusermount3` must exist, or run it with `--appimage-extract-and-run`). Size: ~28 MB (unpacked: the app 27 MB, ICU 36 MB, FFmpeg 9 MB). No update information is embedded (no zsync channel). - **Flatpak** (`packaging/linux/io.github.shadesofdeath.ShadeTube.yml`): GNOME runtime **51** (WebKitGTK 6.0, GTK 4.24, FFmpeg 8 with `org.freedesktop.Platform.codecs-extra` installed automatically for AAC / H.264, curl, libsecret, librsvg); one `cmake-ninja` module, source = this checkout (`type: dir`; a Flathub submission replaces it with a `git` source pinned to the release tag and commit). Permissions and why: `wayland` + `fallback-x11`, `ipc`, `dri` (the window), `pulseaudio` (output, PipeWire's Pulse socket included), `network`, `xdg-music` (downloads in ~/Music/ShadeTube and the local library), `org.freedesktop.secrets` (the session in the keyring), `org.freedesktop. Notifications`, own `org.mpris.MediaPlayer2.ShadeTube` (+ `.ShadeTube.*` for the per-instance fallback), `org.kde.StatusNotifierWatcher` (the tray icon), and Discord's IPC socket (`xdg-run/discord-ipc-0`, `xdg-run/app/com.discordapp.Discord` for Flatpak Discord) for the Discord status. Inside the sandbox the profile is `~/.var/app/io.github.shadesofdeath.ShadeTube/{data,config, cache}/ShadeTube`. `--flatpak` builds with `flatpak-builder --user` (needs `org.gnome.Sdk//51` and `eu-strip` from elfutils on the host) into a single-file bundle whose runtime repo is Flathub (`flatpak install --user ./….flatpak` fetches the runtime). - **CI** (`.github/workflows/linux.yml`; paths-filtered to code / packaging changes so site and docs commits don't run it): `build` on ubuntu-24.04 (Debug build, `tools/run-linux-tests.sh` under `xvfb-run` + `dbus-run-session`, the desktop file and metainfo validated, an install into a staging dir) and `build-resolute`, the same build and tests in an `ubuntu:26.04` container (GCC 15, FFmpeg 8, GTK 4.22: what the 26.04 .deb and, nearly, the Flatpak use; the tests run as a normal user there, since the container's root ignores file modes); on `v*` tags and manual runs also `packages-noble` (.deb + AppImage), `packages-resolute` (an `ubuntu:26.04` container: the 26.04 .deb) and `flatpak`, each uploading its files as a workflow artifact (attach them to the release by hand, see 6). The Windows build is not in CI (it never was). `actionlint` passes. - **Tests on Linux**: `tools/run-linux-tests.sh [build-dir]` runs the programs named in `tests/CMakeLists.txt`'s `_linux_tests`, each with a fresh `SHADETUBE_DATA_DIR`, the null audio backend and offline arguments; programs that need the network and have no offline mode (`audio`: real YouTube streams) are skipped unless `ST_TESTS_ONLINE=1` (CI runners are often refused by YouTube). Its exit code is the number of failures. Run it as a normal user: as root `tags_test`'s read-only file is writable. Where bubblewrap can't create user namespaces (containers, chroots, hosts that restrict them) it sets `WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1`, or WebKitGTK aborts `login_test`, which only loads its own pages from 127.0.0.1. - **Verified** in a MelloraOS 1.0 VM (Ubuntu 26.04, GNOME 50 on Wayland, GTK 4.22, booted from a copy of its ISO under QEMU/KVM, QMP screenshots; the harness is a development aid outside the repository): the 26.04 .deb installs with apt (it pulls the FFmpeg 62 libraries) and starts; the AppImage (built on 24.04) starts from the user's home with the system's GTK 4.22 and its own FFmpeg 7.1; the Flatpak installs the GNOME 51 runtime + codecs-extra from Flathub and starts in the sandbox. The 24.04 .deb installs into a fresh minimal Ubuntu 24.04 (debootstrap, main + universe) with every library found; Flathub's linter passes the manifest and the metainfo (its repo check only misses the screenshots, which a local offline build cannot fetch); the offline tests pass with the AppImage's FFmpeg 7.1 build (`codecs`, `downloads`, `audiodsp`) as with the system's. With the whole app (every module on), each of the three in the VM, on a sandbox profile, the null audio backend and no sign-in: Home, Search, an album, Settings (About says Linux; no WASAPI, global hotkey or Mica rows), Now Playing with a song and its synced lyrics, video mode (YouTube's 720p H.264, decoded in software with 4 threads), the mini player, the launcher entry and icon, the tray icon, GNOME's media card (MPRIS, with the cover) and a log without errors (MusicBrainz's 503 rate limit aside, retried). 0.14.0's release files, two tours each on an idle host (4 vCPUs): a start to the first drawn frame and out again takes ~0.4-0.5 s with a warm cache (`flatpak run` included); resident memory ~140-155 MB on Home, ~150-170 MB playing, ~230-250 MB with the video, which drops 0-7 of ~1,200 frames in 48 s. The whole test list passes in a 26.04 chroot run the way the CI's `build-resolute` job runs it (Debug, a normal user, `xvfb-run` + `dbus-run-session`: 58 programs, `audio` skipped offline); `codecs`, `tags` and `video` also pass inside `org.gnome.Platform//51` (built with its SDK, GCC 16). ## 4. Coding conventions - C++20, MSVC `/W4 /permissive- /utf-8`. Namespace `st::<module>`. Files `PascalCase.h/.cpp`. - UTF-8 `std::string` in models; convert with `st::toWide` only at Win32 / DirectWrite boundaries. - COM: `Microsoft::WRL::ComPtr`. No raw `new` / `delete` for owning pointers. - Errors: exceptions inside services (worker threads), converted to `st::Result<T>` for the UI. - Logging: `ST_LOG_INFO("tag", "fmt {}", x)` → `logs\shadetube.log` (WRN / ERR lines at once, DBG / INF ones within about a second, and before a crash report: 3.12). Never log cookies, tokens or credentials. - **i18n**: every user-visible string goes through `tr()` (with `i18n::format()` for placeholders) or `plural()`. Source strings are Turkish, sentence case; mono labels are uppercased with `st::toUpperTr`. Brand names ("Spotify") stay literal. Run `tools/i18n_check.py --all` before a commit that touches UI text and add the new keys to every `assets/i18n/*.json`. - Design values come from the tokens (`assets/tokens`) and the existing components. **Don't invent new radii or colors**: surfaces 2 px, controls pill/circle, hairlines instead of shadows (menus, toasts and dialogs use the `shadow*` / `scrim` tokens). Both themes must work. Corner radii are read at paint time from `gfx::radii()` (the corner style changes them live, 3.35), never written as literals; colors only from the palette (every preset and custom theme must work, not just the default dark / light). - Keyboard: interactive widgets set `focusable = true`, return `activatable() = true` and implement `onActivate()` (Enter/Space); give `focusShape()` / `focusRect()` when the default (rect, radius 2) is wrong. Never paint focus yourself: the Window draws the ring. Text fields and lists that need every key stay non-activatable. Callbacks that may navigate (and so destroy the widget) are called through a local copy. - App files that tests compile directly (`Blacklist`, `ContentFilter`, `Genres`, `ListenStats`, `HistoryImport`, `ScrobbleImport`, `LocalLibrary`, `RuleLists`, `BpmStore`, `HomeLayout`, `Snooze`, `PrivateSession`, `AudioFocus`, `Scrobbler`, `DiscordRpc`, `SponsorBlock`, `Smtc`, `Updater`, `Installer`, `LibrarySort`, `RemoteHttp`, `RemoteAuth`, `RemoteApi`, `RemoteState`, `RemoteServer`, the `Jam*` core, `HeaderCollapse`, `OfficialVideoCache`, `AutoEq`, `Podcasts`, `PodcastChapters`) must stay standalone: no `App`, `AppContext` or UI headers. `Installer`, `Updater` and `Autostart` are also the `st_install` library the setup links (3.57). ## 5. Testing ### 5.1 Sandbox profiles **Never test against your real `%LOCALAPPDATA%\ShadeTube`.** Set `SHADETUBE_DATA_DIR` to a scratch folder; the app and every test program then keep settings, session, caches, logs and crash dumps there: ```powershell $env:SHADETUBE_DATA_DIR = "$env:TEMP\shadetube-dev" .\build\Debug\bin\ShadeTube.exe --preview --route settings ``` `altsource_test`, `playback_test`, `stats_test`, `localfiles_test` and `updater_test` switch to their own profile automatically; for the others set the variable yourself (`mb_test` clears the profile's `cache\mb` by default). To get a Spotify session in a sandbox, run the app once with the variable set and sign in: the live `spotify_test` modes read the active account's `accounts\<id>\spotify.dat` (a 0.10 root `spotify.dat` too; or `SHADETUBE_SPDC`). Note that the single-instance check is shared: without `--preview` or `--screenshot`, a sandboxed launch just brings an already running ShadeTube to the front. ### 5.2 Test programs Console programs under `build\<Config>\tests\<module>\`; they print each check and exit non-zero on failure. | Program | Covers | Modes | |---|---|---| | `spotify_test` | TOTP / base32 vectors, home parser, artist page parser (`parseArtistOverview`), search kinds / followed shows / show details / profiles fixtures and rootlist folder fixtures; live token, library, playlists, search | `offline`; default = offline + live when a `sp_dc` is available; `token-probe` (a made-up `sp_dc` only, never the saved one: the token endpoint must answer refused = HTTP 401 with the current secret, a wrong secret must not look refused; the 3.5 classification); `home [dump.json]`; `radio`; `hashes`, `hashes scan`; `search` (every search kind and its paging, a show, a public profile, shows resolved to public feeds; an anonymous token when there is no `sp_dc`, 3.54 Search kinds); `playlist-edit` (**writes**: create → add → rename → insert before / move behind → description + cover → clear → remove → delete a temporary playlist) | | `mb_test` | MusicBrainz / ListenBrainz / Wikidata parsing (artist links from url-rels, Wikipedia titles and summaries), cold vs warm cache | `--offline`, `--keep-cache` | | `ytmusic_test` | YouTube Music parsers on captured answers (search filtered / unfiltered + top result, a filtered list's continuation, album, artist (banner, audience, subscribers, Wikipedia bio, featured playlists, the "More" pages), an artist's discography page, playlist + continuation, watch-next radio + continuation, home + continuation, explore, charts, moods, a mood), ids, durations / counts, picture URLs, shapes that must not throw | default offline; `live [query]` (every endpoint, timings, the one-request quick search, paging, the full discography, the disk cache, pinned playback through `MatchService`); `dump <file>` | | `altsource_test` | Piped / Invidious parsing, stream choice, instance health, `MatchService` fallback | default offline (fixtures); `mock`; `live [kind:url…]`; `serve [port]` (mock instance for the app) | | `ytstreams_test` | YouTube streams through the engine's downloader and decoder (start, seek, tail), a refused URL recovered by a new session, YouTube refusing everything (backup servers / SoundCloud), SoundCloud matching | default offline (SoundCloud parsing / matching); `live [<id>…]`; `soak <id> <seconds>` | | `audio_test` | `AudioEngine` against real YouTube streams (states, positions, seeks beyond the download, pause, gapless, crossfade, the other container, memory) | network; `[--webm] [--exclusive] [videoA] [videoB]` (`--webm`: everything on Opus / WebM, the built-in decoder; `--exclusive`: WASAPI exclusive mode) | | `codecs_test` | built-in Opus / Vorbis (3.52) on ffmpeg-made chirp fixtures: the Media Foundation path on a fragmented AAC MP4 with a YouTube-style edit list inserted (Media Foundation alone reads nothing; the Decoder reads from the edit on, chirp at lag 0, seeks on the presentation timeline); `RatePolicy`, the resampler (lengths, 1 kHz sine SNR, aliasing, impulse position, chunked = one-shot), the Matroska demuxer (track info, cues at the front / end, timestamps, DiscardPadding, seeks, Xiph / EBML / fixed lacing, unknown-size cluster, truncated / garbage / damaged input), the decoder path on Ogg Opus / Ogg Vorbis / WebM Opus / Matroska Vorbis (exact lengths, alignment, seeks against the full decode, resampled both ways, 5.1 downmix, mono, tag gains), `XiphTags`, live Ogg Opus / Vorbis (chained) through `OggDemuxer` + `LiveDecoder`, a short engine run | offline; `[fixtures dir]`; `--exclusive` (3.53 on the default device, ~15 s); `--live <url>` (a station's state for 15 s); `--bench <file> [rate]` (decode speed) | | `mp3_probe` | can Media Foundation encode MP3 on this machine | offline | | `downloads_test` | MP3 transcode + SponsorBlock trimming on a generated WAV | offline; `--keep` | | `localfiles_test` | scanner, tags, covers, index, incremental rescan, `refreshEntry` = what a scan stores, folder tree (natural order, covers, nested / drive roots, 50 000 files timed), files dropped from Explorer + drop rules, MF decode + short playback | offline; `[parent-folder] [--keep]`; extra formats when `ffmpeg` is on PATH | | `localscan_test` | Linux only (3.83): the local library's exact-case paths (`Song.wav` and `song.wav`: two ids, two files scanned, both reused by a rescan, one removed alone; folders `Music` and `music`; dropped files and `mergeRemembered`), `local::FstabMounts` over fstab / mounts files of its own (nested mount points, `\040`, swap and `/` entries, no fstab) | offline; `--offline <dir>`: a scan of a folder on an fstab mount point that isn't mounted keeps its entry (run in a mount namespace whose `/etc/fstab` names it: see `tests/localscan/CMakeLists.txt`) | | `tags_test` | tag editor core (`audio/TagWriter`) on generated files (every field, the BPM and the key too: ID3 TBPM / TKEY, MP4 tmpo / initialkey, Vorbis BPM / INITIALKEY, changed and removed): MP3 (MF download with APIC / USLT / SYLT / TXXX, hand-built v2.4 + ID3v1, v2.2, no tag, ID3v1 only, padding, unsynchronisation, junk), FLAC (MF encoder, else ffmpeg, plus a hand-built one; padding used / rewritten, no comment block), M4A (MF AAC / ALAC, moov before / after mdat, free box absorbing a change, fragmented MF / ffmpeg files, injected freeform items); Turkish / Japanese text, covers up to ~2 MB, PNG, every other frame / block / item kept, payload SHA-256, the result decodes to the same PCM, the property system's view; corrupt, read-only, in-use, playing (mapped), tampered and changed-meanwhile files, no leftovers | offline; `--keep`; ffmpeg variants when on PATH | | `playback_test` | blocklist store + rules, `Player::localMimeType`, a real `Player` on generated WAVs (skips, endless hooks, crossfade vs. gapless album, silent ending, 2x speed, a preloaded next track failing after the handoff before it is heard (its file held by an oplock, then empty): followed and skipped; a simulated device outage: one toast, Buffering on the same item and position, an item started meanwhile waits too, no skip, plays on after it), decoding to 48 kHz | offline; `[<audio dir>]`; needs an audio device | | `audiodsp_test` | equalizer response / headroom / processing, presets, ReplayGain tag parsing (ID3 / FLAC / MP4), limiter (ceiling, latency, release), time stretch (length, pitch, positions, flush), output-device enumeration, the parametric EQ (the HD 600 profile against scipy and AutoEq's curve at 44.1 / 48 / 96 kHz, clipping safety, rate changes), ParametricEQ.txt / Equalizer APO parsing, silence trimming on synthetic speech (pauses, positions, the saved time), the voice boost | offline | | `autoeq_test` | the AutoEq index parser (`app/AutoEq`, 3.66), search (folding, order, sources together), profile / page URLs, the per-device store (`autoeq.json`: set, replace, enable, remove, the engine's map, persistence, a damaged file) | offline; `live` (the real index from GitHub and the HD 600 profile) | | `scrobble_test` | MD5 / Last.fm signatures, listened-time rule, DPAPI store, Discord IPC framing | offline + bogus-credential live checks; `SHADETUBE_DISCORD_APPID` shows a real presence | | `smtc_test` | SMTC against the real Windows media session service | default; `--no-verify`; `--hotkey-probe` | | `sponsorblock_test` | hash prefix, parsing, skip state machine, live lookups | default (network); `--offline` | | `podcasts_test` | XML reader, RSS / directory parsing, dates, durations, episode model, download names, `podcasts.json` store, Spotify show → directory matching and the kept links, chapters (JSON, ID3 CHAP / CTOC v2.3 / 2.4 incl. a real Buzzcast tag, MP4 `chpl`), transcripts (SRT, VTT, JSON, HTML, text; as lyrics, long cues split), feed extras and per-show speech settings | offline; `live` (Apple search / charts / lookup, a real feed, redirects, partial + resumed and full downloads, `findFeed` and its request spacing, Buzzcast's JSON chapters = its audio's ID3 chapters through range requests, a transcript) | | `network_test` | the local-network guard of untrusted URLs (3.17 Network, `core/Http`): `resolveUrl`, `publicUrl`, `getLimited` following redirects itself (every hop checked, the first too; https → http refused; at most 10 hops), Podcasts' feeds / enclosures / downloads (the 416 reopen too) refusing a redirect into the local network before any request reaches it; last, `http::cancelAll` (3.1 Exit: a read under way ends within a second, new reads and name lookups fail at once, a POST still goes); a local server plays both sides ("127.0.0.1" public, "localhost" local) | offline; `live` (a public name resolving to 127.0.0.1, a public redirect into the local network) | | `matching_test` | YoutubeExplode's TrackMatcher tests (`external/YoutubeExplode/tests/MusicTests.cpp`: ranking fixtures, `normalize` and Unicode titles in Turkish, German, French, Spanish, Vietnamese, Russian, Japanese, Korean), `MatchService::playOrder` / `keepsMatch` (3.4: which candidates a refused best video falls back to, which become the saved match), SoundCloud's pick on titles without their diacritics | offline; `[name filter]` | | `rules_test` | rule-based playlists (`app/RuleLists`, 3.64) and the BPM store (`app/BpmStore`, 3.65): the Tür field (3.79: contains / is / is not over a song's genres, unknown never matches, `refreshGenres` without a merge); definitions round-trip through JSON exactly, hostile / foreign / newer files (unknown fields and operators dropped and counted, limits clamped, the rule cap), de-duplication by id and by song identity across slices and the copy that plays, merged facts, every field and operator (Turkish İ / ı, several artists, unknown values, "never played", playlists, catalogs, BPM), all / any and groups, unfinished rows ignored, sources, every sort key with unknown values last, random orders per day and per song, limits by count and minutes, incremental updates (an identical slice, one slice replaced = one merge, play / liked / downloaded / BPM facts without a merge, revisions, `depsOf`), the BPM store (ids, video, song key, tag over analysis, stamps, forgetting, the file), timings with 5 000 and 50 000 songs | offline; one section by name (`json pool rules order incremental bpm genre timing`) | | `contentfilter_test` | İçerik filtreleri (`app/ContentFilter`, 3.79) and genres (`app/Genres`): the AI list's shapes (CSV with a header, quotes, commas in names, BOM, junk rows; links / URIs / ids per line; Spicetify's / loved.music's JSON), Spotify ids, matching (id only for Spotify credits, weak names for other catalogs, ambiguous / short names, name-only entries), corrections and their file (`.bad`), the policy for off / mark / hide and explicit with the blocklist, picking as Radio / smart shuffle do, search results and cards under "Gizle", the cache files and `fetchAiList` with canned answers (fallback source, 304, a truncated answer), genre keys / labels / tag values / aggregation / the artist-genre store | offline; `live` (fetches the real list once and matches known artists) | | `tempo_test` | the tempo estimator (`audio/Tempo`, 3.65) on synthetic audio at known tempos: click tracks 60-200 BPM and odd tempos, drum loops (rock, four-on-the-floor, ballads, 70-180 BPM), triplet swing, half-time / drum'n'bass / loud sixteenths traps (the tempo or its octave), noise / silence / a held tone (no tempo), a noise floor, 44.1 kHz, a 1 % drift, sub-integer precision, a generated WAV through `analyzeFile` (decoder, seek, downmix), timing; prints every signal's estimate and the accuracy | offline; `file <path…>` (real files: estimate, decode and analysis time) | | `key_test` | the key and energy estimator (`audio/Key`, 3.82) on synthetic audio: chord progressions in all 24 keys, relative major / minor pairs, drums / noise / detuned / other timbres, noise / drums / silence (no key), energy order of quiet / ballad / dance signals, a generated WAV through `tempo::analyzeFile`; key notation (`audio/KeyNotation`: names, Camelot, Open Key, parsing, compatibility); the flow order (`app/SmartOrder`: transition costs, the curve, determinism, unknowns last, the anchor, `movesFor` replayed over random permutations); timing; prints every signal's estimate and the accuracy | offline; one section by name (`notation keys relative robust nokey energy file order timing`); `file <path…>` (real files) | | `artistinfo_test` | concerts, upcoming releases and "Şarkı hakkında" (3.75, 3.76) on captured answers: Spotify's overview concerts + pre-release (and the older `preRelease` shape), `ArtistConcerts`, a concert's offers, Genius' search pick + song page (description cleaning, relation groups, translations out, caps), MusicBrainz recording / work relations (samples / remixes by direction, covers and originals), the Spotify url-rel, future release groups; `app/ArtistEvents` (ISO times with offsets, countdowns, city folding and parsing, the cache round trip, the nearby filter, "Yakında" merging and `dateAhead`, `upcomingOf`) and `app/SongInfo` (the Genius → MusicBrainz chain, merging, caching rules, JSON round trip, keys) | offline (fixtures); `live` (read-only: the logged-out Spotify token, ten artists' overviews with their concerts and announced releases, `ArtistConcerts`, one concert's offers, six songs on Genius and MusicBrainz, MusicBrainz' future release groups and a Spotify url-rel; prints the coverage) | | `automix_test` | AutoMix (3.80) on synthetic music: beat grids at 90-174 BPM after silent / spoken / pad intros and before beatless outros / fade-outs (tempo, beat phase in ms against the truth, downbeats, the steady span, phrase starts; no beat for a pad, speech, silence), plans (mix points on true downbeats, bars, tempo factor, half / double tempo, every refusal), the crossover and the mixer's gains (flat sum, continuity per sample, equal power, the bass swap, release, the tempo ramp), offline renders as the engine does them (heard beat alignment of the two songs' markers, with and without anchors, the bass swap, levels, no step at the start); `engine`: the real `AudioEngine` on generated WAVs at volume 0 read back through the waveform tap (an AutoMix: switch, positions, clock rate, heard alignment; mixes cut short by a speed change, a seek, an open; a crossfade into a song shorter than the fade and into one with no audio: the regressions of 3.4) | default = offline sections (`grids plans mixer render`); `engine` (needs an audio device); `--out <dir>` writes the renders as WAVs; `songs <dir>` writes the app's listen-test songs | | `smartlists_test` | smart lists on synthetic histories: each list's rules and minimums, streams only, podcast / radio ids out, session-based mixes, day seeds, year lists, fresh-song blending, trim, timing with 300 000 plays | offline | | `stats_test` | stream rule, recording, aggregation, persistence, local time (Windows' dynamic zones, DST), heatmap, year summary, Spotify history import (both formats, the ZIP, dedupe, the imported file), an account switch (`detach` / `attach`: stored plays to the old file, the play in progress carried over), timings with 300 000 imported plays | offline | | `userdata_test` | user files (`core/SafeFile`, 3.14): saves keep `.old`, power cuts simulated (a file cut short, zero-filled, only the `.tmp` of a save, a `.tmp` cut short), a damaged file set aside as `.corrupt` and never saved over, reported once, a locked file left alone, tickets (an older save never lands last; 16 threads racing), `keepOld = false`; `Settings` through it; download file names (`core/FileName`: an emoji across the limit, a space / dot at 80, device names, refused and control characters); `downloads.json` records (the user's queued songs kept, the sync's not, older files, shared files, a 0.12 name cut inside an emoji found again); the exit's wait (`ThreadPool::waitIdle`) with a slow fake download holding a service pointer: cancelled, waited for, then freed (no use after free, < 0.5 s), and a task that ignores the cancel timing the wait out | offline (per-process temp folder) | | `sync_test` | download sync: `sync.json` store, downloadable filter, plan (retries, blocked, storage cap), drops, progress, scheduling / backoff, excluded songs (store, filter, include again, old files), Spotify rules bound to their account (listable only with it, the `"acct"` round trip, old files) | offline | | `accounts_test` | several Spotify accounts (3.48): a 0.10 single-account profile migrated in place (cookie, `webview2\`, per-account files moved, shared files left, idempotent), a MusicBrainz-only profile's first login adopting its files (later ones not), leftover login folders, sign out keeping the data, a damaged `accounts.json` rebuilt from the folders, ids that would leave `accounts\`; the `Session` with a fake connect: add a second account (the first stays signed in), leave / enter hooks around the data folder change, quick switch, re-login of a known user, a closed login window, a failed switch, sign out handing over, the next start; connection trouble (3.5): no network at startup (stays `Connecting` + offline, the cookie kept, tries backing off 60 / 120 / 240 ms in the test, at once on `networkChanged()`, also when it arrives while a held try is under way that then fails: connect and renewal), a refused cookie (expired, `onExpired` once, nothing more sent, a new login brings the account back), failing renewals backing off, eight requests answered 401 together sharing one renewal, a refused renewal | offline (per-process temp profile) | | `songnotify_test` | song-change notification (3.49): every rule and their order (in view, Windows' media overlay window, a guest's sync burst, busy, paused, repeat), XML escaping, the cover's file URI, the toast with / without cover and "Beğen", hostile tags, every variant parsed by WinRT's `XmlDocument` | offline | | `history_test` | Last.fm / ListenBrainz import (`app/ScrobbleImport`, 3.55): dates, Retry-After, Last.fm track objects and pages (now playing, images, MBIDs, a single-object page, errors), ListenBrainz listens (mapped artists, artist_names, durations, covers), every export format (lastfm-to-csv, Ghan CSV / JSON, lastfmstats CSV / JSON, the ListenBrainz ZIP / JSONL / old JSON; other files and the other service's left out), fake Last.fm / ListenBrainz servers (oldest-first paging, 429 + Retry-After, error 8, 503, X-RateLimit, the resume overlap, cancel, unknown user / private / bad key / no key / no network), one history from this PC + Spotify + Last.fm + ListenBrainz counted once (pauses, repeats, credit splitting, MBID matching, estimated minutes, removal per source, incremental runs, persistence), resume after a cancel, an account switch (each account's imported files and cursors, a running import stopped into the account left and resumed when back, the superseded result not touching the new account, a pending removal written by `detach`, the pre-filled account), 100 000-scrobble files and `runJob` (time, peak memory) | offline; sections by name (`timing dates records files lastfm lb merge resume accounts`); `live lb <user> [<max>]`, `live lastfm <user> [<max>]` (key in `SHADETUBE_LASTFM_KEY`): a real import into a temp store, then again (only the new) | | `playlist_edit_test` | playlist editing (`app/PlaylistEditing`): multi-selection moves (order, new positions, the anchor row Spotify gets; randomized), undo runs of a removal, cover pictures (centered square JPEG ≤ 256 KB: noise, small, tight budget, files, garbage), local playlists' `library.json` entry and cover files | offline | | `collections_test` | playlist files: M3U8 / CSV / XSPF / JSON round trips, CSV dialects (Exportify, TuneMyMusic, Soundiiz, headerless), formula guard, M3U paths / URIs / links, encodings, durations, 10 000-song timings per format | offline | | `services_test` | Deezer / Apple Music / TIDAL (3.60): every link form (playlists, albums, songs, short links, storefronts, browse / listen / embed hosts) and the Unsupported ones; parsers on recorded answers (`tests/services/fixtures`, cut down by `record_fixtures.py`; the token-carrying bundles are stand-ins with fake values): Deezer header / pages / track / errors, Apple's page data, bundle token, amp-api resources and pages, TIDAL's JSON:API header / item pages / track list / bundle client; `svc::read` on a replaying transport (Deezer paging, Apple through amp-api with its headers, a refused token falling back to the page, TIDAL's token and cursor pages, a refused client replaced by the bundle's, 404s, short links, transport retries); `catmatch` scoring (versions, featuring, live / remix, wrong artist, lengths, Turkish letters, other scripts, albums) | offline; `live <link…> [ytm\|mb\|spotify\|none] [--quiet]` (reads and matches real lists, timings and match rate; `spotify` uses an anonymous web-player token, search only); `live-set [ytm\|mb]` (two public lists per service) | | `lyrics_test` | LRC / Spotify / ID3 lyrics parsers, sidecar + tag lookup, download lyrics frames, the provider chain and its cache, song timeline, offsets, the lyrics picker (LRCLIB search JSON, ranking, previews, picked files, stored choices, fetch() with each pick) | offline; `live [spotify track id…]` (read-only Spotify lyrics requests with the saved `sp_dc`); `search ["text" [seconds]]` (LRCLIB's search as the picker sends it, the first record fetched back by id) | | `lyrictools_test` | lyrics tools (3.58): the synchronizer's draft (text in, blank lines / gaps / pasted LRC, stamping and the cursor, later stamps dropped, back / skip / nudge / clear / undo, text edits keeping stamps, filled-in times, readiness), LRC written and read back, `Offsets::storeText` + fetch() with the file choice, SHA-256 vectors, LRCLIB's challenge (parsing, the target comparison, the smallest nonce of a captured challenge as LRCGET finds it, threads, cancel, try limit), the publish request against a fake transport (body, headers, a token solving the challenge, every answer), Genius' lyrics search on recorded answers (`fixtures/genius_lyric_*.json`: order, translations / weak matches / duplicates out, one- and two-line snippets with highlights, hostile JSON, the request), title folding, `sameSong`, `looksLikeLyrics` | offline; `live` (four Genius searches, read-only, and a real LRCLIB challenge solved; nothing is published) | | `romanize_test` | lyrics romanization (3.63): Korean Revised Romanization through every pronunciation rule implemented, kana → Hepburn (yōon, sokuon, n', long vowels, extended katakana, punctuation), Japanese through a fixture reader (spaced phrases, particles) and without one (kanji kept), Windows' analyzer on this PC (reported, not asserted), Russian / Ukrainian tables and case, script detection, lines left empty, the cache (read back, stale lyrics, Japanese without readings not kept) | offline (own temp profile) | | `lyricsview_test` | the lyrics views' drawing (3.62): `dimAlpha`, `smoothstep`, `LineMotion` (first line at once, changes ease from where they are, settling, reduce motion), `gfx::TextShape` on the real device (a row per visual line, an ellipsis line, emoji refused, `builtFor`, the idle release drops them, built again), its pixels against DirectWrite's outlines and bitmap glyphs at 100 / 125 / 175 % (ink, centroid, partial levels), the karaoke fill's soft edge; the word-by-word fill on a fixture song (3.81: word ranges and times, the front pixel-linear through a word, whole words with reduce motion, wrapped rows, the line sweep, singing / next step, duet sides and anchors, a background-vocal line's pixels) | offline; needs a D3D11 device | | `wordlyrics_test` | word-by-word lyrics (3.81): TTML (fixtures: words, syllables, background vocals, duet voices, inline / head translations, entities, clock forms, Line timing, damaged input), KRC (a download decrypted, word times, credits, `[offset:]`, instrumental, damaged), YRC, enhanced LRC end marks and `toLrc`, `core/Inflate`, `matchScore`, the sources' order setting, the chain through a fake transport (order, cache fields, failures not cached, a switched-off source, Apple's catalogs, KuGou's swapped names, NetEase, one walk for concurrent views, `Choice::Source` and its storage, the picker's search) | offline; `live [n [country]]` (every source asked for 20 popular songs, read-only, hit rates); `krc <download.json>` (decrypts a saved KuGou answer) | | `credits_test` | song credits: role folding and groups, merging, the Spotify credits query and legacy JSON, MusicBrainz recording / work / label relationships, title cleaning and the recording ranking, `app/Credits` (JSON round trip and expiry, the provider chain, memory + disk cache, the summary) | offline (fixtures); `live ["Artist" "Title" [seconds]]` (MusicBrainz search + credits, read-only; Spotify too with `SHADETUBE_SPDC`, track `SHADETUBE_CREDITS_TRACK`) | | `proxy_test` | the app-wide proxy (3.68): SOCKS5 / CONNECT / request and response heads byte for byte, authorities, local names, the bridge against fake HTTP and SOCKS5 proxies (with and without auth: CONNECT, absolute http, https through WinHTTP, raw tunnels, remote names), wrong passwords, dead and wrong-kind proxies (a clear 502, never direct), *Yerel adresleri atla*, live changes ending old tunnels, the WebView2 arguments | offline; `wire` / `bridge` (one part) | | `updater_test` | versions, release JSON, asset choice (the zip, never the setup, in any order), ZIP reader, exe swap, installer + uninstall | default offline; `--e2e <base>` | | `setup_test` | the setup (3.57): payload pack / read / unpack with every algorithm (blocks, a file across blocks, an empty file, progress), damage (a flipped byte, the seal, truncation, garbage), forged but sealed headers (format, names, block count, a file's SHA-256: nothing left behind), cancel, the payload of this build's `ShadeTubeSetup.exe` (its exe byte for byte the build's, passing `verifyExe`); the command line; `actionFor` / `folderFor` / `writable`; in a `SHADETUBE_SETUP_SANDBOX`: a fresh install (files, uninstall key, both shortcuts, Run value + settings.json, a newer version's settings kept), a repair changing the options, an update while this build's app runs from the install folder (it quits gracefully first), a moved install, uninstall keeping / removing the data, `ShadeTube.exe --uninstall --quiet` on a setup install, `ShadeTubeSetup.exe /S` (`/D=` with spaces, `/DESKTOP`, `/UNINSTALL`, 87, 1618) | offline; `payload` / `args` / `engine` / `silent` runs one part; starts the build's app (`--preview`) in the sandbox | | `links_test` | pasted Spotify / YouTube / MusicBrainz links (YouTube playlists, Spotify shows and profiles too), `shadetube://jam/` invites, video title -> song, Spotify base62 <-> gid, track metadata parser | offline; `live [spotify:track:…]` (read-only `Api::track` with the profile's saved `sp_dc`) | | `jam_test` | listen together core: MQTT remaining length + every packet used (byte for byte) + stream decoder + malformed input, broker URLs, SHA-256 / base64url / AES-256-GCM (known answer, tampering, other topic / key), ECDH, envelopes + replay windows + will sequence numbers, invite links, state / request JSON (hostile input), the new-invite hand-off, clock estimator, reconciliation decisions (load / jump / replace / seek / play / pause / holds / fine corrections / lead learning), level 2 (episodes / stations on the wire, what a 0.10.0 parser keeps of them, hostile data, feature level / speed / away, the envelope still at version 1, episodes at the host's speed, stations followed live), the host's saved room (round trip, resume window) + DPAPI, blend invite links, the URL protocol in a test key | offline (own temp profile + test registry key); `live [wss://broker…]` (two clients per broker: retained sealed state to a late subscriber, a request back, clock pings, the last will, a goodbye flushed at stop, clearing the state) | | `blend_test` | Blend (`app/Blend`): song / artist keys, taste profiles (streams only, podcast / radio out, recency, the six-month window and its fallback, caps, weights, features), profile JSON (hostile input), the mix (shared first, then one per member in turn, whose taste, cap, three members, newest profile per member, the same mix in any order), the taste match, the store record, timing with 300 000 plays | offline; `live [wss://broker…]` (two members never online together exchange retained sealed profiles through a real broker and build the same mix; leaving); `retain put <file> [broker]` / `retain get <file>` (how long a broker keeps a retained record) | | `radio_test` | radio-browser.info parsing (fixtures), codec filter, station -> track mapping, genre labels, `radio.json` store | offline; `live` (discovery, lists, failover; never counts a click) | | `liveaudio_test` | live-stream parsers (MPEG / ADTS / ICY / Ogg / TS / playlists / HLS), the engine against `mock_icecast.py` (reconnects, stalls, format changes, HLS, Ogg Opus and Ogg Vorbis when ffmpeg is on PATH), the Player with live items | offline (Python on PATH); `--long`; `live [count]` (real stations, a few of every codec family incl. OGG / OPUS) | | `winshell_test` | jump-list commands, glyph icons, thumbnail buttons, taskbar progress states, the accent-tinted app icon (sizes, colors, the logo's color against `app.ico`, `WindowIcon` on a test window: sizes, no re-render, no leaked handles, class icon back), AUMID / Start menu identity under a test id | default; `--start-menu`; `--icons <dir> [RRGGBB…]` (writes the tinted icon as `.ico` files to look at) | | `smartshuffle_test` | track keys and exclusions, candidate filter, queue insertion points (spacing, window, idempotence), `interleave`, a real `Player` (insert / drop / clear recommendations, session flag) | offline; needs an audio device | | `queues_test` | several queues (3.77): `QueueSet` (add / rename / activate / remove, limits, numbers), its `session.json` part (round trip, damaged lists), a real `Player` on generated WAVs (switch while playing / paused, empty queues, new, move the upcoming songs, delete the active one, shuffle order and repeat per queue, restore after a restart, unshuffle by saved ranks) | offline; needs an audio device | | `stations_test` | radio builder (3.78): the LB Radio prompt, knob → mode → popularity, LB answers from fixtures (JSPF, the 401 body, tag / artist radio, recording metadata), the batch mix (share, era, blocklist, exclusions, duplicates, artist rules, determinism), `stations.json` (round trip, damage, limits), names and keys | offline; `live` (artist / tag radio, metadata, explore's 401 without a token) | | `shortcuts_test` | key combo text form, default bindings, conflicts / reset / normalize, reserved keys, palette fuzzy ranking, the zoom keys' fallbacks on US / Turkish Q / German layouts (layouts it loads are unloaded again) and the zoom steps, the Run value (in a test key) | offline | | `library_test` | Library views (`app/LibrarySort`): settings values, every sort key and its fallbacks, pinned items, stable ties, Turkish collation, folders (in place / first, nesting, expanded, broken chains), the filter (Turkish İ / ı, accents, short queries, creator matches), `library-recents.json` (and its newest entries, Home's hero), history recency, timing with 10 000 items | offline | | `browse_test` | Search and Artist page logic (`app/BrowseModel`, 3.44): recent searches (queries and items, equality by case / Turkish İ / spacing or kind + id, order, the cap, remove / clear, persistence, the v1 file, broken files, unknown kinds), the top result (exact / prefix / word matches, the top songs' artist, MusicBrainz homonyms, ranks, folding), the discography (groups, date and name orders, the newest release, release kinds, MBIDs) | offline (own temp folder) | | `preview_test` | song preview: the press-and-hold gesture (`ui/HoldGesture`: due time, slop, early release, swallowed release, Esc), `preview::startPoint` (short / unknown songs, 35 %, SponsorBlock segments, the end), `preview::Session` with a fake player and clock (modes, release before the audio, the limit, Esc, the key's toggle, the song that plays, collections + cache, failures, timeouts, rapid repeated holds, stale ids), a real `Player` on generated WAVs (the current track holds its position and state and resumes from it, paused stays paused, nothing playing stays so, stopped before its audio = never held, rapid previews, a command ends it first, its own end hands back, `keepMainRunning`, 1.5x speed, stations refused, queue untouched) | offline; needs an audio device | | `theme_test` | theme studio core (`gfx/ThemeSpec`, `app/ThemeStore`): strict color syntax, the tokens files as themes, every bundled preset (no warnings, strict parse, keys match the palette, write / read round trip, the full contrast table), key-color derivation and `setKey`, accent adaptation and ink / paper, import validation (every refusal kind, too large, keys-only files, base guessing, names), the theme folder (save / reload / numbered names / remove / import / export / broken files left out), slugs | offline (own temp folder; reads the source tree's `assets/`) | | `header_collapse_test` | collapsing page headers (`app/HeaderCollapse`) on real header geometries (album, two-line playlist with a description, podcast, artist): at offset 0 everything is where the expanded header draws it, no element jumps between offsets 1/4 DIP apart, scrolling down only collapses, content never shows through the cover / title (it has dissolved where it passes under them), the docked frame (thumbnail, compact title on the bar's line, buttons, inset, hairline), the settling function, the tint's contrast on dark and light paper | offline | | `miniplayer_test` | the mini player's geometry (`app/MiniLayout`): mode ids and sizes, the anchor (corners, edges, thirds, negative monitors), anchored resizes and exact round trips, snapping (margin, threshold, nearer side, corners, far away untouched), fitting into a work area, the default place, square resizing from every corner / edge (opposite corner fixed, limits, always square), the switch animation's rects, saved places | offline | | `scroll_test` | smooth scrolling (`ui/ScrollPhysics`) stepped with explicit times: a notch glides monotonically without overshoot (95 % in 120-250 ms), retargeting keeps position and velocity, slow notches add up exactly and fast ones accelerate gently (capped), reversing starts from the current position, spinning into the end never passes it, overshoot after a change of feel stops hard at the bound, shrinking bounds clamp, touchpad deltas move 1:1 with ~1 frame of lag, the same input at 60 / 144 Hz / uneven frames gives the same positions, key repeat, feel order, reduce motion, `SmoothScroll` requests frames only while moving, `wheel::step` follows the system setting | offline | | `nowplaying_test` | Now Playing's backdrop colors (`app/CoverGradient`): palettes of two / three-color covers (largest first, a vivid 4 % speck kept), one-color and grayscale covers padded, the dark / light tokens' contrast band (fg.primary 7:1, fg.secondary 4.5:1) and a custom palette never made stricter than its base, every texel of 7 200 fields from random palettes (white, black, primaries, mid cross-fade) inside the band, fg.tertiary lifted to 3:1, 83 ms of drift moving no texel more than 2 levels, timing of a 144 × 90 field and a palette | offline | | `pagetx_test` | page transitions (`ui/PageMotion`) stepped with explicit times: durations 180..240 ms, Push (outgoing fades / shifts out, incoming slides in, both monotonic and exact at the end), Back mirrored, shared / Replace without offsets, the cover's flight (lands exactly, even on a moving target, no overshoot, radius morph), the hand-over, holding for an image (no frames; image / scroll / timeout end it), fading when the target goes, 60 / 144 Hz give the same positions | offline | | `popups_test` | the overlay family (3.36) on a hidden window over a red / blue page: menu keys (wrap over disabled items and separators, Home / End, Tab, Enter, Escape), separator tidying, submenus by key (Right / Enter / Left / Escape, parent item lit) and by pointer (200 ms open, 300 ms close, click), type-ahead (accents, cycling), long menus (inside the window, End / Home / Down glide the lit item into view, the wheel scrolls the panel; a filterable one: the field has the focus, queued keys type into it, accents ignored, the pinned item stays, Space types, Enter runs the first match; as a submenu the focus goes back on Escape), one acrylic capture per opening and one per settled change behind (never per frame), the material showing the page while `fg.secondary` keeps ≥ 4.5:1 (dark and light), close animations (painted without input, then deleted, backdrop freed; none with reduce motion), toast stacking, dialogs (Enter, Escape; a destructive confirm's Enter dismisses, Tab and Enter destroys); `SHADETUBE_ACRYLIC=off` in a child process (no capture, even surface) | offline; `opaque` (the child's mode) | | `textedit_test` | text editing (`ui/TextEdit`, `ui/TextBox`): grapheme clusters with Windows' ICU and with the built-in rules (emoji with skin tones / ZWJ, flags, combining marks, Hangul jamo, never inside a surrogate pair), Backspace, word moves, the undo history (typing grouped into words, a run of Backspaces, caret and selection restored, redo dropped by a new edit, the step limit), a `TextBox` on a hidden window (a surrogate pair typed as one character, Ctrl+Z / Ctrl+Y, AltGr+A types instead of selecting all), `caretRect` for the input method | offline | | `gpuloss_test` | GPU device loss (3.3) with `SHADETUBE_GPU_LOSS=create:1,resize:1,present:3` on a hidden window: the device is recreated (generation counted) at each point and nothing throws; a widget that throws while painting drops its frames without ending the program (`Window::failedFrames()`) and the window draws again once it stops | offline (needs a D3D11 device) | | `queueundo_test` | undoing *Sırayı temizle* (`Player::restoreOrder`, 3.47) on a real `Player` with generated silent WAVs at volume 0: the old order back with the same slot playing, songs added since after it; refused for a bad order, a command filter that takes it and a new queue | offline; needs an audio device | | `review_test` | year in review (`app/YearReview`) on fixed synthetic histories: periods (a year, the last 12 months, a running year), time / streams / tops and their order, months, weekdays, hours (a play across midnight split), dayparts, 7-day blocks, streak, busiest day, discoveries, first stream, local days on another time zone, genre shares / coverage / minimum, which periods qualify, timing with 300 000 plays | offline | | `video_test` | video mode: picture stream choice on manifest fixtures (cap, H.264 first, VP9 / AV1 only with a decoder, fps, upscales, portrait, muxed fallback), the still-picture check, the sidx / edit-list index on made-up boxes, the A/V scheduler on a fake clock with a fake decoder (1× / 0.5× / 2× / 3× in sync to a frame, pause, seeks both ways, a decoder that can't keep up, the video ending first), a generated H.264 MP4 decoded in software and with DXVA + the video processor (every frame's colors, seeks, 2×, the idle release); the official video (3.42): the alignment on synthetic songs (an intro, another master, a 0.3 % speed difference, an insert, a cut, repeated choruses, a silent start, another song, two live takes, a reordered edit, too short), the time map, YouTube Music search fixtures and the ranking, the decision cache | offline; `official` (only the official video's checks); `live [<id>…]` (the picture streams and still-picture verdicts of songs as MatchService matches them, one stream played on the GPU against a real-time clock, a seek); `play <id>`; `fetch <id> <file>`; `file <path> [<start s>]`; `mfurl <path>` (MF's own source on a file); `officiallive <artist> <title> <upload id> [codec]` (the whole lookup on YouTube, with the waveform reference); `soundtrack <id> <file> [codec]` (12 kHz mono f32); `alignraw <a.raw> <b.raw>` (`VIDEO_TEST_WINDOWS=1` lists every window) | | `remote_test` | phone remote: HTTP parser (partial / pipelined input, limits, malformed requests), SSE framing, tokens / SHA-256 / base64url, User-Agent names, the DPAPI device store (pairing, good / bad / rotated / revoked tokens, persistence, device limit), the throttle, routes (assets, ETags, Host check, auth, 429, validation), theme.css, state / queue JSON, adapter ranking, a live server on 127.0.0.1 (WinHTTP + raw sockets: keep-alive, pipelining, 408 / 413 / 431, event stream, ticks, heartbeats, revocation, ports in use, stop) | offline; `http` / `sse` / `auth` / `router` / `state` / `lan` / `live` runs one part | | `audiocache_test` | song cache (`player/AudioCache`, 3.45): profiles / formats / offline fallbacks, what is not cacheable, the index across runs (match, loudness, tracks, SponsorBlock data); `.part` leftovers, orphans, gone / short files, damaged head / tail / sampled block / truncation dropped at lookup; LRU under a small limit, a lower limit, the quarter rule, off, a nearly full disk (free-space probe); `ProgressiveBuffer`'s completion hook against an in-process ranged HTTP server (exact bytes once, after a far seek, never when cancelled); the engine storing a streamed WAV and playing the file; a real `Player` with `SHADETUBE_OFFLINE` (cached songs with their match, a gapless preload from the cache, crossfade, a preview, another quality once resolving fails, a seek made while a song or a podcast episode resolves, a simulated device outage keeping the song and its cache file, a damaged file dropped) | offline (own temp profile); needs an audio device | | `cast_test` | cast to device (3.74; `app/Cast*`, `audio/MediaFeed`): the XML reader (entities, CDATA, BOM, malformed / too deep documents) and escaping; SSDP M-SEARCH bytes and answers (USN uuid, non-answers); the mDNS PTR query's bytes and answers with name compression (PTR / TXT / SRV / A) -> Cast devices (TV / speaker / group, the sender's address without an A record; compression loops, pointers past the end, truncation); device descriptions (a TV, a Sonos ZonePlayer with its embedded MediaRenderer and roomName, URLBase, relative control URLs, a NAS without AVTransport), URL resolution, SOAP envelopes with DIDL-Lite escaped twice, answers and UPnP faults, DIDL-Lite (musicTrack / audioBroadcast, res protocolInfo and duration), UPnP times, sink protocol lists and their MIME aliases, protocolInfo / DLNA flags; CASTV2 CastMessage bytes (a known PING), decoding (long / binary payloads, unknown fields, wire type errors), frames fed byte by byte / two at once / oversized / malformed; the media server on 127.0.0.1 (GET / HEAD / OPTIONS / POST, ranges `a-b`, `a-`, `-n`, past the end, 416, unknown units, keep-alive, the DLNA and CORS headers, wrong tokens, unpublish / retainOnly, stop); MediaFeed on a generated WAV (the original bytes, decoded WAV with its header and L16 big-endian, seeks forward / back / mid-frame, the end, cancel, a file that isn't audio); `UpnpRenderer` against an in-process mock renderer that fetches what it is given (connect: sink list and volume; load + play with metadata, SetNextAVTransportURI and the gapless advance, seek, pause without extrapolation, volume, the end, a stop at the device = paused and resumed where it was, a 714 refusal = a format failure, a device without SetNext, close = Stop and no loss, a mock that goes away = lost, a device that isn't there, an end seen only by a late poll = still an end); the real `Player` with a fake `RemoteOutput` on generated WAVs (this PC's volume 0): AutoMix off while casting (nothing prepared 60 s before the end, the next song 20 s before with `crossfadeMs` 0, the device's gapless move, no AUTOMIX badge), queue switches (a new / paused queue stops the device, a playing one opens there at its own position, deleting the active queue), the device lost (paused here at its position) and back to the device | offline; `xml` / `ssdp` / `mdns` / `upnp` / `castv2frames` / `server` / `feed` / `upnpmock` / `player` runs one part; `discover [ms]` (live, read-only: the interfaces and what answers SSDP / mDNS on this network); `castv2 <ip:port>` drives `CastV2Renderer` against an external CASTV2 mock (TLS): connect, launch, load at a position with metadata, pause / seek / play, volume, the end, a LOAD_FAILED, close = receiver STOP | | `lists_test` | list geometry (3.47): the track table's columns at every width 300-1600 DIP in both densities (fixed right end, order, no overlap, the title minimum, columns only ever dropping in the documented order, the queue action last), `Settings::trackColumns` parsing, selection runs, the queue's sections (runs, header rows, positions, hit tests on rows and headers, drop slots, 5 000 slots), the skeleton band | offline | | `memory_test` | memory housekeeping (3.2) on the real graphics device: `ImageCache` buckets (a 300 px request decodes at 384, never above the picture's own size), expiry (kept when painted in the last frames, on the current or the previous page scope or within the idle time; dropped otherwise, bytes given back, loaded again when painted), failed loads tried again with a fake clock (30 s doubling to 5 min; 404 and undecodable pictures 10 min doubling to 1 h; the connectivity hint makes the passing ones due at once), accent requests answered for an entry loaded without a vivid color and for one already known, `Icons::drawColored` above 96 px painting from the document with no bitmap per size, `Device::trimPool` (released bitmaps come back only through it; numbers printed), `MemoryStats::detailedReport`, `ListenStats::readFile` leaving no capacity slack | offline (own temp folder and profile) | | `micro_test` | micro-interactions (`ui/Micro`, 3.32): the gate (reduce motion, Windows' animation effects), `HoverFade` (fade in ~120 ms, the row left fades out from where it was, going back resumes, instant without micro, no frames once settled), the equalizer clock (1:1 while playing, slows to a stop within 240 ms and stays frozen without asking for frames, resumes, 100 ms gap cap, one advance per frame), bar levels (range, never flat, moving; a still pose without micro), `HeartPop` (pop ≤ 116 %, fill grows, burst, settled after 220 ms; unlike dip), the card lift | offline (busy-waits ~2 s for the real-time fades) | | `recognize_test` | song recognition (3.59): base64 / CRC-32, the signature of a synthetic signal with known peaks (bands, frequencies, times, levels, feeding patterns, silence), the binary format (header fields, the pass escape, padding, damaged bytes, the `synthetic.uri` fixture), recorded service answers and odd shapes, the request body, the session on test audio with a fake service (silence, the 4 / 7 / 11 s schedule, a match, an unsure answer confirmed / standing alone, 429, no network, `stop()` with a request out), catalog matching (folding, artist credits, prefixes), the `recognized.json` store | offline (own temp folder); `live <file> [start] [s]`, `yt "Artist - Title" [start] [s] [--wav out]`, `songs [--short] [--snr dB] "…"…` (requests 20 s apart, `RECOGNIZE_GAP`), `noise`, `dump <file\|query\|noise> <out.json>`, `capture <system\|mic> [s]` (a real session), `level <system\|mic> [s]` (the capture alone, nothing sent) | | `visualizer_test` | the visualizer's analysis (`audio/VisualAnalysis`, 3.61): band edges (contiguous, increasing, the interpolated ones only at the low end, at 44.1 / 48 / 96 kHz), a sine at each band's centre in that band or its neighbour, levels in dB, `sampleAt`, a 60 Hz → 12 kHz sweep moving the loudest band only up, beats on synthetic music (drums, bass, chords, arpeggio) at 90 / 120 / 140 BPM read at 60 / 144 / 240 frames/s, with 10 and 20 ms engine blocks and at 44.1 kHz (every kick once, 0-90 ms late, nothing else, the same beats at every rate), no beats in an intro without drums, a held chord, a sine or silence (white noise: at most one stray beat in 7 s), the beat pulse's decay, settling when paused (peaks hold, then fall; at rest within 1.5 s), the oscilloscope's trigger (a tone stands still) and gain, timing | offline; `wav <file> [s]` writes the synthetic song (48 kHz stereo) for the app | | `icons_test` | the icon set (3.43) through `gfx::Icons`: every file in every grid (viewBox = grid, path / rect / circle only, black only, the grid's stroke width, parsed by `ID2D1SvgDocument`, no `-thin` files), the grid order and legacy names, `-thin` aliases drawing the same masks, whole-pixel strokes at each grid's own size, the ink of a stroke from 9 to 36 px (≥ 1 px, then px / 16), `heart-filled` covering `heart`, the `downloaded` check cut out | offline; `--sheet <dir>` (contact sheets: all icons at 12-24 DIP × 80-175 % in dark / light / nord / pastel / sepia, each grid magnified, off / on pairs) | | `homecontrols_test` | Customize Home (`app/HomeLayout`, 3.69): `arrange` keeps the user's order and puts unseen ids after their natural predecessor, `move` with saved ids not on the page (they keep their neighbours), duplicates, the order cap, hide / show, pins (newest first, kinds, duplicates, Liked Songs without an id, the cap), `reset` keeps the pins, JSON round trip, wrong-typed fields, a damaged file (kept as `.bad`), the store (saves, `revision`, subscribers while their owner lives, another account's file); snoozed songs (`app/Snooze`, 3.71): by id and for another release (title + first artist, durations within 3 s, another catalog), `daysLeft`, expiry on an injected clock, a second snooze, unsnooze / remove, the file, the skip predicate; private session (`app/PrivateSession`, 3.72): every recorder, the six-hour end (`tick`), a restart in a timed session, "until the app quits", an untrusted saved end, listeners; headphones and calls (`app/AudioFocus` rules, 3.70): headphones → speakers pauses, the other moves play on, the device in use going away, a picked device, resume only when asked / in time / untouched, calls in every mode | offline | The update path end to end: `powershell -ExecutionPolicy Bypass -File tests\updater\run_e2e.ps1 -BuildDir build\Debug` serves the package from `dist\` (and broken variants) through `tests/updater/mock_server.py` and runs `updater_test --e2e` on exe copies in `%TEMP%`. `tests/updater/make_fixture.ps1` regenerates `fixtures/sample.zip`. Listen together end to end (3.24): two sandbox profiles, each with its own `SHADETUBE_INSTANCE_CLASS` / `SHADETUBE_INSTANCE_MUTEX` so second launches reach them. The host: `SHADETUBE_JAM_HOST=1`, `SHADETUBE_JAM_INVITE_FILE=<file>`, `ShadeTube.exe --play "Artist - Title"`; the guest: `SHADETUBE_JAM_JOIN=<link>` (or a running guest gets `ShadeTube.exe --open-link <link>`). Then `--command play-pause` / `next` to the host (or the guest with `SHADETUBE_JAM_DEV=control` on the host), `--open-link <YouTube URL>` to the guest (a song it adds) and `SHADETUBE_JAM_DEV=rotate@45,kick@80`; both logs (`jam` lines) say what each side did: `host: state rev …`, `guest: load / jump / seek / play / pause`, `guest: following "…": drift +31 ms`. Episodes and stations (3.51): `--play-episode "<feed>#0@120"` (+ `SHADETUBE_VIDEO_DEMO=speed@25000=1.5`) or `SHADETUBE_PLAY_STATION=<name>` on the host. Restarts: `SHADETUBE_JAM_DEV=quit@<s>` on the host (or a guest), then start it again without the session variables: `host: resumed room …` / `guest: the host is back` / `guest: joining the session again`. A host launched with `--preview` doesn't hold the single-instance mutex, so a later `--command` launch for that profile starts a second instance (which then resumes the same room): give the host no `--preview` when it should take `--command`s. Old peers: the released 0.10.0 exe (`dist\ShadeTube-0.10.0-win64\ShadeTube.exe`) on a third profile. Blend end to end (3.50): two profiles with listening history (`SHADETUBE_IMPORT_HISTORY` with a synthetic Spotify history, then close the app), `jamName` set in each `settings.json`. A: `SHADETUBE_BLEND=create!`, `SHADETUBE_BLEND_INVITE_FILE=<file>`, close it; B: `SHADETUBE_BLEND=<link>!`; A again (its visit 20 s after startup reads B): both `blend` logs name the same mix and order fingerprint. `--route smart:blend:<id>` (the id is in the log) opens the page. ### 5.3 Dev flags (ShadeTube.exe) | Flag | Effect | |---|---| | `--preview` | open the shell without the connect screen (no Spotify session needed); skips the single-instance check | | `--login` | open the Spotify WebView2 login window at startup | | `--play "Artist - Title"` | play a synthetic track through the real match + stream pipeline | | `--download "Artist - Title"` | queue a real download | | `--open-link <url>` | open a pasted link (Spotify / YouTube / MusicBrainz / `shadetube://jam/` invite) once a saved Spotify session has connected; with an instance running (not `--preview`) the link is handed to it | | `--route <r>` | start page: `search`, `search:<query>`, `library`, `library:albums` / `artists` / `history`, `library:folder:<id>`, `liked`, `downloads`, `stats`, `local`, `local:<view>` (`songs`, `albums`, `artists`, `folders`, `folder:<path>`), `settings`, `settings:<card>` (that card opened and scrolled into view: `spotify`, `connections`, `playback`, `lyrics`, `audio`, `appearance`, `window`, `keyboard`, `downloads`, `local`, `storage`, `remote`, `jam`, `blocklist`, `about`), `nowplaying`, `lyrics` (full-screen lyrics over Now Playing), `connect`, `playlist:<id>`, `album:<id>`, `artist:<id>`, `profile:<spotify:user:…>`, `podcasts`, `podcasts:<route id>` (`podcasts:spotify`, `podcasts:spotify:show:<id>`...), `smart:<list id>` (`smart:mix:1`, `smart:month`, `smart:year:2025`...), `jam` (the "Birlikte dinle" panel), `queue` (the queue panel) | | `--play-episode "<feed URL>[#n][@sec]"` | play podcast episode n (0 = newest) of a feed through the real pipeline, seeking to `sec` once it plays | | `--mini` | open the mini player at startup (with `--screenshot` the mini player is captured; `SHADETUBE_MINI_MODE` / `SHADETUBE_MINI_DEMO` pick its mode and drive it, 5.4) | | `--theme dark\|light\|system` | theme for this run only (not saved) | | `--theme-at <ms> <mode>` | live theme switch after `<ms>` | | `--toast-at <ms> <text>` | show a toast after `<ms>`; `!` prefix = error, `~` prefix = hide all windows first and send it 3× (tray routing) | | `--screenshot <ms> <file.png>` | render the window to PNG after `<ms>` and exit (used for the pictures in `site/img/`, which the READMEs show too) | | `--crash-test` | crash right after startup to check crash reports | | `--palette [query]` | open the command palette at startup, optionally with `query` typed in | Used by the app itself: `--autostart` (the *Start with Windows* Run value), `--restart-after <pid>` (language change), `--installed` / `--updated` (notice after an install or update; the setup starts the app with them), `--uninstall [--quiet]` (Windows' *Installed apps*). The setup's own switches and dev flags (`--screenshot`, `--page`, `--theme`, `--scale`, `--lang`) are in 3.57. ### 5.4 Environment variables | Variable | Effect | |---|---| | `SHADETUBE_DATA_DIR` | profile folder instead of `%LOCALAPPDATA%\ShadeTube` (app and tests) | | `SHADETUBE_EXCLUSIVE` | `1` / `0`: WASAPI exclusive mode on / off whatever the setting (3.53; the Player test programs and sandboxed app runs) | | `SHADETUBE_AUDIO_OUTAGE` | `<from ms>-<to ms>`: a simulated audio device outage that long after startup (`audio/WasapiOutput`): opening the device fails as if another app held it exclusively and a playing stream as if it was unplugged (3.4 Failures; the tests call `WasapiOutput::simulateOutage`). E.g. `4000-9000` with `SHADETUBE_PLAY_FILES` | | `SHADETUBE_I18N_DIR` | folder with `<code>.json` read instead of the embedded translation | | `SHADETUBE_FORCE_ALT=1` | skip YoutubeExplode while a backup source is set (tests the Piped / Invidious path) | | `SHADETUBE_OFFLINE=1` | the shared transport (`http::client()`, `getLimited()`: YouTube, SponsorBlock, covers, Spotify, lyrics, MusicBrainz) goes through a proxy name that never resolves, so every request fails as on a PC without a connection (the song cache's offline plays, 3.45). The engine's stream downloads and the private WinHTTP sessions (backup servers, radio, podcasts, listen together) are not affected | | `SHADETUBE_UPDATE_URL` | replaces the GitHub latest-release URL (mock server) | | `SHADETUBE_VERSION_OVERRIDE` | pretend the running exe has this version (update tests) | | `SHADETUBE_INSTALL_DIR`, `SHADETUBE_SHORTCUT_DIR`, `SHADETUBE_DESKTOP_DIR`, `SHADETUBE_UNINSTALL_KEY` | installer locations (key always under HKCU) | | `SHADETUBE_SETUP_SANDBOX` | `<folder>`: the setup (and anything it starts) installs into that folder and `HKCU\Software\ShadeTubeSandbox\<id>` only: sets the installer locations above, `SHADETUBE_RUN_KEY`, `SHADETUBE_DATA_DIR` and the instance class / mutex (3.57) | | `SHADETUBE_INSTANCE_CLASS`, `SHADETUBE_INSTANCE_MUTEX` | how the uninstaller recognizes a running ShadeTube | | `SHADETUBE_SPDC` | `sp_dc` cookie for the live `spotify_test` modes (never printed) | | `SHADETUBE_DISCORD_APPID` | Discord application id for `scrobble_test`'s live presence | | `SHADETUBE_APP_ID` | Linux: the GtkApplication / D-Bus name instead of `io.github.shadesofdeath.ShadeTube` (a second instance beside a running one, tests; 3.86) | | `SHADETUBE_AUTOSTART_DIR` | Linux: the folder of the autostart entry instead of `~/.config/autostart` (3.86); without it a sandbox profile never touches the real entry | | `SHADETUBE_LOGIN_URL`, `SHADETUBE_LOGIN_COOKIE_URL` | Linux: the sign-in window's start page and the URL whose cookies are read, instead of Spotify's (a local test page; 3.86) | | `SHADETUBE_RUN_KEY` | HKCU key used instead of `…\CurrentVersion\Run` for *Start with Windows* (its `StartupApproved` stand-in is a subkey); without it a sandbox profile never touches the real value | | `SHADETUBE_DRAG_DEMO` | `x,y[,queue][,drop]`: 2.5 s after startup drags the first Liked Songs to window DIPs x,y and holds (for `--screenshot`) or drops them a second later; `queue` opens the queue panel first | | `SHADETUBE_DRAG_DEMO_FILES` | `path\|path`: with `SHADETUBE_DRAG_DEMO`, drags these files / folders as if from Explorer (a playlist file opens the import preview) | | `SHADETUBE_PLAY_FILES` | `path\|path`: plays these audio files / folders at startup as if dropped on the window (a track playing in a sandbox, e.g. generated WAVs next to a `cover.png`) | | `SHADETUBE_PLAYER_DEMO` | `<step>;<step>…`, each `<action>@<ms>[=<arg>]` run `<ms>` after startup: `play`, `pause`, `next`, `prev`, `like` (the current song), `seekfocus` (keyboard focus on the seek wave), `seek=<seconds>`, `hover=<x>,<y>` (a simulated pointer at window DIPs, e.g. over the seek wave or the play button). With `--screenshot`: `seek@2500=70;pause@3000`, or `next@4500` and a capture at 4620 ms for the middle of a track change | | `SHADETUBE_IMPORT_HISTORY` | `<file>[;<file>…]`: import these Spotify history files (JSON / ZIP) once the stats are loaded | | `SHADETUBE_IMPORT_SCROBBLES` | `lastfm:<user>`, `listenbrainz:<user>`, `lastfm-file:<file>[;<file>…]` or `listenbrainz-file:<file>[;<file>…]`: that import once the stats are loaded (3.55; Last.fm uses the stored API key) | | `SHADETUBE_IMPORT_DIALOG` | `lastfm` or `listenbrainz`: that import dialog opens once the stats are loaded (screenshots) | | `SHADETUBE_LASTFM_KEY` | a Last.fm API key for `history_test live lastfm` (never printed) | | `SHADETUBE_STATS_VIEW` | the Stats page opens on `7d`, `30d`, `all`, `year` or `year:<YYYY>` (screenshots) | | `SHADETUBE_STATS_SCROLL` | the Stats page opens scrolled down this many DIPs (screenshots of the lower sections) | | `SHADETUBE_LIBRARY_VIEW` | `<grid\|list>[:<recents\|added\|alpha\|creator>[:<filter>]]`: the Library page's view, sort and search (not saved) | | `SHADETUBE_LIBRARY_SCROLL` | the first Library page opens scrolled down this many DIPs | | `SHADETUBE_LIST_DEMO` | `<step>;<step>…` run 900 ms after the first track table of the run got rows (3.47): `select=1,3-5` (display rows), `sort=<title\|album\|added\|duration\|plays>[:desc]` (as a header click), `columns=<Settings::trackColumns>`, `next=<rows>` / `enqueue=<rows>`, `queue` (opens the queue panel), `scroll=<dips>`, `dragline=<row>` (the selection shown dragged in front of that row), `fakeplays`. E.g. `local:songs` with `SHADETUBE_PLAY_FILES` and `next=3,4;enqueue=10,11;queue` for the queue's sections | | `SHADETUBE_BPM_FAST` | `1`: the BPM worker (3.65) starts at once instead of a minute after startup and analyses back to back (0.5 s apart instead of 12 s): measurements, screenshots of the BPM column | | `SHADETUBE_TEMPO_DEBUG` | `1`: the tempo estimator prints its candidates to stderr (`tempo_test file <path>`: the comb peaks, the autocorrelation at P, P/2, 2P, 3P/2, 2P/3) | | `SHADETUBE_KEY_DEBUG` | `1`: the key estimator prints the best two keys, the chroma's contrast and tuning, the chroma and the bass chroma to stderr (`key_test file <path>`) | | `SHADETUBE_MEMLOG=1` | logs where the memory is every 2 s (`mem` lines; see 3.2) | | `SHADETUBE_MEM_DEMO` | `<action>@<ms>[=<arg>];…` or the path of a file of such steps (`;` or new lines, `#` comments), each run `<ms>` after startup (app/MemDemo.h): `route=<r>` (the `--route` forms), `back`, `forward`, `wheel=<n>` (n notches down, negative up), `np`, `npclose`, `next`, `viz` (the visualizer opened / closed), `fullscreen`, `windowed`, `tray`, `show`, `minimize`, `restore`, `mini`, `miniclose`, `trim` (App::trimMemory), `gputrim` (`Device::trimPool`), `gpuclear` (Direct2D's `ClearResources`), `d2dcache=<MB>`, `report[=<label>]` (a categorized report appended to `logs\memreport.txt`, 3.2), `frames=<label>` (only the frame times since the last report), `quit`. E.g. `route@4000=local:songs;wheel@5000=40;report@20000=songs;quit@21000` | | `SHADETUBE_MEMPROFILE=1` | in a `-DST_MEMPROFILE=ON` build only: tallies the live `operator new` bytes by call stack; `report` steps then list them by allocating function and stack (3.2). Absolute numbers of such a run are inflated (headers, the table, DbgHelp's symbols after the first report) | | `SHADETUBE_FRAME_TEST=extend` | Every `DwmExtendFrameIntoClientArea` of the app extends the frame over the whole window and the hook check says yes, as with Windhawk's Translucent Windows (3.3, issue #6): with Mica on, Windows' own caption buttons take the place of ShadeTube's | | `SHADETUBE_BACKDROP=force` | Mica (3.3) also with transparency effects off or high contrast on (Windows 11 22H2+, the setting still on): DWM then draws Mica's solid fallback color, which still shows the translucent rendering. With Mica on, `--screenshot` PNGs carry the translucent alpha | | `SHADETUBE_CAST_DEVICES` | `dlna:<description URL>;cast:<ip>[:port][=Name];…`: these devices instead of discovery (mock renderers: nothing on the network is searched or touched; 3.74). A DLNA entry is described at the search, a Cast entry is taken as given | | `SHADETUBE_CAST_BIND` | the cast media server listens on (and announces) this IPv4 address instead of the one that routes to the device (`127.0.0.1` with local mocks: no Windows Firewall prompt) | | `SHADETUBE_CAST_DEMO` | `<step>@<ms>[=<arg>];…` run `<ms>` after startup (3.74): `picker` (opens the device picker), `scan`, `connect=<index or name>` (of the devices found), `local` (back to this PC), `play`, `pause`, `next`, `seek=<ms>`, `volume=<0..100>`, `status` (logs the player's state, position, volume and the link), `quit`. E.g. `scan@1500;connect@3000=0;seek@8000=20000;local@30000;quit@35000` with `SHADETUBE_CAST_DEVICES` and `SHADETUBE_PLAY_FILES` | | `SHADETUBE_CAST_SCAN_MS` | how long a device search listens (default 3000) | | `SHADETUBE_REMOTE_BIND` | the phone remote listens on this IPv4 address only (e.g. `127.0.0.1`: no Windows Firewall prompt while testing) and the QR code points at it | | `SHADETUBE_TAG_EDITOR` | `<n>` or `<first>,<n>`: opens the tag editor for n Yerel dosyalar songs (from index `first`) once the library has loaded (screenshots) | | `SHADETUBE_JAM_HOST=1` | starts a listen-together session at startup (3.24) | | `SHADETUBE_JAM_INVITE_FILE` | `<path>`: the host writes its invite link there (and again when it changes) | | `SHADETUBE_JAM_JOIN` | `<invite link>`: joins that session at startup (a guest in a second sandbox profile) | | `SHADETUBE_JAM_DEV` | host: `control` (guests may control playback), `rotate@<s>` (new invite link after `<s>` s), `kick@<s>` (removes the first guest); either role: `quit@<s>` (the app quits `<s>` s into the session: restart tests, 3.51) | | `SHADETUBE_PLAY_STATION` | `<name>`: plays the most clicked playable radio-browser.info station of that name at startup (3.51) | | `SHADETUBE_BLEND` | `create`, `<blend invite>`, `refresh:<id>` or `leave:<id>`, 6 s after the blends are loaded; a trailing `!` agrees without the consent / confirm dialogs (3.50) | | `SHADETUBE_BLEND_INVITE_FILE` | `<path>`: a blend created with `SHADETUBE_BLEND` writes its invite link there | | `SHADETUBE_KEYS_DEMO` | `<ms>:<combo>[,<combo>…]`: presses these key combos (text form: `Ctrl+NumAdd`, `Ctrl+Shift+4`) through the main window's shortcut dispatch, the first after `<ms>`, then every 300 ms; `action:<id>` runs that action (e.g. `action:compact-lists`). For `--screenshot` checks of the zoom badge / live relayout | | `SHADETUBE_SCROLL_DEMO` | `<steps>[@x,y]`: 2.5 s after startup posts wheel / key input to the window at window DIPs x,y (default: 60 % across, middle) from a timer thread, at real device rhythm, and logs every frame of each moving `ScrollView` once done (`scroll` lines: frame gap, offset, step, velocity, target, feel, frame CPU so far) plus a summary per view (frames, gaps over 1.5× the median, longest gap, direction changes, largest speed change between frames). Steps, comma separated (default `notch,spin,touch,keys`): `notch` (6 notches 140 ms apart), `spin` (24 notches 20 ms apart, then 3 back), `touch` (a precision-touchpad swipe with inertia, then one back), `keys` (PageDown ×2, End, Home, Down ×8 repeated), `end` (80 fast notches into the end, 80 into the top). Use with `--route` and `--screenshot`; hover refresh is off meanwhile | | `SHADETUBE_PROTOCOL_KEY` | HKCU key used instead of `Software\Classes\shadetube` for the URL protocol (tests); without it a sandbox profile never registers it | | `SHADETUBE_SETTINGS_OPEN` | `all` or a comma list of card ids (`audio,keyboard`): those Settings cards start open (screenshots; 3.26) | | `SHADETUBE_SETTINGS_SEARCH` | text typed into the Settings search box when the first Settings page opens (screenshots) | | `SHADETUBE_SETTINGS_SCROLL` | the first Settings page scrolls down this many DIPs once laid out (after a deep link's jump) | | `SHADETUBE_SIDEBAR_W` | `<DIPs>` (200-420) or `rail`: the sidebar's width / icon rail for this run (screenshots); nothing is saved | | `SHADETUBE_VIZ_MODE` | `bars`, `ring`, `wave` or `aurora`: the visualizer's mode for this run (not saved; 3.61) | | `SHADETUBE_VIZ_LOG=1` | while the visualizer is open, logs every 5 s its mode, size, frames/s, paint time, analyses/s and backdrop renders/s (`visualizer` lines) | | `SHADETUBE_VIZ_SHOTS` | `<folder>;<ms>;<count>;<gap ms>`: once the visualizer has been open `<ms>`, writes `count` frames `gap` ms apart as `viz-N.png` (motion checks) | | `SHADETUBE_NP_TAB` | `lyrics`, `queue`, `about` or `chapters`: the tab Now Playing opens on (screenshots; 3.40, 3.67) | | `SHADETUBE_PLAY_EPISODE` | `<feed URL>[\|<index>]`: fetches the feed at startup and plays its episode at that index (0 = newest; chapters / transcript screenshots, 3.67) | | `SHADETUBE_NP_LOG=1` | while Now Playing is open, logs every 5 s its frames/s and the backdrop field's size, renders/s and cost, and the live text shapes / rows built (3.62) (`nowplaying` lines) | | `SHADETUBE_LYRICS_SHAPES=0` | the lyrics views draw their lines as DirectWrite text instead of geometry (3.62): A/B of look and cost | | `SHADETUBE_FRAME_STATS=1` | Linux: every window's frames logged per burst or every 5 s (`frames "<title>"`: count, partial ones, the UI thread's CPU per frame mean / p95 / max and our own paint's share, frames later than 1.5 refresh periods after an animating one, the longest such gap, the image size) and the renderer GTK picked (3.84) | | `SHADETUBE_FRAME_CYCLES=1` | `SHADETUBE_MEM_DEMO`'s frame numbers are the UI thread's CPU cycles of each main-window frame (millions) instead of its wall time: comparable between runs while other work shares the machine (3.62) | | `SHADETUBE_PREVIEW_DEMO` | `<action>@<ms>[=<x>,<y>];…` after startup, at window DIPs: `hold` (left press, kept down), `up`, `move` (with the button down), `click`, `rclick` (the context menu), `key` (the `preview` action), `esc`. E.g. with `--route local:songs`, `SHADETUBE_PLAY_FILES` and `--screenshot`: `hold@3500=900,450;up@7000` (3.30) | | `SHADETUBE_NAV_DEMO` | `<step>;<step>…`, each `<action>@<ms>[=<arg>]` run `<ms>` after the shell opened: `click=<x>,<y>` (a real left click posted at window DIPs), `back`, `forward`. With `--screenshot`, e.g. `click@2500=559,378` and a capture at 3300 ms for a cover in flight (3.31) | | `SHADETUBE_MOTION_SCALE` | `<factor>` (1-50): page transitions and the cover's flight run that many times slower (screenshots of their middle) | | `SHADETUBE_VIDEO_FILE` | `<path>`: video mode plays this local video (MP4 / WebM) as the picture of every song that has a YouTube video (no stream is fetched): e.g. a burned-in timecode to check the sync against the audio | | `SHADETUBE_VIDEO_DEMO` | `<action>@<ms>[=<arg>];…` run that long after startup: `on`, `off`, `toggle` (as the buttons), `window`, `close`, `fullscreen`, `ontop`, `nowplaying`, `npclose`, `seek=<s>`, `speed=<x>`, `pause`, `play`, `quality=<rows>`, `minimize` / `restore` (the main window), `devicelost` (the device recreated as after a loss), `idlerelease` (the idle graphics release), `nchit` (logs the video window's hit test at its center and its close button), `captiondblclick` (a caption double click), `log` (the sync line now), `menu=<x>,<y>` (video mode's menu at window DIPs), `picker` ("Yanlış video mu?"), `reject` ("Bu videoyu gösterme"), `official=<0\|1>` (the official video setting), `shot=<png>` (the video window), `mainshot=<png>` (the main window), `quit`. To try the official video with `--play`, pin the song's Art Track in the sandbox's `cache\matches.json` (`"preview:<Artist - Title>": {"v": "<id>", "m": true}`) | | `SHADETUBE_HOVER_AT` | `x,y[@ms]`: after `ms` (default 2000) the main window acts as if the pointer rested at window DIPs x,y, until the real pointer moves over it (hover looks for `--screenshot`, e.g. `1412,20` = the close button of a 1440 DIP window) | | `SHADETUBE_CLIENT_ANIM` | `0` / `1`: Windows' animation effects off / on for the micro-interactions (3.32), instead of `SPI_GETCLIENTAREAANIMATION` | | `SHADETUBE_HOME_DEMO` | `scroll:<DIPs>`, `shelf:<pages>[@<n>]` (comma separated): once Home has its content it scrolls down that far and glides the n-th scrollable shelf (0 = the first) by that many pages, as its arrows do (screenshots); `edit` opens *Ana sayfayı düzenle* (3.69) | | `SHADETUBE_NO_BROWSER` | `1`: links the app would open in the browser (the support page, 3.73) are only logged | | `SHADETUBE_AUDIOFOCUS_DEMO` | `unplug` (headphones in use, then the default moves to speakers) or `call` (a call starts, ends 6 s later): fake events 4 s after start through the same path as Windows' (3.70) | | `SHADETUBE_SPOTIFY_DEMO` | `<folder>`: friend activity and new releases without a session from `buddylist.json` / `whatsnew.json` there (app/Social.h); a `home.json` gives the logged-out Home Spotify's shelves (3.34); an `artist.json` (a raw `queryArtistOverview` answer) stands in for any `artist:spotify:artist:<id>` route while logged out (3.47); `search.json` (a searchV2 answer) + `search_users.json` answer every search (the Spotify kinds: playlists, podcasts, profiles), `profile.json` + `profile_playlists.json` any `profile:` route, `library_shows.json` the followed shows (Podcastler's Spotify section and `podcasts:spotify`); `artist-events.json` stands in for the concerts / announced releases cache (Home's "Yakınındaki konserler" / "Yakında", the artist pages; never scanned or saved, 3.75); the files of `tests/spotify/fixtures` fit | | `SHADETUBE_GPU_LOSS` | `<point>[:<n>][,…]` with `resize`, `create`, `present`: the n-th `ResizeBuffers` / swap-chain creation / `Present` (default the first) acts as if the GPU device were removed (`DXGI_ERROR_DEVICE_REMOVED`), once per entry; the log shows the simulated loss and the new device (3.3). E.g. `present:60,create:3` | | `SHADETUBE_FOCUS_LOG` | `1`: every keyboard focus change is logged (`focus` lines: the widget's class, window rect and tooltip); with `SHADETUBE_OVERLAY_DEMO`'s `key=Tab` steps it checks a page's Tab order (3.47 Lists) | | `SHADETUBE_THEME_PRESET` | `<theme id>` (`nord`, `pastel`, `user:<file>`...): that theme for this run, whatever the mode; nothing is saved (3.35) | | `SHADETUBE_THEME_DEMO` | `<ms>:<step>,<step>…`: live theme changes the way the Ayarlar rows make them, the first after `<ms>`, then every 700 ms: a theme id, `mode:dark\|light\|system`, `corners:sharp\|default\|round`, `font:<family>` (`font:` = bundled), `accent:dynamic\|theme\|#RRGGBB` | | `SHADETUBE_THEME_DIALOG` | `accent`, `font`, `editor:<id>` or `new:<id>`: opens that dialog when the Görünüm rows are first built (with `--route settings:appearance`; screenshots) | | `SHADETUBE_THEME_IMPORT` | `<file>`: imports that theme file when the Görünüm rows are first built (the toast says why a file is refused) | | `SHADETUBE_OVERLAY_DEMO` | `<action>@<ms>[=<arg>];…` run `<ms>` after startup (3.36): `menu=x,y` (the track menu of the playing song, else a sample one with two artists, at window DIPs), `sleep=x,y` (the sleep timer menu), `key=<combo>` (posts a plain key to the window: `Down`, `Right`, `Escape`, `S`…; `Tab*6` that many times; with modifiers, `Alt+Down`, `Shift+Tab`, `Shift+F10`, it is sent with them set in the thread's key state), `focus=queue` (the keyboard focus and its ring on the queue panel's row cursor, for the keys after it), `hover=x,y`, `dialog` (a delete confirmation), `toast=<text>` (`!` = error), `toastaction=<text>`, `palette[=<query>]`, `credits` (the "Krediler" dialog of the playing song, else a sample one), `lyricspicker` ("Yanlış sözler mi?" for it), `lyricsync` (the lyrics synchronizer for it, 3.58; `key=Ctrl+Enter` steps on, `key=Space` stamps), `songinfo[=<Artist - Title>]` ("Şarkı hakkında" for the playing song, else a sample one, or that song, 3.76), `matchpicker` ("Yanlış eşleşme mi?"), `newplaylist`, `rename`, `details` (only for a playlist that exists), `blendcreate` (the consent dialog; needs listening history), `blendjoin`, `jamjoin`, `ytimport[=deezer\|apple\|tidal]` (that service's link dialog, 3.60), `importmenu=x,y` (the "İçe aktar" menu), `addmenu=x,y` (*Çalma listesine ekle* for a sample song: the filterable menu), `type=<text>` (posts the text as characters: typing into the focused field, e.g. a menu's filter), `clearqueue` (*Sırayı temizle* with its *Geri al* toast), `queuemenu[=x,y]` (the queue panel picker's menu, 3.77; or at window DIPs), `queuenew`, `queuemove`, `queuedelete` (its dialogs), `stationbuilder[=<id>|first]` ("Radyo oluştur", or a saved station to edit, 3.78), `stationstart=<id>` (plays a saved station), `smartreorder` (Akıllı sırala for the queue, else 24 sample songs, 3.82), `stats` (logs the acrylic captures so far and the bytes held). E.g. `menu@1500=520,180;key@1900=Down;key@2000=Right` with `--screenshot 3000`; `newplaylist@3000;key@3400=Tab*2` for the focus ring in a dialog | | `SHADETUBE_ACCOUNT_DEMO` | `<action>@<ms>[=<arg>];…` after startup (3.48): `menu[=x,y]` (the account menu at window DIPs, default under the title bar's tag), `switch[=<id>]` (the next signed-in account, or that one), `signout[=<id>]` (the active one), `add` (the login window), `log` (the active account and its data folder). E.g. `switch@8000;menu@11000` with `--screenshot 12000` | | `SHADETUBE_RECOGNIZE_DEMO` | `<action>@<ms>[=<arg>];…` after startup (3.59): `open[=system\|mic]` (the dialog, listening for real), `state=<listening\|identifying\|result[:<cover url>]\|notfound\|silent\|failed:<access\|busy\|device\|network\|rate\|service>>` (a state without listening; `result` resolves a sample song against the catalog), `history=<n>` (sample entries, not saved until a real one is), `act=<play\|like\|radio\|add>` (the result card's buttons), `close`. E.g. with `SHADETUBE_PLAY_FILES` and `open@3500` for ShadeTube's own playback | | `SHADETUBE_RECOGNIZE_LOOPBACK` | `endpoint`: *Bilgisayarın sesi* uses the default output's loopback (ShadeTube's own sound included) instead of the process loopback, as on a Windows without it | | `SHADETUBE_ACRYLIC` | `force`: the overlays' acrylic material also with transparency effects off or in high contrast; `off`: always the opaque surfaces (3.36) | | `SHADETUBE_LYRICS_EXPORT` | `<file>`: the synchronizer's "Dışa aktar…" writes there without the save dialog (3.58; tests in a sandbox) | | `SHADETUBE_LRCLIB_URL` | `http://127.0.0.1:<port>`: the synchronizer's "LRCLIB'e gönder" talks to this server instead of lrclib.net (a mock: the whole publish flow without publishing anything, 3.58) | | `SHADETUBE_LYRICS_SHARE` | `<from>-<to>[,gradient\|blur\|dark\|light][,square\|story\|wide][,center][,trdemo][,copy][,png=<file>]`: when the first track plays (e.g. `SHADETUBE_PLAY_FILES` with a sidecar `.lrc`), its lyrics are fetched and the "Sözleri paylaş" dialog opens with lines from..to (0-based) and those options; `trdemo` puts a stand-in translation under every line, `copy` runs "Görseli kopyala", `png=` also writes the export (3.37) | | `SHADETUBE_REVIEW` | `<year\|12m\|auto>[@<card>][,pause][,wait=<ms>][,png=<folder>]`: once the history is loaded (and an `SHADETUBE_IMPORT_HISTORY` import landed) opens the year-in-review story at that card (0-based), optionally paused; `png=` writes every card as `review-NN.png` there (after 4 s for the artwork lookups) | | `SHADETUBE_HEADER_SCROLL` | `<dips>`: pages with a collapsing header (album, playlist, Liked Songs, smart list, podcast show, artist; 3.38) open scrolled that far once their content is built, e.g. `150` (half collapsed) or `400` (docked) with `--route playlist:<id>` and `--screenshot` | | `SHADETUBE_MINI_MODE` | `strip`, `square` or `wide`: the mini player opens in that mode (a switch is saved as usual) | | `SHADETUBE_MINI_DEMO` | `<action>@<ms>[=<arg>];…`, each run `<ms>` after the mini player opened: `mode=<strip\|square\|wide>`, `hover[=x,y]` (the pointer counts as inside: the hover controls show; with x,y also the hover look of what is there), `leave`, `focus` (Tab), `wheel=<notches>` (volume), `size=<DIP>` (the square's side), `ontop=<0\|1>`, `key=<combo>` (through the mini player's shortcuts, e.g. `Ctrl+1`), `toast=<text>`. With `--mini --screenshot`: `mode@3000=square` and a capture at 3130 ms for a frame in the middle of a switch | ## 6. Release process 1. Bump `project(ShadeTube VERSION x.y.z)` in `CMakeLists.txt`. It drives the VERSIONINFO resource, *Settings › About*, the package name and the updater's version check. Add the version to `CHANGELOG.md`. 2. Build and run the offline tests (and `tools/i18n_check.py --all --strict`). 3. Package: `powershell -ExecutionPolicy Bypass -File tools\package.ps1` (`-SkipBuild` reuses the build in `build\Release`, `-BuildDir` names another Release folder). It builds `ShadeTubeSetup` (which builds and packs the app) and writes `dist\ShadeTube-x.y.z-win64.zip` (the exe, a short `BENIOKU.txt`, `LICENSE.txt`, `THIRD_PARTY_NOTICES.md` and the fonts' `OFL.txt`), `dist\ShadeTube-x.y.z-setup.exe` (3.57; refused when its VERSIONINFO isn't `ShadeTube Setup` x.y.z or it is older than the exe), a `.sha256` next to each, and prints a `sha256: <hex> <file>` line per file. Keep `package.ps1` UTF-8 with BOM. 4. Optionally run `tests\updater\run_e2e.ps1` against the new package, and `setup_test` (it installs the setup's own payload into a sandbox). 5. Create a GitHub release tagged **`vX.Y.Z`** (not a draft or pre-release: the updater reads `releases/latest`), upload the zip, the setup and both `.sha256`, and paste both `sha256:` lines into the release notes (the updater takes the zip and accepts it when its hash is among them). 6. Package managers: `python tools\update_manifests.py` (after packaging; `--zip <file>` hashes another copy) writes the winget manifest to `packaging/winget/shadesofdeath.ShadeTube/<version>/` (older version folders are removed) and `bucket/shadetube.json` for Scoop, both pointing at the release asset of step 5, and validates them. Commit them. **Scoop** users get the update from the repository itself (it is a bucket: `scoop bucket add shadetube https://github.com/shadesofdeath/ShadeTube`). **winget** needs a pull request to `microsoft/winget-pkgs` with the folder's four files under `manifests/s/shadesofdeath/ShadeTube/<version>/`, e.g. `wingetcreate submit packaging\winget\shadesofdeath.ShadeTube\<version>` (the first submission is reviewed by the winget team; `winget validate --manifest <folder>` checks it locally). Portable installs (winget, Scoop) can still use the in-app updater, but the package manager then keeps showing the old version until its own update. Both manifests still install the portable zip. Moving winget to the setup would take an installer manifest with `InstallerType: exe`, `Scope: user`, `InstallerSwitches` `Silent` / `SilentWithProgress: /S` and `InstallLocation: /D=<INSTALLPATH>`, `ProductCode: ShadeTube` (the uninstall key's name, so winget matches the *Installed apps* entry for upgrades and `winget uninstall`, which then runs the `QuietUninstallString`), `AppsAndFeaturesEntries` (DisplayName / Publisher `ShadeTube`, DisplayVersion), `ExpectedReturnCodes` for 1618 (`installInProgress`) and 1602 (`cancelledByUser`), `UpgradeBehavior: install`, and `update_manifests.py` hashing the setup instead of the zip; the in-app updater keeps working either way (it updates the installed exe in place, and the next start refreshes the entry's version). 7. **Linux** (3.87): on Ubuntu 24.04 run `tools/package-linux.sh --deb --appimage --flatpak`, and on Ubuntu 26.04 (or in an `ubuntu:26.04` container) `tools/package-linux.sh --deb`; or push the tag and take the files from the `linux.yml` run's artifacts (`packages-noble`, `packages-resolute`, `flatpak`). Upload `shadetube_x.y.z-1.ubuntu24.04_amd64.deb`, `shadetube_x.y.z-1.ubuntu26.04_amd64.deb`, `ShadeTube-x.y.z-x86_64.AppImage`, `ShadeTube-x.y.z-x86_64.flatpak` and their `.sha256` to the same release and add their `sha256:` lines to the notes (the Windows updater only takes the zip, so the extra lines don't disturb it). The packages take the version from `project()` alone (file names, the .deb / .rpm version, the AppImage and the Flatpak); if the metainfo has no `<release>` for it yet, `cmake/LinuxPackaging.cmake` adds one (dated at the build, or `SOURCE_DATE_EPOCH`) to the installed copy. Still, before tagging, add the `<release version="x.y.z" date="YYYY-MM-DD">` entry at the top of `<releases>` in `packaging/linux/io.github.shadesofdeath.ShadeTube.metainfo.xml` so the repository keeps the list (software centers show it; `appstreamcli validate` wants a date on every entry). Not done yet: a Flathub submission (a `flathub/io.github.shadesofdeath.ShadeTube` repository with the manifest's source switched to the git tag) and an apt repository / PPA; until then Linux users update by installing the new package. The in-app updater rejects a release whose tag differs from the exe's `ProductVersion`, and a download whose SHA-256 differs from GitHub's asset digest or from the `sha256:` line in the notes. ## 7. Known limitations and open items - **Linux port — core** (3.83): Japanese lyrics are romanized without kanji readings (Windows' Japanese analyzer has no Linux counterpart; kana are still romanized); lyrics embedded in a local file's tags through the Windows property store are not read; language detection for translation knows fewer languages than ELS (Latin-script text outside en / de / es / fr / pt / it / nl / tr / id / pl is "unknown" and Google detects it); a crash leaves a text backtrace, not a minidump. Without a Secret Service, secrets fall back to the derived key (3.83): weaker than DPAPI against other programs of the same user. The app's own files on Linux: cancelling a scan can't interrupt a read stuck on a dead network mount; an unplugged drive is recognized by its fstab mount point not being mounted or by the mount folders (`/media`, `/run/media`, `/mnt`, gvfs) — one mounted elsewhere without an fstab entry, whose empty folder stays behind, reads as emptied; tags of WAV / WMA / AAC depend on the installed FFmpeg and covers on the GdkPixbuf loaders (WebP only with its loader). Radio country names need iso-codes (else the station's English name). The metered check knows NetworkManager's flag only (no roaming or over-limit). The microphone privacy shortcut of song recognition is Windows-only. - **Linux port — ui** (3.84): the mini player cannot place itself (Wayland: no snapping, no remembered position, a mode switch resizes from where the desktop keeps the window); neither it nor the video window can stay on top (GTK 4 has no such request), and the video window remembers only its size. Video pictures are copied once per frame into a cairo bitmap and scaled on the CPU (no GPU path: a 1080p video in a large window costs CPU time). Text is drawn unhinted with grayscale antialiasing (no subpixel ClearType look); the Mica window backdrop is Windows-only (the menus' and dialogs' own acrylic is drawn on both). The pointer steps of `SHADETUBE_PREVIEW_DEMO` only log on Linux. Every frame costs GTK a whole-window copy and blend (its cairo node; GTK 4.16's `GdkMemoryTextureBuilder` update regions could let it redraw only what changed); only the player bar's wave asks for partial frames so far (the playing rows' equalizer and Now Playing still repaint the whole window). Fractional scales were reasoned through, not seen (WSLg has none). No global shortcuts: an `org.freedesktop.portal.GlobalShortcuts` client (GNOME 48+, KDE) is not written yet. - **Linux port — audio** (3.85): no exclusive mode; video decodes in software only (no VAAPI: a 1080p60 VP9 / AV1 stream needs a few cores); the system sound that song recognition hears includes ShadeTube's own playback (no per-process exclusion on PulseAudio), and a default device changed during a listening run is followed only when the old one goes away. Only PulseAudio on WSLg was exercised, with null sinks: no real headphones, Bluetooth device, call or microphone, no PipeWire and no ALSA-only system (WSL has no ALSA card); the "headphones" guess of the device list is the name / Bluetooth, the watcher's the port type / form factor. A freshly woken PulseAudio source took up to ~2 s to deliver its first samples there. - **Linux port — os** (3.86): the tray needs a StatusNotifierItem watcher (stock GNOME has none: no tray icon, and the close / start to tray options are hidden there). No global hotkeys of our own (Wayland gives apps none; the desktop's shortcut settings can run `shadetube --command …`). No in-app update or uninstall. Whether a window is covered by another isn't known on Wayland: the song notification only checks the focus. Listen together between Windows and Linux relies on OpenSSL's ECDH + SHA-256(Z ‖ label) matching CNG's `BCRYPT_KDF_HASH` (same inputs by the spec, not yet tried across the two). The public EMQX broker's retained messages failed in `jam_test live` on both systems (the broker's side). - **Windows nobody can see** (3.3): the cover check looks at whole windows above ours; a window that is opaque but has a region (`SetWindowRgn`) or a layered one that paints opaque at full alpha counts as covering by its frame bounds, and a translucent one never covers. A covered window is checked every 250 ms, so a covering window that goes away without activating ours shows its frame up to 250 ms late. `SHADETUBE_MEM_DEMO`'s frame statistics count the skipped frames of a covered window as frames (its mean then reads high). Real GPU removal (a driver update or a TDR) was not produced: device loss was checked with `SHADETUBE_GPU_LOSS` only. - **Frame clock on several monitors** (3.3): `DwmGetCompositionTimingInfo` takes no window since Windows 8.1, so the refresh grid is DWM's (the primary monitor's) even when the window is on a monitor with another refresh rate. Not seen on the single-monitor development machine and left as it is; the effect would be uneven glide steps there, not wrong positions. - **Menu filter**: the field takes over Home / End and Left / Right while it has the focus (they edit the text); Up / Down move through the matches. A long menu that is not filterable has no field (type-ahead jumps by first letters). - **Customize Home** (3.69): checked on the logged-out Home (MusicBrainz, local library) in a sandbox; the logged-in Spotify feed's ids (`Shelf::id` = the section URI) and YouTube Music's titles as ids were not seen live (no signed-in sandbox; YouTube Music's titles follow the UI language, so a language change shows its shelves as new ones). Hiding a shelf of the Spotify or YouTube Music feed saves no request (each feed is one). - **Headphones and calls** (3.70): tested through the rules (`homecontrols_test`) and `SHADETUBE_AUDIOFOCUS_DEMO`; no real headphones were unplugged and no real call was made during development. Windows reports calls only while Sound › Communications is not "Do nothing"; an app whose calls don't open a communications stream is not seen. - **Private session** (3.72): plays are never reported to Spotify by ShadeTube in any case, so there is nothing to stop there; a song started on another Spotify device is that device's business. - **Cast to device** (3.74): built and tested against mock renderers only (a Python UPnP renderer and a Python CASTV2 receiver over TLS on 127.0.0.1, driven by the app in a sandbox and by `cast_test`): no real Chromecast, Nest, Android TV, DLNA TV / receiver or Sonos was played to, so device quirks (Samsung / LG DLNA dialects, Sonos' own URI schemes, real Cast receivers' format checks, the TLS handshake with a real device certificate) are unverified; the one live discovery run found no device on its network (a Python probe got no SSDP / mDNS answer there either). No firewall path was tested (no admin rights; the mocks ran on 127.0.0.1). Known gaps: Cast has no gapless (the next item loads after the end); L16 items are never queued with SetNextAVTransportURI; the equalizer, normalization, crossfade and speed don't apply on a device; decoded PCM costs ~1.4 Mbit/s on the LAN and the decoder runs on this PC; a seek on a PCM item depends on the device asking for a byte range (most do); Sonos groups, stereo pairs and satellites are what the ZonePlayer offers (no grouping UI); stations behind `.pls` / `.m3u` playlists, and HLS on DLNA, can't be handed over; an HTTPS station on an old DLNA renderer may not play; a device on another subnet or a guest Wi-Fi isn't found (multicast doesn't cross it); videos don't go to a TV (audio only); the phone remote names the device but has no picker of its own. - **Word-by-word lyrics** (3.81): Better Lyrics and Paxsenix are community proxies in front of Apple's lyrics and KuGou / NetEase are their clients' private APIs: any of them can change or close without notice (the chain then moves on; failures are not cached, so a source that is down costs a request per new song). A song that the first sources don't have waits for each of them in turn (Apple 0.5-3 s, KuGou ~1 s), and a song with only line lyrics shows them after the word-level sources below LRCLIB were asked too (~1-2 s more) - once per song, then it is cached. Apple's catalog is guessed from the song's letters and the app's language: a song only in another country's catalog is not found there. Matching trusts title + artist + length: a live or alternate recording within 3 s whose title carries no version word can pass. Translations from KuGou's KRC (`[language:]`) and NetEase's `tlyric` are not used. Downloads write enhanced LRC when word times exist; a player that doesn't know the `<mm:ss.xx>` stamps shows them as text. - **Rule-based playlists** (3.64): a release year is known only for local files and saved albums' tracks (catalog tracks carry none), so "year" rules over Spotify / YouTube Music likes and playlists match nothing but "unknown". Spotify collections are read from the collection cache, fetched in the background while a list needs them: a new list shows its Spotify songs once their listing is done (minutes for a large library), and the cache follows Spotify only as often as 3.64 says. The editor's playlist picker names the sidebar's playlists (signed in, Spotify's; local ones are not offered then). Verified on a synthetic logged-out library only: no logged-in Spotify sandbox was available, so the Spotify collection fetching ran in no live session. A pool of ~1 KB per distinct song is held while any rule list exists (7 MB for 5 000 songs, 70 MB for 50 000). - **Headphone correction** (3.66): only parametric profiles; AutoEq's GraphicEQ files and Equalizer APO's other commands (Include, Copy, Delay, Convolution, per-device sections) are not read. A profile belongs to the WASAPI endpoint id: a headset seen under two ids (USB vs Bluetooth, or Bluetooth's hands-free endpoint) needs it set for each. The correction is applied in shared and exclusive mode alike but not to audio other apps play. - **Podcast extras** (3.67): QuickTime chapter text tracks (most M4A chapters from Apple tools) and an MP4 `moov` at the end of a streamed file are not read (a downloaded file is read whole). Transcripts without times show unsynced. Silence trimming judges by level only: a quiet music bed under a pause keeps it, very quiet speech can be cut short. - **Content filters** (3.79): the AI list is a community list: it misses new AI artists and may name a real one by mistake ("Yapay zekâ değil" fixes that locally). It holds Spotify ids; on YouTube Music, MusicBrainz and local files an artist is matched by name only when the name is distinctive, and then only automatic picks leave it out (no badge, not hidden) unless the user marks it. YouTube's "altered or synthetic content" label is not in any InnerTube answer the app reads, so it is not used. Explicit flags exist only for Spotify and YouTube Music songs. Genres come from local tags and MusicBrainz only (Spotify's web player and YouTube Music send none, no mood data anywhere): a new library's genre chips fill in over minutes (one artist every 20 s), artists missing on MusicBrainz or without genre votes there get none, and a namesake can be picked when the right artist has fewer tag votes. The first scan after updating reads every local file once again (for the genre column). Verified logged out only (no Spotify sandbox): the Spotify id matching ran in `contentfilter_test` and its live list check, not on a signed-in Home or radio. - **BPM** (3.65): like every tempo estimator it can return half or double the tempo musicians would name (strong eighths, half-time grooves); free-tempo music, speech and ambient pieces get no tempo. Only audio already on this PC is analysed: a song streamed but not finished (not in the song cache) or never played has none. The analysis of a cached Opus stream is slow in Debug builds (seconds); Release was not measured. - **Proxy** (3.68): NTLM / Kerberos proxies (a corporate proxy that wants the Windows sign-in) work only through *Sistem*: the HTTP mode sends Basic credentials. UDP is not proxied (WebView2's WebRTC is limited to the proxy's TCP; nothing else in the app uses UDP to the internet). Loopback targets are always direct. The bridge serves only ShadeTube and its child processes. An open Spotify login window picks up a change when it is opened again. HTTPS to the proxy itself (an `https://` proxy) is not supported, nor are SOCKS4 or a PAC file of the user's choosing (Sistem follows the Windows PAC setting). The live check used local Python proxies, not a real corporate or commercial proxy. - **Exit and user files** (3.1, 3.14): a worker task that ignores cancellation (a request without a token, a scan of a stalled network drive) holds the exit for up to 4 + 1.5 s, then the process is ended with the services it uses left allocated; nothing is lost (everything is saved before), but that task's own result is. A user file another program holds open at startup is not saved for the rest of the session (changes to it are lost, the file is never overwritten). Only one previous copy (`.old`) is kept: when that one is unreadable too (a failing disk), the data starts empty (the damaged file is still kept as `.corrupt`). - **Concerts and upcoming releases** (3.75): everything comes from Spotify's web player endpoints with the logged-out token, which Spotify can change or close at any time (the feature then shows nothing). Only the overview's first ten concerts per artist are kept (with their venues): a city whose dates are further down an artist's tour isn't seen ("Tümünü gör" opens Spotify's full list). The location filter works by city name only (Spotify names no country or region), and the automatic place is Spotify's IP guess. Open-catalog artists are matched to Spotify by their MusicBrainz link or by exact name, so a namesake on Spotify can lend an artist someone else's concerts; Spotify's own listings can mix up namesakes too (seen live: "Mor ve Ötesi" listed with five US club dates, not verified). A Spotify pre-release opens in the browser (no playable page before release day); there is no notification of its own. Open-catalog artist pages show MusicBrainz' future-dated releases only, which are rare (none ahead among the test artists). Verified with the logged-out token and fixtures only: the logged-in path (the session's Api, the account's concert location) ran in no live session (no logged-in Spotify sandbox was available), and a concert with several ticket sellers (the menu) was not seen live (the one asked had one seller). - **Şarkı hakkında** (3.76): Genius' JSON is the site's own, undocumented, and may change or start a bot check (then only MusicBrainz answers); its search is matched by title and artist, so a song Genius names differently is unknown. MusicBrainz' sample / cover / remix relationships are community data and thin outside well-known songs (none for the two lesser-known Turkish songs tried). A related song is played only when the active catalog has the same song; otherwise the row offers a search. - **Several queues** (3.77): an inactive queue is saved as 500 slots around its place (a longer queue loses the rest at a restart, like the single queue before). An inactive queue of internet radio stations may fail to resolve its stream after a restart until a station is started again from the Radyo page. Switching queues while listening together as the host changes what the guests hear (they follow the host's active queue). - **Radio builder** (3.78): LB Radio's own prompt endpoint needs a connected ListenBrainz account (401 without a token, since 2026); signed out of ListenBrainz the station is built from LB Radio's public blocks (artist and tag radio), which follow the same idea without troi's ranking. LB Radio knows the artists and tags ListenBrainz users listen to and tag: a little-known artist or a rare tag can give few or no songs ("Bu istasyon için şarkı bulunamadı"), and moods are only as good as the community's tags. A batch of new songs costs one catalog search each on Spotify / YouTube Music (≈ 6 s for 30 on YouTube Music); about one in six is not found there and plays as the MusicBrainz recording, found by name. The queue-low extension was exercised in code and tests, not through a long live session. Artist picks found by name may land on a namesake (the exact folded name wins, else MusicBrainz' first hit). - **AutoMix** (3.80): the tempo match is WSOLA (`audio/TimeStretch`): fine for drums and most music within 8 %, but held notes and voices can sound slightly grainy while the incoming song is stretched (the overlap and the ramp after it). The analysis assumes 4/4 and phrases of 8 bars; songs in 3/4, with tempo changes or a loose (live) beat get the smart crossfade or a mix point that is a bar off a phrase. A stream is analysed only once both songs are fully downloaded (the job waits for it), and the analysis of 90 s of audio took 1-4 s in Debug builds (Release not measured): on a slow connection a long next song may get the smart crossfade ("no plan in time"). Every track played in AutoMix mode runs through its crossover's allpass (flat magnitude, a phase shift in the lows). A pause, seek or skip during a mix ends it like any crossfade. Listen together: guests use the smart crossfade, so for the length of the host's mix they hear the next song from its start while the host is already into it (the usual correction catches up); not tried with two real clients. Verified on synthetic music (offline renders, the real engine, the app in a sandbox with generated WAVs); no listening test with real songs was done during development. - **Musical key and Akıllı sırala** (3.82): accuracy is measured on synthetic audio only (94 % exact); real songs with modulations, modal or atonal music can get the relative or a fifth, and the confidence is shown nowhere. A key tag without a tempo tag is stored only once the file is analysed (not with the analysis setting off). 0.12's analysed songs are analysed again for their key in the background. A Spotify reorder is several requests: a failure in the middle leaves a partly moved list (the page reloads it). Closing the dialog stops its analysis. In the queue only the last run of list songs is reordered, not songs added by hand. Not in Now Playing's *Hakkında* yet. - **Spotify internal API.** Pathfinder GraphQL and spclient are the web player's private endpoints and can change without notice. Rotated hashes heal themselves (3.5), but a changed request shape (HTTP 400 naming a variable) needs a code change. The TOTP secret comes from a public gist with a fallback. Spotify rate-limits hard; iterate with `spotify_test home` rather than the full live run. - **Spotify connection trouble** (3.5, 3.48): the refused / transient split rests on what the token endpoint answered on 2026-12-02 (401 for a made-up `sp_dc`, 400 for a wrong TOTP secret; `spotify_test token-probe` checks it again). The renewal, the 401 retry and the expired prompt were verified with fakes (`accounts_test`) and a made-up cookie in a sandbox, not with a real cookie Spotify revoked (no sandbox account). The library is not cached on disk, so an offline start shows the open catalog's pages (and history) until Spotify answers; an account marked expired stays so for the run (a restart tries its cookie once more). - **Local-network guard** (3.17): each redirect hop's name is resolved for the check and again by WinHTTP for the request, so a name whose DNS answer changes between the two (DNS rebinding) is not caught. - **Matching folds** (3.4): letters lose their diacritics rather than taking a language's spelling ("ä" → "a", not "ae"), which ranks "Mädchen" and "Maedchen" apart; builds other than Windows fold ASCII only. - **Spotify podcasts** (3.54) play only when Apple's directory lists a public feed under the same name: a show renamed on one side, or listed under a very different name, counts as "no public feed" (*Apple Podcasts'ta ara* and *RSS adresiyle ekle* remain), and a short generic name from a different publisher is never matched. Matches are not checked against the episodes; *Yanlış podcast mi?* undoes a wrong one. The directory allows about 20 requests a minute, so the first look at a long list of followed shows takes a while (verdicts are kept). The libraryV3 filter id for shows (`"Podcasts & Shows"`) and the logged-in `searchUsers` answer were not seen live by the development session (no logged-in Spotify sandbox was available); both have fallbacks or captured shapes (an unfiltered library walk; the anonymous answer has the same shape). - **Page layout pass** (3.47 Lists, "Page layout"): the Spotify-only layouts (search kinds, profiles, followed shows, new releases, the logged-in Home's shelves, an artist) were checked through the `SHADETUBE_SPOTIFY_DEMO` fixtures only, and a Spotify library folder's page not at all (no logged-in sandbox). A density change re-lays out the card grids but keeps their column width (160 / 140) until the page is opened again. - **WebView2 Runtime** is required for the Spotify login (present on Windows 11; installable on Windows 10). - **Song credits** (3.46): Spotify's credits query was taken from the web player's bundle (2026-11-26) and is covered by fixtures, but was not run against a logged-in account during development (no sandbox `sp_dc`); its response shape is the one the web player's code reads. MusicBrainz credits are only as complete as its community data (often just the writers), and instrument names stay in English. Credits are searched by title and artist, so a song without an artist gets none from MusicBrainz. - **Lyrics picker** (3.46): LRCLIB's free-text search returns at most 20 records; the Spotify choice needs a Spotify track and a session. A picked record is cached in `cache\lyrics` (pruned with the cache), so it is fetched again by id when the cache was cleared. - **Lyrics tools** (3.58): the synchronizer stamps line times only (no word timing / enhanced LRC). Its saved lyrics are the song's "file" pick: choosing another pick in the picker later deletes that copy (a download's / local file's sidecar .lrc stays). Publishing to LRCLIB was developed against the documented API and LRCGET's solver, checked with a fake transport, a local mock server driven from the app and a real challenge solved live; the final `POST /api/publish` to lrclib.net was **not** exercised (no test lyrics may be published). "Sözden şarkı bul" uses Genius' undocumented site endpoint (no key): a change there or a bot check makes it fall back to YouTube Music's search (no matched line shown). On MusicBrainz only the first four hits are looked up in the catalog (its request rate), and MusicBrainz' recording search may stand a live or compilation recording in for a song. - **Lyrics romanization** (3.63): kanji readings come from Windows' Japanese language data; without it (as on the development PC) Japanese lines show the kana in romaji and the kanji as written, and the analyzer's real output was not observed (a fixture stands in). Korean skips the grammar-dependent rules (ㄴ insertion, nouns keeping ㅎ, the ㄼ exceptions); Chinese is not romanized. Not in the mini player or the lyrics share card. - **Lyrics rendering** (3.62): while a Now Playing line grows or shrinks, its two styles are seen together for ~60 ms; when the big style wraps a line into more rows than the small one, that moment shows both wraps. Lines with color emoji are drawn as text (16-level edges, no fill gradient per row beyond a clip). Geometry antialiasing has no gamma correction: light text on a dark ground carries ~3 % less ink than DirectWrite's bitmap glyphs (it matches DirectWrite's own outline mode). - **`SHADETUBE_MEM_DEMO` report steps** (found, not fixed): `mem::detailedReport` walks each heap under `HeapLock` and appends to vectors meanwhile; in a Debug build that allocation takes the CRT debug heap's lock, which another thread may hold while waiting for the same heap: the UI thread then hangs in the report (seen twice in a row with Now Playing playing). `SHADETUBE_MEMLOG` and `frames=` steps are not affected. - **Several Spotify accounts** (3.48): verified live with one real account only (a 0.10 profile migrated, connected, a switch to a second record holding the same cookie while a song played); two different real accounts were not available, so the second login's own cookie jar and a re-login matched by user id are covered by `accounts_test` (fake connect) only. A request in flight at the very moment of a switch (e.g. a like or a playlist edit queued a split second before) still goes out with whichever token the worker reads. One Spotify Liked Songs sync rule per PC (bound to the account that made it); Last.fm / ListenBrainz, the phone remote's pairing, listen together's name and `library.json`'s local play history stay per PC; the Settings' expanded sidebar folders are shared (folder ids differ per account, so they don't clash). Signed-out accounts keep their folder (history, blocklist) for a later sign in; there is no "forget this account's data" yet. - **Song notification** (3.49): needs the app's AUMID to be known to the shell (the Start menu shortcut the app keeps); otherwise it falls back to a tray balloon without cover or buttons. The buttons reach the app through the toast's in-process event (no COM activator is registered): once ShadeTube has quit, its entry is removed from the notification center; an entry left behind by a crash doesn't reach a new ShadeTube. "In view" is a heuristic (the foreground window covering 90 % of ours); a ShadeTube window hidden behind several smaller windows counts as in view. Verified live: the toast with the cover, the replacement per song, "Sonraki" from the toast, the mini player suppressing it, the balloon fallback; the "Beğen" button was not clicked live (on a Spotify track it writes to the real account). - **YouTube Music** is read through its web client's private InnerTube API (anonymous): its renderer layout changes between experiments without notice. The parsers find rows wherever they are and skip what they don't understand, so a change usually loses a section rather than breaking the page; new captures go through `ytmusic_test dump`. Only English (`hl=en`) answers are parsed for words; Home's shelves come in the UI language, but their content follows the region YouTube sees (the IP), not `Settings.region`. YouTube Music gives no discography counts (the artist page only knows "there may be more" until the grid opens), no compilations group and no rank / top cities. YouTube Music playlists are read-only (no account: no library, likes or playlist writes on YouTube Music's side; "Yerel listeye aktar" makes a local copy). No search suggestions (the other catalogs have none either). A Search page answer costs five parallel requests (the palette's one); a page 1-2 requests of 0.3-1.5 s (answers are 0.2-1 MB of JSON; a mood category up to 3 MB) unless the disk cache has it. - **Song recognition** (3.59) depends on Shazam's private recognition endpoint: Apple's terms don't permit third-party clients, and the endpoint, its headers or the signature format may change or start refusing ShadeTube without notice (then every attempt ends as "Tanıma hizmeti yanıt vermedi"); there is no second backend. It rate-limits (429 for about a minute after 4 requests within ~1.5 s, and after a few dozen within half an hour; a session sends at most 3, 3-4 s apart). Accuracy, measured live with our signature (YouTube audio decoded by the app's own decoder, `recognize_test songs`): 11 s excerpts of 10 recordings (rock, pop, hip-hop, dance, jazz, two Turkish pop songs, a live piano performance) named the right song every time but once, also with 4 s and 7 s excerpts, and with white noise mixed in at 5 dB (3 / 3) and 0 dB SNR (2 / 2); white noise, a hum and silence come back as no match. The service's answer is not deterministic: the same Levitating excerpt was named once as an unrelated re-upload of the song in Shazam's catalog (no album, no ISRC) and once correctly; 4 s of Billie Jean's groove, captured from the loopback, once named another release (the confirmation rule of 3.59 now listens on in such cases). A live performance comes back as another recording of the same piece (with its tempo skew); remixes and covers may come back as the studio recording or not at all. The microphone was checked for opening and levels only (no song played into a real microphone in the room); device switching during a session was not exercised live (the code reopens on the new default). Process loopback needs Windows 10 2004+; older systems fall back to the output's loopback with ShadeTube's own sound in it (tested with `SHADETUBE_RECOGNIZE_LOOPBACK=endpoint`). - **Deezer / Apple Music / TIDAL imports** (3.60). Deezer's public API is documented and keyless (robust; 50 requests per 5 s). Apple Music has no keyless API: the import borrows the web player's developer token from its JS bundle and calls the undocumented amp-api; a changed bundle layout or token check falls back to the page data, which holds at most 300 songs and no ISRCs (lists longer than that are then imported in part, and the preview says so). TIDAL's openapi v2 is documented, but the client-credentials pair is the signed-out web app's (read again from the web bundle when refused); if TIDAL closes it to that client, TIDAL imports stop with a clear message. TIDAL's hosts reset connections from this network now and then (retried). Deezer's `deezer.page.link` short links belong to Firebase Dynamic Links, which Google shut down in 2025: old ones may no longer resolve (`link.deezer.com` ones do); no real short link was available for a live test (the expired-link path and a recorded landing page were). The Spotify path (ISRC search with a logged-in session) was not run live during development (no Spotify sandbox session). YouTube Music has no ISRCs, so that catalog matches by name only (98-100 % on pop lists, 86 % on a classical box); matching a 500-song list takes about 1.5 min there, MusicBrainz is bound to one request a second. - **YouTube** matching can pick the wrong video (*Wrong match?* fixes it per track), and stream access depends on YoutubeExplode keeping up with YouTube changes. - **Public Piped / Invidious instances are volatile**: the built-in list goes stale, and many instances serve search but no streams (on 2026-10-06 nearly all of them). Their health is remembered, but the backup source is off by default and should stay a fallback. SoundCloud's `client_id` scraping can break whenever its web client changes; many label releases are only 30 s previews there. - **Unsigned exe**: SmartScreen warns on first run. The updater relies on SHA-256 and VERSIONINFO checks, not on a code signature. The same goes for the setup (it is the file people download first, so it meets SmartScreen first). - **Setup** (3.57; measured with the 0.11.0 code, Release, on this development PC): `ShadeTubeSetup.exe` is 8.2 MB (the 15.3 MB app as a 6.0 MB LZMS payload, the rest is the setup's own code, fonts and icons; the portable zip is 6.5 MB); packing takes ~4 s at build time, unpacking 151 ms, a whole install 0.25 s and `/S` from start to exit 0.3 s. Every install, update, repair, uninstall and silent run was tested in a `SHADETUBE_SETUP_SANDBOX` only: the real Start menu, desktop, *Installed apps* entry and Run value were never written by the setup on the development PC, so how Explorer, Windows' *Installed apps* page and Windows 10 show them was not seen live (the values are the same ones the app's own "Bilgisayara kur" wrote before). Not exercised: the elevated path (Explorer starting the app unelevated), a work area so small that the window is zoomed out, the folder picker with a real click, a second monitor with another DPI while the setup runs (handled by `ui::Window` like the app). The installed exe is replaced while a ShadeTube that refuses to quit keeps running (renamed away, as the updater does): that path is covered by `updater_test`, not by a setup run. The setup is one language at a time from Windows' display language; a user's ShadeTube language setting is not consulted. - **Ogg / WebM**: Opus and Vorbis decode built in (3.52); Ogg FLAC / Speex and other codecs in WebM / Matroska still need a Media Foundation handler. Local `.webm` / `.weba` / `.mka` files are not scanned or accepted as drops (the engine plays them; their Matroska tags aren't read). Chained Ogg Vorbis links at another rate are resampled; a Matroska file without cues seeks by walking its cluster headers (slow over the network). Passthrough `.m4a` downloads are not SponsorBlock-trimmed. - **Exclusive mode** (3.53): a track of another rate reopens the device (a short gap instead of a gapless handoff); Windows' per-app volume and enhancements don't apply; while another app holds the device exclusively nothing plays (Windows refuses shared streams too). Tested on one device (Realtek, 16-384 kHz, 24-in-32): unplugging and switching devices while exclusive were not exercised physically. - **Phone remote** is plain HTTP on the local network (no TLS: tokens and commands can be seen by anyone sniffing that network; the pairing secret stays in the URL fragment and the page). The phone's token belongs to the page's origin, so a new LAN address (DHCP) or port means scanning the QR code again; on iOS a page added to the home screen as a web app has its own storage and pairs separately. - **Tag editor**: WAV, WMA, ADTS AAC and Ogg / Opus tags can't be written (the Windows property system writes in place, which the verify-then-swap rule doesn't allow). An ID3v2 extended header is dropped and an enhanced `TAG+` block is left as it is; an ID3v2.2 frame without a v2.3 form is dropped (logged); a compressed v2.2 tag is refused. A download's catalog name in the app doesn't follow its edited file tags. - **Listen together** depends on public MQTT brokers (free services without guarantees; a custom broker can be set). Members share the room key, so a member could forge messages under another device id; removing someone keeps them out only after "Yeni davet bağlantısı" (the old key still reads the old room). A host's restart keeps the session for 10 minutes (3.51); after that, or when the host's broker is down then, guests give up. 0.10.0 guests sit out podcasts and radio; episodes of feeds added by RSS address are never shared; guests need the songs on YouTube. Two instances on the same profile (only possible with `--preview`) both resume a kept room and fight over it. - **Blend** relies on the public broker named in the invite keeping retained messages: a member offline for a while finds the others' profiles only if the broker still has them (on 2026-11-27 all three public brokers still returned a retained record 15 minutes later — longer gaps were not measured, see `blend_test retain`; how long a free broker keeps them is its own policy, and a broker restart may drop them — every visit publishes the profile again). When the invite's broker is unreachable, members fall back to the next broker in the list, where the others' profiles are only found once they have visited that broker too, i.e. both must then be online for it in turn. Members share the blend key, so one could publish under another's member id. The playlist only holds songs from the members' histories (no recommendations); imported history songs have no lengths and get covers only through the Stats artwork lookups. Matching songs across members needs the same title and first artist. Two instances are best tested on two profiles of one PC (`SHADETUBE_INSTANCE_CLASS` / `_MUTEX` per profile let `--command` and `--open-link` reach each); sync across two machines depends on their audio output latency. - **Playback speed** uses time-domain stretching (WSOLA): transparent for speech and fine for music around 0.75-1.5x, with some phasing on dense music at extreme speeds. - **Mica** needs Windows 11 22H2+. Windows 11 21H2's undocumented Mica attribute needs the frame extended into the client area, which brings back DWM's caption buttons, so 21H2 counts as unsupported. Mica is a solid color while the window is inactive, with transparency effects off (then the app stays opaque) or in energy saver, where the window just reads a shade lighter. Turning it on applies at the next start unless the window started with it. The 55 % / 50 % tint was chosen on simulated composites (the development machine has transparency effects off) and may need tuning against real wallpapers. - **Official music video** (3.42): the first play of an Art Track song waits for the lookup (two soundtracks of ~1.5 MB, ~1 s each, and ~1 s of maths: 3-9 s, up to ~40 s when googlevideo throttles a URL; later plays use the stored decision; offline: the cover). Only YouTube Music's OMV label, the channel and the title say "official": a fan upload with "Official Video" on the artist's name, or an official video titled unusually (another language, no artist), can be taken / missed; the alignment still refuses anything that isn't the song's recording. A video much shorter than the song (an edit under 88 % of its length) is not tried; an edit that reorders the song, or repeats a part the song doesn't, is declined rather than held; more than 3 holds decline too. A part held over shows the cover (no freeze frame). The anonymous watch-next `counterpart` (YouTube Music's own song ↔ video link, with its timing) is not available, so the timing is always worked out from the sound. Codec delay: none with Opus or an edit-listed AAC; with an AAC stream without an edit list the engine's clock (and so every video mode picture) is 36 ms ahead of the sound (its priming). - **Video mode** shows the video the song resolved to, or for an Art Track / audio upload its official video (above). The still-picture check is a bit-rate heuristic: a very calm real video under ~200 kbps at 720p shows as "no video", a still with grain or a slow zoom shows as a video. YouTube only (no backup servers); VP9 / AV1 only when H.264 is missing, and WebM seeks through Media Foundation's own (slow, scanning) path; no HDR (8-bit NV12). The picture appears 0.7-3 s after the audio on the network and seeks take 0.4-2 s (one segment download). The DXVA surface pool costs ~70 MB of GPU memory at 720p (more at 1080p) while the picture is on screen. Now Playing with video repaints at the video's frame times besides its own ticks (more CPU than either). The app's D3D11 device is multithread protected from the first picture on (for that device generation). Not measured: 1080p60, discrete GPUs (the app takes the default adapter), software decoding on a machine without DXVA, the mid-play URL refresh (no 403 happened in testing). - **Icons** (3.43) are crisp at the six grid sizes (12-24 px); other sizes (a 12 DIP icon at 125 % = 15 px, everything above 24 px) are the nearest grid scaled, so their strokes are anti-aliased (invisible from about 150 % up). An icon added as hand-made SVG files instead of a drawing in `tools/icons.py` gets neither the hinting nor the 12 / 14 / 18 grids (it still draws from its 16 / 20 / 24 files; `tools/icons.py` keeps such files and lists them, `--check` fails on them): add the drawing. - **Song cache** (3.45): the sampled hash notices a truncated or replaced file and damage in the sampled regions, not a changed byte between them (the decoder then fails and the file is dropped, or the sound has a glitch). Offline a song plays from the cache only when its video is known for that track id (it played, or was matched, under the same id); a song whose last match was a "this play only" stand-in plays its cached video only once resolving failed. A cached song plays on after its video was taken down on YouTube. `SHADETUBE_OFFLINE` simulates the shared transport only (no firewall test was possible without admin rights). - **Last.fm / ListenBrainz import** (3.55): Last.fm gives listening history only with an API key, and the app has none of its own: the user's key from Settings › Connections is used (the dialog asks for one, and again after the key was refused). The Last.fm path was tested against fake servers built from the API's documented replies (and the field names two public exporters read); against the live API only up to its key check (a bogus key: error 10, reported, not retried) - no real import ran (no key in this environment). Duplicates are recognised by start time: a ListenBrainz copy that another importer stamped with the end time, or a Spotify play paused for more than half the song, counts twice. Scrobbles' minutes are estimates (3.55). Plays submitted to a service with old timestamps more than 14 days after they happened (a late bulk import into ListenBrainz) are missed by the incremental runs; removing and importing the source again reads everything. Plays left out as duplicates are not kept, so removing a source drops plays the others also had until those are imported again (their cursors are reset for that). - **Memory** (Release, Intel iGPU, empty profile): about 45 MB private commit on screen and idle (0.6.0: 63 MB), most of the rest the GPU driver; about 13 MB once nothing has been on screen for 30 s (0.6.0 stayed at 63 MB). WARP software rendering would save more on screen but costs ~24 % CPU in Now Playing, so hardware rendering stays. Now Playing needs more while open (large glyph atlases; no effects since its redesign, 3.40). After an idle release the first frame recreates the device (tens of ms) and covers reload from the disk cache. - **List design (3.47).** The Year and *added by* (collaborative lists) columns are laid out by `app/TrackColumns` but never offered: `catalog::Track` carries no release year or adder yet; a catalog that fills them only needs to set the flag in `TrackTable::wantedColumns`. Turning shuffle on mixes queued songs into the shuffled order like the rest (`rebuildOrder`), unlike Spotify, which keeps its queue first. Every window repaint is a full frame (flip-model swap chain), so the playing bars cannot repaint just their rect; they only ride the ~30 fps cadence the flowing seek wave already causes. Frame-time measurements on this machine were noisy (parallel builds; the display ran at 60-240 Hz between runs), so the table's cost is compared in thread cycles of its paint, not in frame gaps. - **Memory** (0.11.0, Release, Intel UHD at 2560 × 1440 / 175 %, a 1345 × 712 DIP window, measured with the `SHADETUBE_MEM_DEMO` scripts of 3.2; "populated" = 5 000 local songs in 250 folders with covers and 30 000 imported plays; logged out, MusicBrainz catalog). Private commit / GPU memory (DXGI local segment) in MB, 0.10.0 → 0.11.0, the two builds run back to back: | Scenario | 0.10.0 | 0.11.0 | |---|---|---| | Home, empty profile, after 60 s | 62 / 49 | 58 / 49 | | Home, populated, after 60 s | 94 / 50 | 87 / 50 | | 17 pages browsed (albums, artist, search, the 5 000-song list, stats, settings...), back on Home | 165 / 106 | 128 / 73 | | the same 40 s later | 162 / 104 | 115 / 70 | | playing (local songs), Home | 128 / 59 | 121 / 54 | | Now Playing with lyrics, 30 s / closed again | 128 / 73, 142 / 84 | 124 / 72, 141 / 87 | | mini player only | 108 / 56 | 101 / 31 | | tray, 4 s / 38 s (graphics released) / shown again | 124 / 58, 55 / 0, 115 / 60 | 96 / 23, 51 / 0, 104 / 53 | | video mode on (720p DXVA) / off, 40 s later | 217 / 120, 152 / 79 | 215 / 121, 143 / 76 | Runs of the same build differ by ±5 MB (the driver's pools depend on timing). Ten minutes of playback (30 songs) stay flat. The empty profile's ~60 MB on screen is about 20 MB of heap (most of it Direct2D, DirectWrite, the D3D runtime and the driver), 20-25 MB of the driver's private allocations and Direct2D's glyph cache, 1 MB of thread stacks and the rest writable image pages; the GPU figure is mostly the swap chain (two window-sized buffers). WARP software rendering would save more on screen but costs ~24 % CPU in Now Playing, so hardware rendering stays. After an idle release the first frame recreates the device (tens of ms) and covers reload from the disk cache. Known and left: closing Now Playing keeps ~10 MB more than before it opened (Direct2D's glyph and texture caches for its display-size text; only `ClearResources` frees them, which costs a full re-rasterization on screen); video mode leaves ~13 MB of heap after it is turned off, all of it Media Foundation's decoder (the app's own allocations are the same before and after, ±0.3 MB, by the `ST_MEMPROFILE` tally); the listening history costs ~550 bytes a song (its index keys are wide strings) and the local library ~1.7 KB a file with long paths (each file keeps its folder's cover path); a minimized window keeps its swap chain until the idle release (the taskbar thumbnail). - **Visualizer** (3.61): the picture runs ahead of the sound by the device buffer (up to ~40 ms shared, about the same exclusive); the analysis window's own lag (a kick shows 33-60 ms after it enters) roughly cancels it, nothing compensates it exactly. The beat detector was tuned on synthetic music (`visualizer_test`) and adapts its threshold; songs without a kick or bass attacks (ballads, ambient, most classical) give few beats, steady noise an occasional stray one. Measured on one machine only (the Intel UHD of an i7-14650HX driving a 2560 × 1440 240 Hz panel): no 4K display was available. The cover does not fly in from Now Playing when the view opens (it fades in with the view). - **Linux packaging** (3.87): one .deb per Ubuntu LTS (24.04, 26.04); Debian, Fedora, Arch, openSUSE are served by the Flatpak or the AppImage only. The .rpm is built on Ubuntu and is not installable on Fedora (Debian sonames in its requires). The AppImage needs the system's GTK ≥ 4.14, WebKitGTK 6.0, libcurl, libsecret and librsvg: it does not start without WebKitGTK (linked, not loaded on demand) nor on older distributions (Ubuntu 22.04, Debian 12) and carries no update information. Started as a plain file, it has no desktop entry: the panel shows a generic icon for its window and `shadetube:` links do not reach it until a tool like Gear Lever or AppImageLauncher integrates it. The Flatpak is not on Flathub yet (a local bundle; its first install downloads the GNOME runtime, ~450 MB) and it is built from the checkout, not a pinned git tag. Not tested: KDE Plasma, X11 sessions, ARM64 (no aarch64 packages), a real NVIDIA / AMD GPU (the test VM draws with llvmpipe), HiDPI fractional scales in the VM. CI artifacts are not attached to the release automatically.