push-xmsxusvrqurk #177

Merged
eric merged 30 commits from push-xmsxusvrqurk into main 2026-11-16 10:15:49 +01:00
Owner
No description provided.
eric added 30 commits 2026-11-16 10:13:37 +01:00
Introduce dedicated configuration pages for `pmomultiroom` and `pmosound`, moving logic from main files to modular structures. Add comprehensive validation checks for multiroom groups, silence detection, and ALSA timing constraints. Update dependencies and snapshot scripts to support the new configuration schema and API documentation format.

- Refactor `pmomultiroom`: move `clock_name`, `learned_entry`, and `parse_learned` from `config.rs` to new `learned.rs`; add `multiroom_config_page` in `config_page.rs` with group/destination tables; add `keys.rs` for constants.
- Refactor `pmosound`: move `declared_keys` from `main.rs` to new `config_pages.rs`; add `config_pages()` and `declared_keys()` functions; update `start_upnp` to initialize web UI router with these pages.
- Add validation checks: `ident_config_page` prevents inconsistent timing settings; `sound_config_page` ensures ALSA period is shorter than buffer; `multiroom_config_page` validates group/destination consistency.
- Update `pmomusic-config`: add `devices_page` wildcards and UDN/last_seen fields; update `storage_config_page` to show resolved directory as read-only info; remove `storage_config_page` from `PMOMusic`.
- Add `pmoreaders` silence detection: new "Détection de silences par lecteur" collection with threshold/hysteresis/min_silence_ms/min_sound_ms fields; add `known.rs` for static reader registry.
- Update `.crate-kit`: change API snapshot to `.json.gz`; update `api-level.sh` and `latest_snapshot` for gzipped files; bump version to 0.1.13.
- Update dependencies: `pmoconfig` to 0.3, `windows-sys` to 0.59.0, `socket2` to 0.5.10; add `serde_json` and `alac-encoder` to `pmosound`.
Update the `turso` dependency from version 0.7 to 0.8 and bump related crates in Cargo.lock. Add `Send` and `Sync` implementations for internal types in `pmodb` and increase recursion limits in `pmoident` and `pmoreaders` to satisfy compiler bounds.

- Update `turso` dependency version from "0.7" to "0.8" in `Cargo.toml`.
- Bump `antithesis_sdk` to 0.3.0, `itertools` to 0.13.0, and `windows-sys` to 0.61.2 in `Cargo.lock`; add `js-sys` and `wasm-bindgen` to `turso_sdk_kit`.
- Add `assert_send_sync` and `inner_fields_are_send_and_sync` functions in `pmodb/src/store/backend/turso/mod.rs`.
- Implement `unsafe impl Send` and `unsafe impl Sync` for `Inner` in `pmodb/src/store/backend/turso/mod.rs` within a test module.
- Increase recursion limit to 256 in `pmoident/src/lib.rs` and add comments regarding `Send` proof.
- Increase recursion limit to 256 in `pmoreaders/src/lib.rs` for `init_readers` and add comments on async chain depth.
Update dependencies to pmomdns 0.2.0 and refactor service discovery logic to use `ResolvedService` instead of `Receiver`. Add new `pmomdns` configuration module in `pmomusic-config` to manage silent rounds and apply settings, updating public interfaces and tests accordingly.

- Update `.crate-kit/VERSION` from 0.1.14 to 0.1.15
- Modify `.crate-kit/scripts/api-level.sh` to use `-s` flag for `cargo public-api`
- Modify `.crate-kit/scripts/api-snapshot.sh` to use `-s` flag and exclude generic implementations
- Update `Cargo.toml` and `Cargo.lock` to use `pmomdns` 0.2.0, updating `windows-sys`, `socket2`, and other dependencies
- Modify `PMOMusic/src/bootstrap.rs` to include `pmomusic_config::MDNS_KEYS` in `declared_keys`
- Update `PMOMusic/src/tests/bootstrap.rs` to expect 111 declared keys
- Refactor `pmoairplay/src/emitter/discovery/service.rs` to use `ResolvedService` and update event handling in `start`
- Modify `pmoairplay/src/receiver/announce.rs` to use `Daemon` instead of `ServiceDaemon` in `register` and `Registered`
- Update `pmoairplay/src/receiver/announce_tests.rs` to handle `Option` results for service events
- Modify `pmocontrol/src/control_point.rs` to handle `Some(event)` in `spawn` loop
- Add `pmomusic-config/Cargo.toml` dependencies: `pmomdns`, `serde_yaml_ng`, `tracing`, `uuid`
- Update `pmomusic-config/src/devices_page.rs` to include `MDNS_SILENT_ROUNDS` setting and update documentation
- Modify `pmomusic-config/src/lib.rs` to declare `mdns` module and apply settings in `init_app`, `init_for_tests`, and `load_app`
- Update `pmomusic-config/src/tests/devices_page.rs` to verify retention setting validity
- Add `pmomusic-config/src/mdns.rs` with `MdnsConfigExt` trait, `apply` function, and configuration keys
- Add `pmomusic-config/src/tests/mdns.rs` with tests for default validity, written values, and devices page settings
Refactor `RadioFranceClient` to use `RadioFranceProvider` for determining
mapping persistence and discovery, removing the dependency on
`MetadataCache` for these operations. This change ensures that the
configuration is only rewritten when a real change in station mapping
occurs, rather than on every `live_metadata()` call.

- Update dependencies in Cargo.lock: itertools to 0.12.1, windows-sys
  to 0.61.2, socket2 to 0.6.5, and update pmoconfig, pmomdns, pmossdp,
  and pmoutils versions.
- Modify `RadioFranceClient::station_mapping` to use `RadioFranceProvider`
  instead of `MetadataCache` for determining if a mapping needs to be
  persisted in `pmoconfig`.
- Change `RadioFranceClient::mapping_dirty` logic to prevent forcing
  configuration rewrites on every `live_metadata()` call.
- Update `live_metadata` to trigger re-discovery in `RadioFranceProvider`
  upon `Error::StationNotFound` instead of using `MetadataCache`.
- Move persistent mapping loading from `MetadataCache` initialization to
  `RadioFranceProvider::new`.
Update docstrings for `external_cache` fields to accurately reflect data types and status values. Define `STEP_1` constant for table creation SQL.

- Update `key` field docs to specify it contains a hash, MusicBrainz ID, or normalized text
- Modify `status` field docs to describe 'ok', 'not_found', and 'error' states with retry logic
- Clarify `retry_after` is NULL when status is 'ok'
- Define `STEP_1` constant as the initial CREATE TABLE statement
Introduce a new `lock_recover` module in pmocontrol to handle poisoned mutexes and read-write locks gracefully by logging warnings and recovering state instead of panicking. Update the project version to 0.1.16 and refactor various components to use these safe locking primitives.

- Add `pmocontrol/src/lock_recover/mod.rs`, `mutex.rs`, `rwlock.rs`, and test modules defining `MutexRecover` and `RwLockRecover` traits with methods like `lock_or_recover`, `read_or_recover`, and `write_or_recover`.
- Refactor `pmocontrol/src/control_point.rs` to use `read_or_recover` for registry access in functions such as `list_music_renderers`, `default_music_renderer`, `attach_queue_to_playlist_internal`, and `schedule_queue_refresh_for`.
- Update `pmocontrol/src/media_server_events.rs`'s `refresh_servers` to use `read_or_recover` for registry reads.
- Modify `pmocontrol/src/music_renderer/musicrenderer.rs` to use `lock_or_recover` in `backend_queue`, `start_watching`, and `lock_backend_for`, and `write_or_recover`/`read_or_recover` in `refresh_connection_info` and `queue`.
- Change `pmocontrol/src/queue/backend.rs`'s `sync_queue` to use `MusicQueue::lock(self.queue())` for safer locking.
- Update `pmocontrol/src/queue/music_queue.rs`'s `lock` function to use `lock_or_recover` from the new module.
- Refactor `pmocontrol/src/queue/openhome.rs`'s `queue_snapshot` to use `lock_or_recover` for playlist client reads.
- Update `pmocontrol/src/sse.rs` functions (`renderer_events_sse`, `media_server_events_sse`, `all_events_sse`) to use `read_or_recover` for registry access.
- Modify `pmocontrol/src/stream_refresh.rs` functions (`fetch_fresh`, `spawn_watchdog`, `check`) to use `read_or_recover` and `lock_or_recover` for registry and schedule accesses.
- Refactor `pmoairplay/src/receiver/announce_tests.rs`'s `the_services_can_be_found_again_on_the_network_with_their_records` to use a block structure for service checking and panic on timeout.
- Update `.crate-kit/VERSION` from 0.1.15 to 0.1.16.
Replace all `.lock().expect(...)` calls with `lock_or_recover` to prevent panics on mutex poisoning. Update imports to use the new `MutexRecover` trait across multiple modules.

- pmocontrol/src/discovery/manager.rs: update `should_fetch` to use `lock_or_recover` for registry access and adjust fetch timing logic.
- pmocontrol/src/events.rs: update `subscribe` to use `lock_or_recover` for `newest` lock and add `NEXT_SEQUENCE` atomic variable.
- pmocontrol/src/media_server.rs: update `is_online`, `last_seen`, `has_been_seen_now`, `mark_as_offline`, and `max_age` to use `lock_or_recover` on connection mutex.
- pmocontrol/src/music_renderer/arylic_tcp.rs: update `is_continuous_stream` to use `lock_or_recover` for continuous stream mutex.
- pmocontrol/src/music_renderer/capabilities.rs: update `QueueTransportControl` and `play_from_queue` to use `lock_or_recover` for continuous stream access.
- pmocontrol/src/music_renderer/chromecast_renderer.rs: update `is_continuous_stream` to use `lock_or_recover` for continuous stream mutex.
- pmocontrol/src/music_renderer/linkplay_renderer.rs: update `is_continuous_stream` to use `lock_or_recover` for continuous stream mutex.
- pmocontrol/src/music_renderer/musicrenderer.rs: update numerous methods including `poll_and_emit_changes`, `handle_state_change`, and state accessors to use `lock_or_recover` for RendererState, Playlist binding, and Connection mutexes.
- pmocontrol/src/music_renderer/openhome_renderer.rs: update `is_continuous_stream`, `playback_position`, and `current_track_uri` to use `lock_or_recover`.
- pmocontrol/src/music_renderer/stream_detection.rs: update `is_continuous_stream_url` to use `lock_or_recover` for STREAM_CACHE and PENDING_CHECKS.
- pmocontrol/src/music_renderer/upnp_renderer.rs: update `is_continuous_stream`, `play_item`, and `play_uri` to use `lock_or_recover` for caching duration.
- pmocontrol/src/queue/music_queue.rs: update `schedule_sync` and `sync_worker_loop` to use `lock_or_recover` for refused_on_ready mutex.
- pmocontrol/src/queue/openhome.rs: update cache access methods like `cache_metadata`, `replace_queue`, and `track_ids` to use `lock_or_recover` for metadata, uri, and read list caches.
- pmocontrol/src/upnp_clients/openhome_client.rs: update `source_xml`, `source_index`, and `set_source_index` to use `lock_or_recover` for cache locking.
Extracted the logic for initiating image loading from `setImageRef` into a new watcher that monitors `coverImageRef` and `cacheBustedUrl`. This ensures images are loaded if already present by checking `el.complete` and `el.naturalWidth > 0`.

- Modified `useCoverImage` composable to include a new watcher for `coverImageRef` and `cacheBustedUrl`.
- Removed conditional image loading logic from `setImageRef`, leaving the function definition but stripping its side effects.
- Added watcher logic to detect already loaded images via `el.complete` and trigger `handleImageLoad()` if necessary.
Introduce a Dockerized development environment (devstack) with services for PMOMusic, PMO Sound, and an OpenHome renderer. Implement `MinIntervalThrottle` to limit the rate of item replacements in the OpenHome queue, ensuring cache consistency via `prune_caches`.

- Add devstack configuration including Dockerfiles, compose files, and configs for `dev`, `pmosound`, and `openhome` containers.
- Create `pmocontrol/src/queue/throttle.rs` with `MinIntervalThrottle` struct and tests in `throttle/tests.rs`.
- Update `pmocontrol/src/queue/openhome.rs` to use throttle, add `prune_caches` method, and move test helpers to `openhome/tests.rs`.
- Modify `pmoaudio/src/nodes/clocked_sink.rs` to log silence/skip stats and return early if skipping.
- Add `.devcontainer/devcontainer.json` for VS Code remote container support.
Update the devstack `pmostack-openhome` service to use an ALSA plughw device on OrbStack and add logic to correctly track and preserve origins for tracks from unknown servers.

- Update `devstack/README.md` to reflect that `openhome` uses ALSA `plughw:SoundCard` as a single application, similar to PMO Sound.
- Modify `devstack/docker-compose.yml` to mount `/dev/snd` and set `systempaths=unconfined` for the `pmostack-openhome` service.
- Update `devstack/openhome/Dockerfile` comments to clarify that mpd and upmpdcli are from distribution repositories.
- Configure `devstack/openhome/mpd.conf` to use an ALSA output on device `plughw:SoundCard`, replacing the previous null output.
- Add `replace_queue_item` method to `pmocontrol/src/music_renderer/musicrenderer.rs` for atomic queue item replacement with signal emission.
- Implement `cache_item` in `pmocontrol/src/queue/openhome.rs` to track real origins, updating methods like `add_playback_item` and `replace_item` to use it.
- Modify `playback_item_from_entry` in `openhome.rs` to resolve server IDs from the new `origin_by_id` cache, defaulting to a fictitious ID if unknown.
- Add tests in `pmocontrol/src/queue/openhome/tests.rs` for foreign track servers, looped back origins, and cache pruning behavior.
- Add `has_unknown_server` helper in `pmocontrol/src/stream_refresh.rs` to detect OpenHome-originated tracks.
- Update `refresh_current_item` in `stream_refresh.rs` to skip replacement if the server is unknown, using the new `replace_queue_item` method.
Update the `openhome` service configuration and documentation to reflect that MPD now outputs to a null sink instead of using the sound card, as PMO Sound handles audio playback. This aligns the test environment with the actual hardware constraints where the sound card is exclusively opened by PMO Sound.

- Update `devstack/README.md` to clarify that `mpd` outputs null and multicast traffic behavior between containers.
- Remove `/dev/snd` device mount and `systempaths=unconfined` security option from `devstack/docker-compose.yml`.
- Change `devstack/openhome/Dockerfile` comment to indicate MPD uses null output with no sound card.
- Update `devstack/openhome/mpd.conf` to set audio_output type and device to "null", dropping audio in real-time.
Add comprehensive unit tests for the MusicRenderer to verify queue updates
and item replacement logic. Refactor `rebuild_playlist_section` in openhome.rs
to pass owned values to `cache_item` instead of references.

- Add pmocontrol/src/music_renderer/musicrenderer/tests.rs with tests for offline rendering, item creation, queue updates, and queue item replacement success/failure cases.
- Modify pmocontrol/src/queue/openhome.rs: change `rebuild_playlist_section` to pass owned `item` values to `self.cache_item` instead of references.
Refactor pmocontrol to use a new `renderer_jobs` module for managing media playback tasks. This replaces direct Tokio task spawning with a centralized `RendererJobs` system that handles job submission, renderer-specific channels, and worker spawning.

- Add `renderer_jobs` module containing `RendererJobs` struct, `Job` type alias, and `submit`/`spawn_worker` methods
- Update `ControlPointState` to include `jobs: Arc<RendererJobs>` field initialized in `new`
- Refactor `seek_queue_index`, `play_content`, `add_to_queue`, and `add_after_current` to use `state.jobs.submit` instead of direct task spawning
- Add tests for job submission order and renderer isolation in `renderer_jobs/tests.rs`
Introduce a new `CommandFailed` event type to propagate rendering errors from the backend to the frontend. This includes updating the `RendererEvent` model, adding a `report_failure` helper in `renderer_jobs`, and wiring up the error notification in the webapp's `useRenderers` composable.

- Add `CommandFailed` variant to `RendererEvent` in `model.rs` with `command` and `message` fields
- Implement `report_failure` function in `renderer_jobs.rs` to log warnings and emit `CommandFailed` events
- Update `sse.rs` to map `CommandFailed` events to `RendererEventPayload` for transmission
- Modify `pmoserver_ext.rs` to use `report_failure` for error handling in `add_to_queue`, `add_after_current`, `play_content`, and `seek_queue_index`
- Add `command_failed` type definition to `types.ts` with relevant fields like `renderer_id` and `timestamp`
- Update `useRenderers.ts` to handle `command_failed` events by notifying errors via `useUIStore`
- Add test `a_failed_command_is_announced_to_subscribers` in `renderer_jobs/tests.rs` to verify event emission
Implement feedback-based session liveness checks and handle groups with
dead receivers by shutting them down and reopening. This involves adding
`is_alive` and `is_closed` methods to track session state, updating the
`ReceiverSession` struct to store feedback status, and modifying the group
start logic to detect and restart groups with dead sessions.

- Add `is_alive` method to `pmoairplay/src/emitter/session/commands.rs` to check if feedback has failed or events indicate closure.
- Modify `send_feedback` in `commands.rs` to set `feedback_failed` on RTSP errors and clear it on success.
- Add `is_closed` method and `closed: Arc<AtomicBool>` field to `EventsReader` in `events.rs`.
- Update `EventsReader::spawn` to set the closed flag on stream closure/error and update `drop` to abort the task.
- Rename `_events` to `events` in `ReceiverSession` struct (`mod.rs`) and `open` definition (`connect.rs`).
- Add `feedback_failed: bool` field to `ReceiverSession` with documentation for RTSP connection failures.
- Update `setup` function in `setup.rs` to assign event reader to the renamed `events` field.
- Modify `start` function in `group/mod.rs` to check for dead receivers and restart the group if necessary.
- Add `dead_receivers` method to `Running` struct in `running.rs` to filter and return names of non-alive sessions.
- Add tests in `pmoairplay/src/emitter/session/events/tests.rs` for connection, closure detection, and port status.
- Update `.pmosound/config.yaml` last_seen timestamp from 1794540379 to 1794547989.
Implement `filtered_ns` in `Playout` to track filtered clock offsets and introduce
drift correction logic in the `plan` method. Update `play_chunk` in `clocked_sink`
to handle playout objects returned from output actions, ensuring single blocking
calls for unclocked streams. Add comprehensive tests for silence, skip, and drift
correction behaviors.

- Modify `Playout` struct to include `filtered_ns: Option<f64>` for filtered clock offset
- Update `new_content` and `play_at` to initialize or reset `filtered_ns` to `None`
- Implement filtering logic in `plan` using `FILTER_LEN` and `SMOOTHING` constants
- Handle `early_ns` exceeding `MAX_SILENCE` by resetting `filtered_ns` to `None`
- Calculate `skip` based on late offsets and update `filtered_ns` with corrected values
- Update `play_chunk` in `clocked_sink.rs` to return playout objects from output actions
- Add test `without_a_play_at_everything_is_written_as_is` for basic write behavior
- Add test `corrections` to verify silence and skip action calculations
- Add test `measurement_noise_around_the_target_causes_no_correction` for noisy conditions
- Add test `a_real_drift_is_corrected_once_and_not_again` for drift correction logic
Introduce a new `lan_cover` module to handle cover URLs by rebasing relative routes to absolute LAN addresses when the `pmoserver` feature is enabled. Update `playback_item_to_didl` in `control_point.rs` to apply this logic, ensuring DIDL sent to renderers carries absolute cover URLs.

- Add `src/lan_cover.rs` with `lan_cover_url` and `lan_cover_url_on` functions that rebase routes using `pmoserver::rebase_own_route` when a LAN address is present.
- Add `src/lan_cover/tests.rs` with five test cases covering relative route rebasing, LAN address preservation, cross-host URL handling, missing LAN address behavior, and DIDL output verification.
- Modify `playback_item_to_didl` in `control_point.rs` to make metadata mutable and apply the new LAN cover URL logic before calling `pmodidl::track_didl`.
- Update `src/lib.rs` to conditionally include the `openapi` module under the `pmoserver` feature and integrate the new `lan_cover` module.
Refactor `is_stream` and `missing_metadata_or_title_is_stale` to use the centralized `is_continuous_stream` function from `crate::music_renderer`. This removes local fallback logic and simplifies imports by relying on a single source of truth for stream detection.

- Update `schedule_sync` in `queue/music_queue.rs` to use `std::panic::catch_unwind`, logging errors and avoiding thread restarts on panic
- Modify `is_stream` in `stream_refresh.rs` to delegate to `crate::music_renderer::is_continuous_stream` instead of local checks
- Update `missing_metadata_or_title_is_stale` in `stream_refresh.rs` to use `crate::music_renderer::is_continuous_stream_url`
- Replace local imports in `stream_refresh.rs` with `is_continuous_stream` from `crate::music_renderer`
Move Qobuz AppID, Secret, and authentication tokens from `config.yaml` to a dedicated `qobuz_state` SQLite table via the new `QobuzState` struct. This centralizes state management, improves persistence reliability, and updates all client construction paths to use the new state interface.

- Add `pmoqobuz/src/state.rs` containing `QobuzState` with methods for managing AppID, Secret, Spoofer credentials, and AuthInfo in a SQLite database.
- Implement `migrate_legacy` in `QobuzState` to transfer existing configuration values from `config.yaml` into the new database table upon first access.
- Update `pmoqobuz/src/client/mod.rs` to include `state: QobuzState` in `QobuzClient`, replacing direct config access for credentials and tokens.
- Refactor `pmoqobuz/src/client/construct.rs` to accept `QobuzState` in `build_client` and `api_from_config`, retrieving secrets from state instead of config.
- Update `pmoqobuz/src/client/auth.rs` to use `QobuzState` methods for fetching/spoofer credentials and persisting auth info, making `persist_auth_info` async.
- Modify `pmoqobuz/src/cache/mod.rs` to add `db_path` and `shared_store` helpers, and update `bootstrap_schema` to create the `qobuz_state` table.
- Remove Qobuz-specific getters/setters (appid, secret, auth info) from `pmoqobuz/src/config_ext.rs`, retaining only non-state configuration logic.
- Add `State` variant to `QobuzError` in `pmoqobuz/src/error.rs` to handle database-related errors for authentication and API secrets.
- Update `pmoqobuz/src/lib.rs` to export the new `state` module and `QobuzState` type publicly.
- Add comprehensive tests in `pmoqobuz/src/state/tests.rs` covering state loading, persistence, legacy migration, and auth lifecycle scenarios.
- Update client tests in `pmoqobuz/src/client/tests.rs` to use `seed_offline_state` for initializing test configurations instead of hardcoded values.
Refactor `pmocache` to use an asynchronous database backend (`pmodb`) instead of `rusqlite`, removing the direct dependency. This involves splitting the monolithic `db.rs` into modular submodules (`entries`, `lazy`, `metadata`, `permanent_ids`, `schema`) and updating all cache initialization and query methods to be async.

- Move `pmocache/src/db.rs` logic into new submodules: `entries.rs` (core entry ops), `lazy.rs` (lazy/pk mapping), `metadata.rs` (batch metadata), `permanent_ids.rs` (origin URL mapping), and `schema.rs` (DB opening/config).
- Update `Cache::new`, `with_transformer`, and internal methods to be async, awaiting database initialization and queries.
- Remove `rusqlite` dependency from `pmocache/Cargo.toml` and `Cargo.lock`; replace error handling with `pmodb::store::StoreError`.
- Propagate async changes to `pmoaudiocache` and `pmocovers`: make `new_cache`, `create_*_cache`, and getter functions async; update all callers (including `main` in examples) to await cache creation.
- Update all test suites (`test_cache.rs`, `test_db.rs`, etc.) to use async test runners and await cache/DB initialization.
- Add `db_root` argument to cache constructors in `ARCHITECTURE.md` and code to support the new database path requirements.
Replace synchronous rusqlite connections with the asynchronous `pmdb::store::Store` API across the playlist and cache modules. This involves updating error types, persistence logic, and schema bootstrapping to use the new store interface.

- Update `PmoCacheError` in pmocache to use `pmodb::store::StoreError` and add a configuration error variant
- Migrate `pmoplaylist` error handling to use `pmdb::store::StoreError` instead of `pmdb::PmoDbError`
- Refactor `PersistenceManager` to use `PathBuf` for database paths and manage `Arc<Store>` via `OnceCell`
- Move schema version checking and migration logic into a new `open_store` helper in persistence/mod.rs
- Update all read operations (load_playlist_meta, list_overviews, etc.) to use async query methods on the Store
- Refactor write operations (save_playlist, delete_playlist) to use explicit transaction blocks with `begin_write`/`commit`
- Add `pmoplaylist/src/persistence/rows.rs` containing row structs (`MetaRow`, `TrackRow`, etc.) and `FromRow` implementations
- Migrate `pmoqobuz` cache to use async `Store` by adding `schema::bootstrap` and removing synchronous bootstrap logic
- Update Cargo.toml dependencies to reflect the new `pmdb` configuration with `pmomusic-config`
Refactor the `pmodb` crate by removing the legacy `PmoDb` struct, its associated configuration, error types, and deferred write logic. The public API is now centralized in a `Store` struct, simplifying usage by requiring explicit flushing via `flush_all_deferred`.

- Delete `pmodb/src/config.rs`, removing `PmoDbConfig` and its `Default` implementation.
- Delete `pmodb/src/error.rs`, removing the `PmoDbError` enum and `Result` type alias.
- Delete `pmodb/src/deferred.rs`, removing `Pending`/`Deferred` structs, flush loops, and deduplication utilities.
- Remove `PmoDb`, `enqueue`, `read`, `write`, `open`, `registry`, and related functions from `pmodb/src/lib.rs`.
- Update `pmodb/src/store/mod.rs` documentation to reflect the new unique access API for `pmo` crates.
- Update `PMOMusic/src/main.rs` to call `pmodb::store::flush_all_deferred()` instead of `pmodb::flush_all_deferred()`.
- Remove `r2d2` and `r2d2_sqlite` features from the `turso` dependency in `Cargo.toml`.
- Remove the `name = "store"` bench configuration from `pmodb/Cargo.toml`.
- Delete `pmodb/benches/store.rs`, removing benchmarks for `Store` against `PmoDb`.
Increase the recursion limit to 256 in `pmocache/src/lib.rs` to satisfy the `Send` proof for futures from `pmodb::store` when spawned by `tokio::spawn`. This adjustment addresses potential stack overflow issues with the Turso backend under `--all-features`.
Update several crates to allow deeper recursion when checking `Send` traits
for futures originating from `pmodb::store`. This resolves compilation errors
related to trait bounds in the `turso` feature context.

- pmoaudio-ext: Add `#![recursion_limit = "256"]` and comment regarding `permanent-id`.
- pmoaudiocache: Add `#![recursion_limit = "256"]` above `pub mod cache`.
- pmocovers: Add test for `Send` of futures from `pmodb::store` with limit 256.
- pmoparadise: Document `Send` feature for `pmodb::store` and set recursion limit to 256.
- pmoplaylist: Add test for `Send` of futures from `pmodb::store` with limit 256.
- pmocontrol/tests: Update LAN server URL constant and assertion to omit port `:8080`.
Refactor URL handling to use an `Extension<BaseUrl>` injected by a new middleware layer instead of deriving it from headers in individual handlers. This simplifies handler signatures, ensures consistent behavior for absolute URLs, and supports WAN mode through peer-aware base URL resolution.

- Add `pmoserver/src/base_url_layer.rs` with `with_base_url` and `insert_base_url` to inject `BaseUrl` into request extensions based on headers or server config.
- Add `pmoserver/src/peer_url.rs` with `base_url_towards`, `base_url_towards_for`, and `configured_base_url` to resolve base URLs for peers using configured values or local IP routing.
- Update `pmoserver/src/lib.rs` to remove `get_base_url_from_request` and expose `peer_url::base_url_towards`.
- Modify `pmoserver/src/server.rs` to wrap the dynamic router with the new `with_base_url` layer in `spawn_listener`.
- Update `pmoserver/src/host_config.rs` to add `get_configured_base_url` for reading explicit base URL configurations.
- Refactor handlers in `pmocontrol/src/pmoserver_ext.rs`, `pmocontrol/src/sse.rs`, and `pmowebrenderer/src/websocket.rs` to accept `Extension<BaseUrl>` instead of `HeaderMap`.
- Update `pmocontrol/src/control_point.rs`'s `playback_item_to_didl` to accept `renderer_url` for generating absolute cover URLs.
- Move helper functions from `pmocontrol/src/control_point.rs` to `pmocontrol/src/music_renderer/watcher.rs`.
- Add `didl` method to `pmocontrol/src/queue/openhome.rs` and update queue methods to use it for optimized DIDL generation.
- Update `pmocontrol/src/lan_cover.rs`'s `lan_cover_url` to accept `renderer_url` and add `server_base_towards` for conditional URL resolution.
- Modify `pmoupnp/src/devices/device_instance.rs` to check `location_is_fixed` in `to_ssdp_device` and add the helper function.
- Update `pmoserver/docs/guide_extension.md` to reflect the new `Extension(base_url)` parameter and middleware-based URL determination.
- Add tests for base URL layer, peer URL resolution, and device instance location fixing in respective test modules.
Introduce a new `aliases` module in pmocache to resolve metadata using synonyms for permanent IDs, allowing lookups to fall back to primary keys when direct IDs are missing. Update the registry and resolve modules to expose and utilize these new alias-aware methods, ensuring that metadata retrieval is purely local without resolving external files. Additionally, extend the URL source handler to support parsing M3U, M3U8, and PLS playlist formats.

- Add `pmocache/src/db/aliases.rs` containing `aliased_metadata_all` and `aliased_metadata_value` functions, which query cache for aliased metadata based on permanent IDs and primary keys using a prioritized SQL strategy (permanent ID > non-LAZY synonym > LAZY synonym > technical metadata).
- Update `pmocache/src/db/mod.rs` to include the new `mod aliases;` module.
- Add `metadata_with_aliases` and `metadata_all_with_aliases` methods to `AnyCache` in `pmocache/src/registry.rs`, enabling retrieval of metadata using synonyms if the permanent ID is missing.
- Implement `local_lookup`, `metadata_with_aliases`, and `metadata_all_with_aliases` in `pmocache/src/resolve.rs` to support local resolution logic where no files are resolved or downloaded.
- Modify `pmouniverse/src/pump/ports.rs` so the `metadata` function calls `pmocache::CacheRegistry::metadata_all_with_aliases` instead of `metadata_all`, indexing based on synonyms without resolving anything.
- Update `pmourlsource/src/handlers/generic.rs` to add support for parsing `.m3u`, `.m3u8`, and `.pls` files into Playlists, while removing `.xspf` support and adding logic to fetch RSS Playlists from `text/html` content containing `<link type="application/rss+xml">`.
- Add `pmocache/src/tests/test_db_aliases.rs` with comprehensive tests for alias resolution, including handling of permanent IDs, synonyms, lazy/non-lazy ordering, and primary key fallbacks.
- Update `pmocache/src/tests/mod.rs` to include the new `test_db_aliases` module.
Update `pmoplaylist` and `pmouniverse` to use `metadata_all_with_aliases`
and `metadata_with_aliases` instead of the non-alias variants. This ensures
that metadata lookups consider aliased identifiers, improving robustness for
track identification and source selection.

- pmoplaylist/src/api.rs: modify `playlist_track_to_response` to use
  `CacheRegistry::metadata_all_with_aliases`.
- pmoplaylist/src/handle/read.rs: update `didl_item` to use
  `CacheRegistry::metadata_all_with_aliases` and update documentation.
- pmoplaylist/src/track.rs: update `track_metadata`, `duration_secs`, and
  `string_field` to use alias-aware methods (`metadata_all_with_aliases`
  or `metadata_with_aliases`).
- pmouniverse/src/pump/mod.rs: modify `source_of` to handle "LAZY" as a
  download mode by checking the next segment, falling back to the first;
  update `source_is_the_segment_after_the_cache_name` tests and docs.
- pmouniverse/src/source/mod.rs: update `playable_id` logic to check for
  title existence using aliases via `CacheRegistry::metadata_with_aliases`.
Remove the `source` field from the `Track` schema and related logic to simplify track identification. Add a new `drift_simulation` example for analyzing vector distributions.

- Remove `source` column from `track` table in `pmouniverse/src/schema.rs` (STEP_7 migration).
- Update `NewTrack` and `Track` structs in `pmouniverse/src/track.rs` to omit the `source` field.
- Simplify `index` in `pmouniverse/src/pump/mod.rs` by removing `source_of` argument; remove `source_of` definition.
- Update `identify_known` in `pmouniverse/src/identify/mod.rs` to call `upsert_track` without source.
- Adjust `play.rs` in `pmoquery/bench-embed` to ignore `source` field and update TSV documentation.
- Update test assertions in `pmouniverse/tests` (annotate, change_space, identify, migration, pump, universe) to reflect schema changes.
- Add `drift_simulation.rs` example with vector simulation logic (`simulate`, `centroid`, etc.).
- Update `Cargo.lock` dependencies for `bench-embed`.
refactor: migrate audio output from pmoaudio to pmosound
All checks were successful
Release / create-release (push) Successful in 12s
Release / apk (push) Successful in 4m31s
088573d218
Migrate the `AudioSink` implementation from `pmoaudio` to a new `pmosound` crate, replacing it with `FlacFileSink`. The `pmosound` crate introduces platform-specific outputs (ALSA on Linux, CPAL on macOS) and a shared PCM queue for buffering.

- Move `is_empty` and `new` from `pmoaudio/src/nodes/audio_sink.rs` to `pmosound/src/pcm_queue.rs`.
- Delete `pmoaudio/src/nodes/audio_sink.rs`, removing `AudioSink` and its associated buffer logic.
- Add `pmosound/src/cpal_output.rs` implementing `CpalOutput` for non-Linux platforms using CPAL.
- Add `pmosound/src/pcm_queue.rs` with `PcmQueue` struct for blocking PCM buffering.
- Update `pmoaudio` to use `FlacFileSink` instead of `AudioSink` in examples and pipeline definitions.
- Remove `cpal` dependency from `pmoaudio/Cargo.toml`.
- Add `cpal` dependency to `pmosound/Cargo.toml` for non-Linux targets.
- Update `pmosound-config` to use generic `device` key instead of `alsa_device`.
- Update `INSTALL_LIBSOXR.md` and `INSTALL_NOTES.md` to reflect `pmosound` dependencies.
- Update `devstack/README.md` with OrbStack sound device configuration details.
- Delete `pmoaudio/examples/play_audio.rs` and `play_with_resampling.rs`.
- Delete `pmoaudio/WHY_CPAL.md` as the rationale is now part of `pmosound`.
- Bump versions for `PMOMusic`, `pmoconfig`, and `pmosound`.
eric merged commit ef140b43f9 into main 2026-11-16 10:15:49 +01:00
eric deleted branch push-xmsxusvrqurk 2026-11-16 10:16:05 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pmo/pmomusic!177
No description provided.