diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-16 11:43:32 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-16 11:43:32 +0200 |
| commit | 04add15691578316ff3da5b5a07d05b314488370 (patch) | |
| tree | 458b1066001697faa75466d51c7dfd9008ccac16 /src/cli.rs | |
| parent | aesthetic changes (diff) | |
| download | rsplayer-04add15691578316ff3da5b5a07d05b314488370.tar.gz rsplayer-04add15691578316ff3da5b5a07d05b314488370.zip | |
Add scrobbling support (Last.fm + ListenBrainz) and rsp settings reload
- Full Last.fm API implementation with MD5 signing (track.updateNowPlaying, track.scrobble)
- Full ListenBrainz API implementation (/1/submit-listens for playing_now and single)
- ScrobbleState in daemon tracking track, start time, and unix timestamp per play
- Scrobble threshold: ≥30s play AND (≥half duration OR ≥4 min)
- Duration extraction from symphonia codec params into AudioMetadata and Track
- Token validation at daemon startup and on config change
- ListenBrainz token valid (user: Salmonium) command to re-read config from disk (avoids token in shell history)
- Desktop notifications for token validation results
- Empty-credential filtering (empty string = no-op)
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -105,6 +105,8 @@ pub enum SettingsCommands { | |||
| 105 | #[arg(value_name = "KEY")] | 105 | #[arg(value_name = "KEY")] |
| 106 | key: String, | 106 | key: String, |
| 107 | }, | 107 | }, |
| 108 | /// Reload config from disk (re-reads config file, re-validates scrobbling tokens) | ||
| 109 | Reload, | ||
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | impl Cli { | 112 | impl Cli { |
| @@ -199,6 +201,9 @@ impl Cli { | |||
| 199 | SettingsCommands::Set { key, value } => { | 201 | SettingsCommands::Set { key, value } => { |
| 200 | config.set(key, value)?; | 202 | config.set(key, value)?; |
| 201 | config.save()?; | 203 | config.save()?; |
| 204 | if key == "listenbrainz_token" { | ||
| 205 | let _ = crate::daemon::send_command("validate".to_string()); | ||
| 206 | } | ||
| 202 | } | 207 | } |
| 203 | SettingsCommands::List => { | 208 | SettingsCommands::List => { |
| 204 | config.list(); | 209 | config.list(); |
| @@ -207,6 +212,9 @@ impl Cli { | |||
| 207 | config.unset(key)?; | 212 | config.unset(key)?; |
| 208 | config.save()?; | 213 | config.save()?; |
| 209 | } | 214 | } |
| 215 | SettingsCommands::Reload => { | ||
| 216 | let _ = crate::daemon::send_command("reload".to_string()); | ||
| 217 | } | ||
| 210 | } | 218 | } |
| 211 | } | 219 | } |
| 212 | Commands::Completions { shell } => { | 220 | Commands::Completions { shell } => { |
