(session: &GlobalSystemMediaTransportControlsSession)
| 16 | const CACHE_TTL: Duration = Duration::from_secs(3); |
| 17 | |
| 18 | pub fn is_spotify(session: &GlobalSystemMediaTransportControlsSession) -> Result<bool> { |
| 19 | let app_id = session.SourceAppUserModelId()?; |
| 20 | let app_id = app_id.to_string(); |
| 21 | |
| 22 | Ok( |
| 23 | app_id == "Spotify.exe" |
| 24 | || (app_id.starts_with("SpotifyAB") && app_id.ends_with("!Spotify")), |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | pub fn get_spotify_session() -> Result<Option<GlobalSystemMediaTransportControlsSession>> { |
| 29 | let mut cache = SPOTIFY_SESSION_CACHE.lock().unwrap(); |
no outgoing calls
no test coverage detected