mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
feat(core): add Discord presence service and extract Jellyfin runtime composition
Introduce Discord presence runtime support and continue composition-root decomposition by moving Jellyfin wiring into dedicated composer modules. This keeps main runtime orchestration thinner while preserving behavior and test coverage across config, runtime, and docs updates.
This commit is contained in:
@@ -76,6 +76,7 @@ The configuration file includes several main sections:
|
||||
- [**Jimaku**](#jimaku) - Jimaku API configuration and defaults
|
||||
- [**AniList**](#anilist) - Optional post-watch progress updates
|
||||
- [**Jellyfin**](#jellyfin) - Optional Jellyfin auth, library listing, and playback launch
|
||||
- [**Discord Rich Presence**](#discord-rich-presence) - Optional Discord activity card updates
|
||||
- [**Keybindings**](#keybindings) - MPV command shortcuts
|
||||
- [**Runtime Option Palette**](#runtime-option-palette) - Live, session-only option toggles
|
||||
- [**Secondary Subtitles**](#secondary-subtitles) - Dual subtitle track support
|
||||
@@ -479,8 +480,6 @@ Jellyfin integration is optional and disabled by default. When enabled, SubMiner
|
||||
"enabled": true,
|
||||
"serverUrl": "http://127.0.0.1:8096",
|
||||
"username": "",
|
||||
"accessToken": "",
|
||||
"userId": "",
|
||||
"remoteControlEnabled": true,
|
||||
"remoteControlAutoConnect": true,
|
||||
"autoAnnounce": false,
|
||||
@@ -535,6 +534,57 @@ Launcher subcommand equivalents:
|
||||
|
||||
Jellyfin remote auto-connect runs only when all three are `true`: `jellyfin.enabled`, `jellyfin.remoteControlEnabled`, and `jellyfin.remoteControlAutoConnect`.
|
||||
|
||||
### Discord Rich Presence
|
||||
|
||||
Discord Rich Presence is optional and disabled by default. When enabled, SubMiner publishes a polished activity card that reflects current media title, playback state, and session timer.
|
||||
|
||||
```json
|
||||
{
|
||||
"discordPresence": {
|
||||
"enabled": true,
|
||||
"clientId": "123456789012345678",
|
||||
"detailsTemplate": "Watching {title}",
|
||||
"stateTemplate": "{status}",
|
||||
"largeImageKey": "subminer-logo",
|
||||
"largeImageText": "SubMiner",
|
||||
"smallImageKey": "study",
|
||||
"smallImageText": "Sentence Mining",
|
||||
"buttonLabel": "GitHub",
|
||||
"buttonUrl": "https://github.com/sudacode/SubMiner",
|
||||
"updateIntervalMs": 15000,
|
||||
"debounceMs": 750
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Option | Values | Description |
|
||||
| ------------------ | --------------- | ---------------------------------------------------------------------------------- |
|
||||
| `enabled` | `true`, `false` | Enable Discord Rich Presence updates (default: `false`) |
|
||||
| `clientId` | string | Discord application client ID |
|
||||
| `detailsTemplate` | string | Card details line template. Supports `{title}`, `{file}`, `{subtitle}`, `{status}` |
|
||||
| `stateTemplate` | string | Card state line template. Supports `{title}`, `{file}`, `{subtitle}`, `{status}` |
|
||||
| `largeImageKey` | string | Large image asset key uploaded to your Discord app |
|
||||
| `largeImageText` | string | Hover text for large image |
|
||||
| `smallImageKey` | string | Small image asset key uploaded to your Discord app |
|
||||
| `smallImageText` | string | Hover text for small image |
|
||||
| `buttonLabel` | string | Optional button label (requires valid `buttonUrl`) |
|
||||
| `buttonUrl` | string (URL) | Optional button URL shown on the activity card |
|
||||
| `updateIntervalMs` | number | Minimum interval between activity updates in milliseconds |
|
||||
| `debounceMs` | number | Debounce window for bursty playback events in milliseconds |
|
||||
|
||||
Setup steps:
|
||||
|
||||
1. Create a Discord application at <https://discord.com/developers/applications>.
|
||||
2. Open **Rich Presence > Art Assets** and upload image assets referenced by `largeImageKey` / `smallImageKey`.
|
||||
3. Copy the application ID into `discordPresence.clientId`.
|
||||
4. Set `discordPresence.enabled` to `true` and restart SubMiner.
|
||||
|
||||
Troubleshooting:
|
||||
|
||||
- If the card does not appear, verify Discord desktop app is running and `clientId` is correct.
|
||||
- If images do not render, confirm asset keys exactly match uploaded Discord asset names.
|
||||
- If Discord is closed/not installed/disconnects, SubMiner continues running and quietly skips presence updates.
|
||||
|
||||
### Keybindings
|
||||
|
||||
Add a `keybindings` array to configure keyboard shortcuts that send commands to mpv:
|
||||
|
||||
Reference in New Issue
Block a user