Artist photos, bios and logos from keyless public sources

- Photos from Deezer's public artist search (exact name match, most-followed artist)
- Bios from Wikipedia when the page is about a musician or band, credited under CC BY-SA
- Logos from Wikidata, kept as transparent PNGs; dark logos are flipped on dark banners
- Only fills what's empty; anything you set or remove yourself stays
- Edit artist: photo, logo, bio, remove any of them, or look them up again
- Runs quietly in the background, and right away when you open an artist
- Can be turned off in Settings, Library
This commit is contained in:
Christian
2026-11-19 00:42:55 -05:00
parent 5f212aa559
commit 559818fedd
8 changed files with 421 additions and 9 deletions
+168
View File
@@ -0,0 +1,168 @@
// atmosphere · artistinfo.rs · Finds artist photos, bios and logos from keyless public sources: Deezer, Wikipedia and Wikidata
use anyhow::Result;
use regex::Regex;
use serde_json::Value;
use std::sync::LazyLock;
use std::time::Duration;
const MAX_IMAGE: usize = 8 * 1024 * 1024;
#[derive(Default)]
pub struct Found {
pub photo: Option<Vec<u8>>,
pub bio: Option<String>,
pub bio_source: Option<String>,
pub logo: Option<Vec<u8>>,
}
pub fn norm(s: &str) -> String {
s.chars().filter(|c| c.is_alphanumeric()).flat_map(char::to_lowercase).collect()
}
static MUSIC: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"(?i)\b(singer|rapper|musician|band|group|duo|trio|dj|disc jockey|producer|songwriter|composer|vocalist|guitarist|pianist|drummer|music|hip[- ]hop|rock|pop|electronic|orchestra|ensemble|artist)\b").unwrap()
});
pub fn is_music_description(d: &str) -> bool {
MUSIC.is_match(d) && !Regex::new(r"(?i)\b(album|song|single|ep|discography|film|episode|video game)\b").unwrap().is_match(d.split(" by ").next().unwrap_or(d))
}
fn title_matches(key: &str, name: &str) -> bool {
let title = key.replace('_', " ");
let base = title.split(" (").next().unwrap_or(&title);
norm(base) == norm(name)
}
async fn get_json(http: &reqwest::Client, url: &str) -> Option<Value> {
let r = http.get(url).timeout(Duration::from_secs(15)).send().await.ok()?;
if !r.status().is_success() {
return None;
}
r.json().await.ok()
}
async fn get_bytes(http: &reqwest::Client, url: &str) -> Option<Vec<u8>> {
let r = http.get(url).timeout(Duration::from_secs(20)).send().await.ok()?;
if !r.status().is_success() || r.content_length().is_some_and(|n| n as usize > MAX_IMAGE) {
return None;
}
let b = r.bytes().await.ok()?;
(b.len() <= MAX_IMAGE && !b.is_empty()).then(|| b.to_vec())
}
fn enc(s: &str) -> String {
url::form_urlencoded::byte_serialize(s.as_bytes()).collect()
}
fn path_enc(s: &str) -> String {
s.replace(' ', "_")
.bytes()
.map(|b| if b.is_ascii_alphanumeric() || b"-_.~()".contains(&b) { (b as char).to_string() } else { format!("%{b:02X}") })
.collect()
}
async fn deezer_photo(http: &reqwest::Client, name: &str) -> Option<Vec<u8>> {
let v = get_json(http, &format!("https://api.deezer.com/search/artist?q={}&limit=8", enc(name))).await?;
let want = norm(name);
let best = v["data"]
.as_array()?
.iter()
.filter(|a| a["name"].as_str().is_some_and(|n| norm(n) == want))
.filter(|a| a["picture_xl"].as_str().is_some_and(|u| !u.contains("/artist//")))
.max_by_key(|a| a["nb_fan"].as_u64().unwrap_or(0))?;
get_bytes(http, best["picture_xl"].as_str()?).await
}
async fn wikipedia(http: &reqwest::Client, name: &str) -> Option<(String, String, Option<String>)> {
let v = get_json(http, &format!("https://en.wikipedia.org/w/rest.php/v1/search/page?q={}&limit=10", enc(name))).await?;
let pages = v["pages"].as_array()?;
let pick = pages
.iter()
.filter(|p| p["key"].as_str().is_some_and(|k| title_matches(k, name)))
.find(|p| p["description"].as_str().is_some_and(is_music_description))?;
let key = pick["key"].as_str()?;
let s = get_json(http, &format!("https://en.wikipedia.org/api/rest_v1/page/summary/{}", path_enc(key))).await?;
if s["type"].as_str() != Some("standard") {
return None;
}
let extract = s["extract"].as_str()?.trim().to_string();
if extract.len() < 40 {
return None;
}
let url = s["content_urls"]["desktop"]["page"].as_str().unwrap_or_default().to_string();
Some((extract, url, s["wikibase_item"].as_str().map(String::from)))
}
async fn wikidata_file(http: &reqwest::Client, qid: &str, prop: &str) -> Option<Vec<u8>> {
if !qid.starts_with('Q') || !qid[1..].chars().all(|c| c.is_ascii_digit()) {
return None;
}
let v = get_json(http, &format!("https://www.wikidata.org/wiki/Special:EntityData/{qid}.json")).await?;
let file = v["entities"][qid]["claims"][prop][0]["mainsnak"]["datavalue"]["value"].as_str()?;
get_bytes(http, &format!("https://commons.wikimedia.org/wiki/Special:FilePath/{}?width=800", path_enc(file))).await
}
pub async fn find(http: &reqwest::Client, name: &str, want_photo: bool, want_bio: bool, want_logo: bool) -> Result<Found> {
let mut found = Found::default();
let photo = async {
if want_photo {
deezer_photo(http, name).await
} else {
None
}
};
let wiki = async {
if want_bio || want_logo || want_photo {
wikipedia(http, name).await
} else {
None
}
};
let (photo, wiki) = tokio::join!(photo, wiki);
found.photo = photo;
if let Some((bio, url, qid)) = wiki {
if want_bio {
found.bio = Some(bio);
found.bio_source = Some(url);
}
if let Some(q) = qid {
if want_logo {
found.logo = wikidata_file(http, &q, "P154").await;
}
if want_photo && found.photo.is_none() {
found.photo = wikidata_file(http, &q, "P18").await;
}
}
}
Ok(found)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn matches_names_and_music_pages_only() {
assert!(title_matches("Daft_Punk", "Daft Punk"));
assert!(title_matches("Nirvana_(band)", "Nirvana"));
assert!(!title_matches("Discovery_(Daft_Punk_album)", "Daft Punk"));
assert!(is_music_description("French electronic music duo (1993–2021)"));
assert!(is_music_description("American rapper and singer"));
assert!(!is_music_description("2001 studio album by Daft Punk"));
assert!(!is_music_description("City in France"));
assert_eq!(norm("Kühvt!"), "kühvt");
assert_eq!(path_enc("Daft Punk logo.svg"), "Daft_Punk_logo.svg");
assert_eq!(path_enc("Beyoncé"), "Beyonc%C3%A9");
}
#[tokio::test]
#[ignore]
async fn live_finds_daft_punk() {
let http = reqwest::Client::builder().user_agent("Atmosphere/test (desktop music player)").build().unwrap();
let f = find(&http, "Daft Punk", true, true, true).await.unwrap();
assert!(f.photo.is_some_and(|p| p.len() > 10_000));
assert!(f.bio.is_some_and(|b| b.contains("Daft Punk")));
assert!(f.bio_source.is_some_and(|u| u.contains("wikipedia.org")));
assert!(f.logo.is_some());
}
}
+39
View File
@@ -499,6 +499,10 @@ pub fn serve(app: &AppHandle, request: &Request<Vec<u8>>) -> Response<Vec<u8>> {
None => respond(404, "text/plain", b"unknown track".to_vec(), &[]),
},
"a" => match state.library.art_path(id) {
Some(p) if p.extension().is_some_and(|e| e == "png") => match std::fs::read(&p) {
Ok(data) => respond(200, "image/png", data, &[("Cache-Control", "max-age=86400".into())]),
Err(_) => respond(404, "text/plain", Vec::new(), &[]),
},
Some(p) => {
let data = std::fs::read(&p).unwrap_or_default();
respond(200, "image/jpeg", data, &[("Cache-Control", "max-age=86400".into())])
@@ -613,3 +617,38 @@ pub fn playlist_cover(app: AppHandle, state: State<'_, AppState>, name: String,
changed(&app);
Ok(())
}
#[tauri::command]
pub async fn artist_fetch(state: State<'_, AppState>, name: String, force: bool) -> CmdResult<Option<crate::library::ArtistMeta>> {
let s = state.snapshot();
if !s.artist_info && !force {
return Ok(None);
}
let existing = state.library.artist(&name).unwrap_or_default();
if existing.checked.is_some() && !force {
return Ok(Some(existing));
}
let want_photo = force || existing.image.is_none();
let want_bio = force || existing.bio.trim().is_empty();
let want_logo = force || existing.logo.is_none();
let found = crate::artistinfo::find(&state.http, &name, want_photo, want_bio, want_logo).await.map_err(err)?;
Ok(Some(state.library.apply_artist_info(&name, found, force)))
}
#[tauri::command]
pub async fn artist_media(app: AppHandle, state: State<'_, AppState>, name: String, kind: String, pick: bool) -> CmdResult<crate::library::ArtistMeta> {
let image = if pick {
let a = app.clone();
let title = if kind == "logo" { "Choose a logo (a transparent PNG looks best)" } else { "Choose an image" };
let picked = tauri::async_runtime::spawn_blocking(move || a.dialog().file().set_title(title).add_filter("Images", &["png", "jpg", "jpeg", "webp"]).blocking_pick_file())
.await
.map_err(|e| e.to_string())?;
match picked.and_then(|p| p.into_path().ok()) {
Some(p) => Some(p),
None => return Err("cancelled".into()),
}
} else {
None
};
state.library.artist_media(&name, &kind, image.as_deref()).map_err(err)
}
+90 -2
View File
@@ -73,6 +73,31 @@ pub struct ArtistMeta {
pub name: String,
pub image: Option<String>,
pub bio: String,
pub bio_source: Option<String>,
pub logo: Option<String>,
pub logo_dark: bool,
pub checked: Option<u64>,
}
fn save_logo(key: &str, data: &[u8]) -> Option<(String, bool)> {
let dir = art_dir();
std::fs::create_dir_all(&dir).ok()?;
let img = image::load_from_memory(data).ok()?;
let img = if img.width() > 800 { img.thumbnail(800, 400) } else { img };
let rgba = img.to_rgba8();
let (mut sum, mut n) = (0f64, 0f64);
for p in rgba.pixels() {
let a = p[3] as f64 / 255.0;
if a > 0.3 {
sum += (0.2126 * p[0] as f64 + 0.7152 * p[1] as f64 + 0.0722 * p[2] as f64) / 255.0 * a;
n += a;
}
}
let dark = n > 0.0 && sum / n < 0.35;
let mut buf = std::io::Cursor::new(Vec::new());
rgba.write_to(&mut buf, image::ImageFormat::Png).ok()?;
std::fs::write(dir.join(format!("{key}.png")), buf.into_inner()).ok()?;
Some((key.to_string(), dark))
}
#[derive(Clone, Debug, Serialize)]
@@ -284,8 +309,7 @@ impl Library {
pub fn art_path(&self, key: &str) -> Option<PathBuf> {
let safe: String = key.chars().filter(|c| c.is_ascii_alphanumeric()).collect();
let p = art_dir().join(format!("{safe}.jpg"));
p.exists().then_some(p)
["jpg", "png"].iter().map(|ext| art_dir().join(format!("{safe}.{ext}"))).find(|p| p.exists())
}
pub fn scan(&self, roots: &[PathBuf], playlists_dir: &Path, mut progress: impl FnMut(usize, usize)) -> Result<usize> {
@@ -800,6 +824,9 @@ impl Library {
meta.image = Some(save_art(&id, &data).ok_or_else(|| anyhow!("That image couldn't be read"))?);
}
if let Some(b) = bio {
if b.trim() != meta.bio.trim() {
meta.bio_source = None;
}
meta.bio = b;
}
let out = meta.clone();
@@ -807,6 +834,67 @@ impl Library {
Ok(out)
}
pub fn artist(&self, name: &str) -> Option<ArtistMeta> {
self.artists.read().unwrap().get(&artist_key(name)).cloned()
}
pub fn apply_artist_info(&self, name: &str, found: crate::artistinfo::Found, force: bool) -> ArtistMeta {
let key = artist_key(name);
let mut artists = self.artists.write().unwrap();
let meta = artists.entry(key.clone()).or_default();
meta.name = name.trim().to_string();
if let Some(photo) = found.photo.filter(|_| force || meta.image.is_none()) {
let id = format!("artistweb{key}");
let _ = std::fs::remove_file(art_dir().join(format!("{id}.jpg")));
if let Some(k) = save_art(&id, &photo) {
meta.image = Some(k);
}
}
if let Some(bio) = found.bio.filter(|_| force || meta.bio.trim().is_empty()) {
meta.bio = bio;
meta.bio_source = found.bio_source;
}
if let Some(logo) = found.logo.filter(|_| force || meta.logo.is_none()) {
if let Some((k, dark)) = save_logo(&format!("logo{key}"), &logo) {
meta.logo = Some(k);
meta.logo_dark = dark;
}
}
meta.checked = Some(now());
let out = meta.clone();
store("artists.json", &*artists);
out
}
pub fn artist_media(&self, name: &str, kind: &str, image: Option<&Path>) -> Result<ArtistMeta> {
let key = artist_key(name);
let mut artists = self.artists.write().unwrap();
let meta = artists.entry(key.clone()).or_default();
meta.name = name.trim().to_string();
meta.checked.get_or_insert(now());
match (kind, image) {
("photo", None) => meta.image = None,
("logo", None) => {
meta.logo = None;
meta.logo_dark = false;
}
("bio", None) => {
meta.bio.clear();
meta.bio_source = None;
}
("logo", Some(src)) => {
let data = std::fs::read(src).context("Couldn't read that image")?;
let (k, dark) = save_logo(&format!("logouser{key}"), &data).ok_or_else(|| anyhow!("That image couldn't be read"))?;
meta.logo = Some(k);
meta.logo_dark = dark;
}
_ => bail!("Unknown artist field"),
}
let out = meta.clone();
store("artists.json", &*artists);
Ok(out)
}
pub fn playlist_cover(&self, dir: &Path, name: &str, image: Option<&Path>) -> Result<()> {
let folder = self.folder(dir, name);
if !folder.is_dir() {
+3
View File
@@ -2,6 +2,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
mod api;
mod artistinfo;
mod backup;
mod direct;
mod downloader;
@@ -534,6 +535,8 @@ fn main() {
libcmd::playlist_link,
libcmd::track_loudness,
libcmd::tracks_edit,
libcmd::artist_fetch,
libcmd::artist_media,
libcmd::playlist_cover,
libcmd::playlist_relocate,
libcmd::playlist_unlink
+4 -1
View File
@@ -62,6 +62,7 @@ pub struct Settings {
pub cookies_file: String,
pub api_enabled: bool,
pub check_updates: bool,
pub artist_info: bool,
pub api_port: u16,
pub api_read: bool,
pub api_control: bool,
@@ -108,6 +109,7 @@ impl Default for Settings {
cookies_file: String::new(),
api_enabled: false,
check_updates: true,
artist_info: true,
api_port: 47823,
api_read: true,
api_control: true,
@@ -152,6 +154,7 @@ pub struct SettingsPatch {
pub cookies_file: Option<String>,
pub api_enabled: Option<bool>,
pub check_updates: Option<bool>,
pub artist_info: Option<bool>,
pub api_port: Option<u16>,
pub api_read: Option<bool>,
pub api_control: Option<bool>,
@@ -204,7 +207,7 @@ impl Settings {
($($f:ident),*) => { $( if let Some(v) = p.$f { self.$f = v; } )* };
}
set!(save_as, embed_metadata, collection_folders, number_tracks, skip_downloaded, sponsorblock, embed_subtitles, embed_chapters, watch_clipboard);
set!(api_enabled, api_read, api_control, api_links, check_updates);
set!(api_enabled, api_read, api_control, api_links, check_updates, artist_info);
if let Some(p) = p.api_port.filter(|p| *p >= 1024) {
self.api_port = p;
}
+1
View File
@@ -203,6 +203,7 @@
<div class="group" id="libFolders"></div>
<div class="group gap-top">
<div class="setting"><div><strong>Playlist folders live in</strong><span id="playlistsDir"></span></div></div>
<label class="setting"><div><strong>Find artist photos, bios and logos</strong><span>Looks up artist names on Deezer, Wikipedia and Wikidata, which need no account or key. Nothing else is sent, and you can change or remove anything on an artist's page.</span></div><input type="checkbox" class="switch" data-key="artistInfo" /></label>
<div class="setting" id="hiddenSongs"></div>
<label class="setting"><div><strong>Copy songs into playlists</strong><span>Off: songs are hard-linked, so they appear in the folder without using extra space (same drive only). On: real copies, which are best for syncing to phones and USB drives.</span></div><input type="checkbox" class="switch" data-key="playlistCopy" /></label>
</div>
+105 -6
View File
@@ -120,6 +120,7 @@ async function loadLibrary() {
if (!Lib.restored) {
Lib.restored = true;
Player.restore((id) => Lib.byId.get(id));
setTimeout(queueLibraryArtists, 4000);
if (state.view === "get" && !state.collections.length) openLib("home", null, false);
} else {
Player.refreshTracks((id) => Lib.byId.get(id) || null);
@@ -614,11 +615,106 @@ async function editInfo(t) {
}
}
const ArtistFetch = { queue: [], busy: false, asked: new Set() };
function setArtistMeta(name, meta) {
if (!meta) return;
const ar = Lib.artists.get(lnorm(name));
if (ar) ar.meta = meta;
if (Lib.data) Lib.data.artists = { ...(Lib.data.artists || {}), [`n:${lnorm(name)}`]: meta };
const r = Lib.route;
if (state.view === "library" && ((r.name === "artist" && r.id === lnorm(name)) || r.name === "artists" || r.name === "home")) renderLib(true);
}
async function pumpArtistInfo() {
if (ArtistFetch.busy || state.settings?.artistInfo === false) return;
const name = ArtistFetch.queue.shift();
if (!name) return;
ArtistFetch.busy = true;
try {
setArtistMeta(name, await invoke("artist_fetch", { name, force: false }));
} catch {}
ArtistFetch.busy = false;
if (ArtistFetch.queue.length) setTimeout(pumpArtistInfo, 1200);
}
function queueArtistInfo(names, first = false) {
for (const n of names) {
const k = lnorm(n);
if (!k || k === "unknown artist" || ArtistFetch.asked.has(k)) continue;
ArtistFetch.asked.add(k);
first ? ArtistFetch.queue.unshift(n) : ArtistFetch.queue.push(n);
}
pumpArtistInfo();
}
function queueLibraryArtists() {
const pending = [...Lib.artists.values()].filter((a) => !a.meta?.checked).sort((a, b) => b.tracks.length - a.tracks.length).slice(0, 300);
queueArtistInfo(pending.map((a) => a.name));
}
async function editArtist(ar) {
const bio = h("textarea", { class: "text area", rows: "6", placeholder: "A few lines about this artist…" }, ar.meta?.bio || "");
const pic = h("div", { class: "row" }, cover(artistImage(ar), "avatar sm"), h("button", { class: "btn", onclick: async () => { try { await invoke("artist_update", { name: ar.name, pickImage: true, bio: null }); toast("Artist image updated", "ok"); } catch (e) { if (errText(e) !== "cancelled") toast(errText(e), "err"); } } }, "Choose image…"));
const ok = await modal(`Edit ${ar.name}`, h("div", { class: "stack" }, pic, h("label", { class: "field" }, h("span", {}, "About"), bio)), [{ label: "Cancel", value: false }, { label: "Save", value: true, primary: true }]);
if (ok) await invoke("artist_update", { name: ar.name, pickImage: false, bio: bio.value }).catch((e) => toast(errText(e), "err"));
let meta = ar.meta || {};
const bio = h("textarea", { class: "text area", rows: "6", placeholder: "A few lines about this artist…" }, meta.bio || "");
const photo = h("div", { class: "edit-cover round" });
const logo = h("div", { class: "edit-logo" });
const draw = () => {
photo.replaceChildren(artistImage({ ...ar, meta }) ? h("img", { src: artUrl(artistImage({ ...ar, meta })), alt: "" }) : h("div", { class: "edit-cover-ph" }, icon("user")));
logo.replaceChildren(meta.logo ? h("img", { class: `artist-logo ${meta.logoDark ? "dark" : ""}`, src: artUrl(meta.logo), alt: "" }) : h("span", { class: "muted small" }, "No logo. The name is shown as text."));
};
const act = (kind, pick) => async () => {
try {
meta = await invoke("artist_media", { name: ar.name, kind, pick });
setArtistMeta(ar.name, meta);
draw();
} catch (e) {
if (errText(e) !== "cancelled") toast(errText(e), "err");
}
};
const pickPhoto = async () => {
try {
meta = await invoke("artist_update", { name: ar.name, pickImage: true, bio: null });
setArtistMeta(ar.name, meta);
draw();
} catch (e) {
if (errText(e) !== "cancelled") toast(errText(e), "err");
}
};
const refresh = h("button", { class: "btn small ghost", type: "button", onclick: async (e) => {
const b = e.currentTarget;
b.disabled = true;
b.textContent = "Looking it up…";
try {
const m = await invoke("artist_fetch", { name: ar.name, force: true });
if (m) {
meta = m;
bio.value = m.bio || "";
setArtistMeta(ar.name, m);
draw();
toast(m.image || m.bio || m.logo ? "Updated from Deezer and Wikipedia" : "Nothing found online for this name", m.image || m.bio || m.logo ? "ok" : "");
}
} catch (x) {
toast(errText(x), "err");
}
b.disabled = false;
b.textContent = "Look up online again";
} }, "Look up online again");
draw();
const body = h("div", { class: "stack" },
h("div", { class: "edit-cover-row" }, photo, h("div", { class: "stack" }, h("strong", {}, "Photo"),
h("div", { class: "row" }, h("button", { class: "btn small", type: "button", onclick: pickPhoto }, "Choose image…"), h("button", { class: "btn small ghost", type: "button", onclick: act("photo", false) }, "Remove")))),
h("div", { class: "stack" }, h("strong", {}, "Logo"), logo,
h("div", { class: "row" }, h("button", { class: "btn small", type: "button", onclick: act("logo", true) }, "Choose logo…"), h("button", { class: "btn small ghost", type: "button", onclick: act("logo", false) }, "Remove"))),
h("label", { class: "field" }, h("span", {}, "About"), bio),
h("div", { class: "row between" }, h("p", { class: "muted small" }, "Photos come from Deezer and bios and logos from Wikipedia, when found. Anything you change here stays."), refresh));
const ok = await modal(`Edit ${ar.name}`, body, [{ label: "Cancel", value: false }, { label: "Save", value: true, primary: true }]);
if (ok && bio.value !== (meta.bio || "")) {
try {
setArtistMeta(ar.name, await invoke("artist_update", { name: ar.name, pickImage: false, bio: bio.value }));
} catch (e) {
toast(errText(e), "err");
}
}
}
/* views */
@@ -770,7 +866,7 @@ function artistView(root, key) {
cover(img, "avatar", ar.name),
h("div", { class: "hero-meta" },
h("div", { class: "kind-line" }, h("span", { class: "kind-btn", style: "cursor:default" }, icon("user"), "Artist")),
h("h1", { class: "hero-title big" }, ar.name),
ar.meta?.logo ? h("h1", { class: "hero-title big has-logo" }, h("img", { class: `artist-logo ${ar.meta.logoDark ? "dark" : ""}`, src: artUrl(ar.meta.logo), alt: ar.name })) : h("h1", { class: "hero-title big" }, ar.name),
h("p", { class: "view-sub" }, [plural(ar.tracks.length, "song"), ar.albums.length && plural(ar.albums.length, "release"), plays && plural(plays, "play")].filter(Boolean).join(" · ")),
h("div", { class: "row" }, ...playBtns(ar.tracks), h("button", { class: "btn ghost", onclick: () => editArtist(ar) }, icon("pencil"), "Edit profile"))))
);
@@ -780,7 +876,10 @@ function artistView(root, key) {
if (full.length) body.append(h("section", {}, h("h2", { class: "sec" }, "Albums"), h("div", { class: "grid" }, ...full.map(albumCard))));
if (small.length) body.append(h("section", {}, h("h2", { class: "sec" }, "Singles & EPs"), h("div", { class: "grid" }, ...small.map(albumCard))));
if (ar.featured.length) body.append(h("section", {}, h("h2", { class: "sec" }, "Featured on"), h("div", { class: "grid" }, ...ar.featured.map(featuredCard))));
body.append(h("section", { class: "about" }, h("h2", { class: "sec" }, "About"), ar.meta?.bio ? h("p", { class: "bio" }, ar.meta.bio) : h("button", { class: "link muted", onclick: () => editArtist(ar) }, "Add a bio and photo for this artist")));
body.append(h("section", { class: "about" }, h("h2", { class: "sec" }, "About"),
ar.meta?.bio ? h("p", { class: "bio" }, ar.meta.bio) : h("button", { class: "link muted", onclick: () => editArtist(ar) }, "Add a bio and photo for this artist"),
ar.meta?.bio && ar.meta?.bioSource ? h("button", { class: "link muted small source", onclick: () => invoke("open_link", { url: ar.meta.bioSource }).catch(() => {}) }, "From Wikipedia, under CC BY-SA") : null));
if (!ar.meta?.checked) queueArtistInfo([ar.name], true);
root.append(body);
}
+11
View File
@@ -1118,3 +1118,14 @@ body.mini-mode > *:not(#mini):not(.toasts):not(.modal-wrap):not(script) { displa
.edit-cover-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); }
.edit-cover-ph .i svg { width: 32px; height: 32px; }
.fields input::placeholder { color: var(--text-3); font-size: 12px; }
/* artist logos and sources */
.hero-title.has-logo { line-height: 0; }
.artist-logo { display: block; max-height: 96px; max-width: min(460px, 100%); object-fit: contain; object-position: left center; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.35)); }
.artist-logo.dark { filter: invert(1) drop-shadow(0 4px 18px rgba(0, 0, 0, 0.35)); }
.edit-logo { min-height: 56px; padding: 10px 14px; border-radius: 10px; background: #12141b; border: 1px solid var(--hairline); display: flex; align-items: center; }
.edit-logo .artist-logo { max-height: 48px; }
.edit-cover.round { border-radius: 50%; }
.about .source { margin-top: var(--s2); font-size: 12px; }
.row.between { justify-content: space-between; align-items: center; gap: var(--s3); }
.row.between p { margin: 0; flex: 1; }