feat(kion_music): add configurable My Mix settings and improvements (#3145)
* feat(kion_music): add configurable My Mix settings and improvements
Add comprehensive configuration options for My Mix (radio) feature and
various provider improvements synchronized from Yandex Music provider.
## New Features
### My Mix Configuration
- `my_mix_max_tracks`: Maximum tracks for My Mix playlist (default: 150)
- `my_mix_batch_size`: API batch count for Browse/Discover (default: 3)
- `track_batch_size`: Track details batch size (default: 50)
- `discovery_initial_tracks`: Initial tracks in Discover section (default: 5)
- `browse_initial_tracks`: Initial tracks when browsing My Mix (default: 15)
### Feature Toggles (Advanced, disabled by default)
- `enable_recommendations`: Show My Mix in Discover/Recommendations
- `enable_my_mix_browse`: Show My Mix folder in Browse section
- `enable_my_mix_playlist`: Show My Mix as virtual playlist
- `enable_my_mix_radio`: Enable radio feedback (like/dislike)
### Base URL Configuration (Advanced)
- `base_url`: Configurable API endpoint (default: https://music.mts.ru/ya_proxy_api)
- Fixes connection issue from endpoint change (/ya_api → /ya_proxy_api)
## Provider Improvements
### API Client
- Add batching for liked albums/tracks fetching
- Add retry logic for network errors
- Add My Mix tracks fetching with batch_id support
- Add radio station feedback support
- Accept optional base_url parameter
- Use DEFAULT_BASE_URL constant
### Provider Features
- Add SIMILAR_TRACKS and RECOMMENDATIONS features
- Add My Mix as virtual playlist (playlist_id: "my_mix")
- Add radio feedback for track started/finished/like/dislike
- Add duplicate track filtering in My Mix
- Add locale-based browse folder names (Russian/English)
- Conditional feature enabling based on config
### Streaming
- Add quality selection logic for FLAC/AAC/MP3
- Add content type detection for audio formats
- Support for flac-mp4 and aac-mp4 formats
### Parsers
- Add radio track ID parsing (track_id@station_id format)
- Improve external URL generation for artists/albums/tracks/playlists
- Use music.mts.ru domain
## Testing
- Add test_streaming.py (7 tests for quality selection)
- Add test_my_mix.py (2 tests for radio ID parsing)
- Update test_api_client.py (8 tests for batching/retry/My Mix)
- Update test_parsers.py (16 tests with snapshots)
- All 44 tests pass ✅
## Constants
- Add My Mix configuration keys
- Add DEFAULT_BASE_URL constant
- Add ROTOR_STATION_MY_MIX constant
- Add MY_MIX_PLAYLIST_ID constant
- Add RADIO_TRACK_ID_SEP constant
- Add browse folder name dictionaries
This brings KION Music provider feature parity with Yandex Music provider
while maintaining MTS-specific branding and API endpoints.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(kion_music): use DEFAULT_BASE_URL when base_url not provided
Set self._base_url to DEFAULT_BASE_URL if base_url parameter is None
in KionMusicClient.__init__(). This ensures tests pass and the client
always has a valid base URL.
Fixes test_connect_sets_base_url failure in CI.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address PR #3145 review comments
- Remove all tuning/toggle config entries; use hardcoded constants with
sane defaults (all features always enabled)
- Fix documentation URL (beta.music-assistant.io → music-assistant.io)
- Extract magic string to ROTOR_FEEDBACK_FROM constant with comment
- Switch from private client._request to public client.request
- Update docstrings: Yandex → KION / generic wording
- Fix test import path (yandex_music → kion_music)
- Refactor duplicated My Mix code into shared _fetch_my_mix_tracks()
helper; browse(), _get_my_mix_playlist_tracks(), recommendations()
are now thin wrappers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Increase Discovery initial tracks to 20 and cache to 10 minutes
Show more tracks in Discovery on Home and reduce API load by caching
recommendations for 10 minutes instead of 1 minute.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address Copilot review comments and improve robustness
- Use == instead of is for dict comparison (BROWSE_NAMES_RU)
- Remove dead _get_content_type stub in parsers.py, inline ContentType.UNKNOWN
- Add AAC variants (aac-mp4, he-aac, he-aac-mp4) to streaming content type mapping
- Fix cache key collision: normalize composite track IDs before caching
- Add retry with reconnect to get_track_file_info_lossless
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: trudenboy0 <trudenboy0@gmail.com>