Format
This commit is contained in:
@@ -311,11 +311,10 @@ pub async fn enrich_artist(
|
|||||||
(a, Some(local_id), mbid)
|
(a, Some(local_id), mbid)
|
||||||
} else {
|
} else {
|
||||||
// Look up artist info from MusicBrainz by MBID — don't create a local record
|
// Look up artist info from MusicBrainz by MBID — don't create a local record
|
||||||
let info = state
|
let info =
|
||||||
.mb_client
|
state.mb_client.get_artist_info(&mbid).await.map_err(|e| {
|
||||||
.get_artist_info(&mbid)
|
ApiError::NotFound(format!("artist MBID {mbid} not found: {e}"))
|
||||||
.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)
|
// Create a synthetic artist object for display only (not saved to DB)
|
||||||
let synthetic = shanty_db::entities::artist::Model {
|
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(Some(json)) = queries::cache::get(state.db.conn(), &cache_key).await {
|
||||||
if let Ok(cached) = serde_json::from_str::<serde_json::Value>(&json) {
|
if let Ok(cached) = serde_json::from_str::<serde_json::Value>(&json) {
|
||||||
return (
|
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),
|
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");
|
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)
|
// Parse article title from URL (e.g., https://en.wikipedia.org/wiki/Pink_Floyd → Pink_Floyd)
|
||||||
let title = wiki_url
|
let title = wiki_url.split("/wiki/").nth(1).unwrap_or("").to_string();
|
||||||
.split("/wiki/")
|
|
||||||
.nth(1)
|
|
||||||
.unwrap_or("")
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
if title.is_empty() {
|
if title.is_empty() {
|
||||||
return (None, None);
|
return (None, None);
|
||||||
|
|||||||
Reference in New Issue
Block a user