(
lyrics: State<'_, LyricsFetcher>,
librespot: State<'_, LibrespotHolder>,
cache: State<'_, CacheHolder>,
id: String,
url: String,
artists: Vec<String>,
title: String,
)
| 32 | #[tauri_invoke_proc::parse_tauri_command] |
| 33 | #[tauri::command()] |
| 34 | pub async fn get_lyrics( |
| 35 | lyrics: State<'_, LyricsFetcher>, |
| 36 | librespot: State<'_, LibrespotHolder>, |
| 37 | cache: State<'_, CacheHolder>, |
| 38 | id: String, |
| 39 | url: String, |
| 40 | artists: Vec<String>, |
| 41 | title: String, |
| 42 | ) -> Result<String> { |
| 43 | let cache_string = format!("get_lyrics_{}_{}_{:?}_{}", id, url, artists, title); |
| 44 | |
| 45 | let cached = cache.get(&cache_string); |
| 46 | if cached.is_ok() { |
| 47 | return cached; |
| 48 | } |
| 49 | |
| 50 | let res = lyrics |
| 51 | .get_lyrics(librespot.inner(), id, url, artists, title) |
| 52 | .await?; |
| 53 | |
| 54 | let _ = cache.set(cache_string.as_str(), &res, 7200); |
| 55 | Ok(res) |
| 56 | } |
no test coverage detected