This commit is contained in:
Connor Johnstone
2026-03-19 14:55:27 -04:00
parent 51bcf26482
commit ee60076f70

View File

@@ -311,11 +311,10 @@ pub async fn enrich_artist(
(a, Some(local_id), mbid)
} else {
// Look up artist info from MusicBrainz by MBID — don't create a local record
let info = state
.mb_client
.get_artist_info(&mbid)
.await
.map_err(|e| ApiError::NotFound(format!("artist MBID {mbid} not found: {e}")))?;
let info =
state.mb_client.get_artist_info(&mbid).await.map_err(|e| {
ApiError::NotFound(format!("artist MBID {mbid} not found: {e}"))
})?;
// Create a synthetic artist object for display only (not saved to DB)
let synthetic = shanty_db::entities::artist::Model {
@@ -627,7 +626,10 @@ async fn fetch_wikipedia_data(
if let Ok(Some(json)) = queries::cache::get(state.db.conn(), &cache_key).await {
if let Ok(cached) = serde_json::from_str::<serde_json::Value>(&json) {
return (
cached.get("photo_url").and_then(|v| v.as_str()).map(String::from),
cached
.get("photo_url")
.and_then(|v| v.as_str())
.map(String::from),
cached.get("bio").and_then(|v| v.as_str()).map(String::from),
);
}
@@ -655,11 +657,7 @@ async fn fetch_wikipedia_data(
tracing::debug!(mbid = mbid, wiki_url = %wiki_url, "found wikipedia URL");
// Parse article title from URL (e.g., https://en.wikipedia.org/wiki/Pink_Floyd → Pink_Floyd)
let title = wiki_url
.split("/wiki/")
.nth(1)
.unwrap_or("")
.to_string();
let title = wiki_url.split("/wiki/").nth(1).unwrap_or("").to_string();
if title.is_empty() {
return (None, None);