fix(share): use Qobuz track URL for song.link instead of ISRC
Odesli API doesn't support direct ISRC lookup. Changed to use Qobuz track URL (https://open.qobuz.com/track/{id}) which Odesli can properly resolve to song.link.
This commit is contained in:
1 parent
2efa107aa7
commit
657682fc5e
3 files changed
+21
-46
No files matched your search
@@ -2,29 +2,20 @@
|
||||
|
||||
use tauri::State;
|
||||
|
||||
use crate::share::{ShareError, SongLinkClient, SongLinkResponse};
|
||||
use crate::share::{ShareError, SongLinkResponse};
|
||||
use crate::AppState;
|
||||
|
||||
/// Get song.link URL for a track
|
||||
/// Requires ISRC to be present in the track metadata
|
||||
/// Get song.link URL for a track using Qobuz track ID
|
||||
#[tauri::command]
|
||||
pub async fn share_track_songlink(
|
||||
isrc: Option<String>,
|
||||
track_id: u64,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<SongLinkResponse, String> {
|
||||
let isrc = isrc.ok_or_else(|| {
|
||||
ShareError::MissingIsrc.to_string()
|
||||
})?;
|
||||
|
||||
if isrc.is_empty() {
|
||||
return Err(ShareError::MissingIsrc.to_string());
|
||||
}
|
||||
|
||||
log::info!("Command: share_track_songlink ISRC={}", isrc);
|
||||
log::info!("Command: share_track_songlink track_id={}", track_id);
|
||||
|
||||
state
|
||||
.songlink
|
||||
.get_by_isrc(&isrc)
|
||||
.get_by_track_id(&track_id.to_string())
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user