/fm: status line above the picture, with a custom previous icon
The picture's own status is easy to miss, so now playing and last played are said in text again, using the playing emoji or the new previous icon. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
0caa212e59
commit
0416e4eb56
4 changed files with 13 additions and 7 deletions
BIN
assets/emojis/dz_previous.png
Normal file
BIN
assets/emojis/dz_previous.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
1
assets/emojis/dz_previous.svg
Normal file
1
assets/emojis/dz_previous.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="128" height="128"><path d="M20 5v14a1 1 0 0 1-1.5.86L8 13.2V19a1 1 0 0 1-2 0V5a1 1 0 0 1 2 0v5.8l10.5-6.66A1 1 0 0 1 20 5Z" fill="#f2f2f4"/></svg>
|
||||
|
After Width: | Height: | Size: 213 B |
|
|
@ -72,12 +72,17 @@ pub async fn now_playing(b: &Base) -> Result<(Component, Option<Vec<u8>>), Error
|
|||
let picture = super::art::now_playing(&super::art::Now { status, title: title.to_string(), artist: artist.to_string(), album: album.map(str::to_string), accent, cover: art_image, stats, previous });
|
||||
let mut links = vec![link(&truncate(title, 60), track["url"].as_str()), link(artist, Some(&fm_url(&[artist])))];
|
||||
links.push(format!("[{}](<https://www.last.fm/user/{}>)", escape(&b.username), b.username));
|
||||
if !playing {
|
||||
if let Some(uts) = track["date"]["uts"].as_str() {
|
||||
links.push(format!("<t:{uts}:R>"));
|
||||
// said in words too: the status inside the picture is easy to miss
|
||||
let heading = if playing {
|
||||
format!("-# {PLAYING_EMOJI} Now playing · {}", escape(&b.name))
|
||||
} else {
|
||||
let previous = crate::emojis::in_text("⏮️");
|
||||
match track["date"]["uts"].as_str() {
|
||||
Some(uts) => format!("-# {previous} Last played <t:{uts}:R> · {}", escape(&b.name)),
|
||||
None => format!("-# {previous} Last played · {}", escape(&b.name)),
|
||||
}
|
||||
}
|
||||
let mut card = Card::new(Some(accent)).gallery(&[&format!("attachment://{}", super::art::FILE)]).footer(&links.join(" · "));
|
||||
};
|
||||
let mut card = Card::new(Some(accent)).text(&heading).gallery(&[&format!("attachment://{}", super::art::FILE)]).footer(&links.join(" · "));
|
||||
if let Some(url) = track["url"].as_str().filter(|u| track_from_url(u).is_some()) {
|
||||
let go = twilight_model::channel::message::component::Button { id: None, custom_id: None, disabled: false, emoji: Some(twilight_model::channel::message::EmojiReactionType::Unicode { name: "🎵".into() }), label: Some("Go to song".into()), style: ButtonStyle::Link, url: Some(url.into()), sku_id: None };
|
||||
let mut listen = button("fm:listen", "Listen to song", ButtonStyle::Primary);
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ use twilight_model::id::marker::EmojiMarker;
|
|||
use twilight_model::id::Id;
|
||||
|
||||
/// The plain emoji the code uses, and the icon that replaces it.
|
||||
const ICONS: [(&str, &str); 30] = [
|
||||
const ICONS: [(&str, &str); 31] = [
|
||||
("▶️", "play"), ("⏸️", "pause"), ("⏭️", "skip"), ("⏹️", "stop"), ("🔁", "repeat"), ("🔂", "repeat_one"), ("🔀", "shuffle"), ("📜", "queue"), ("🔉", "vol_down"), ("🔊", "vol_up"),
|
||||
("🔗", "link"), ("👋", "leave"), ("👑", "heads"), ("🦅", "tails"), ("🃏", "hit"), ("✋", "stand"), ("✖️", "double"), ("🎰", "spin"), ("🔄", "spin"), ("🔴", "red"), ("⚫", "black"), ("🟢", "green"),
|
||||
("🪙", "coin"), ("✅", "check"), ("❌", "cross"), ("⬆️", "up"), ("⬇️", "down"), ("🏳️", "flag"), ("🚩", "flag"), ("💰", "coin"),
|
||||
("🪙", "coin"), ("✅", "check"), ("❌", "cross"), ("⬆️", "up"), ("⬇️", "down"), ("🏳️", "flag"), ("🚩", "flag"), ("💰", "coin"), ("⏮️", "previous"),
|
||||
];
|
||||
|
||||
fn uploaded() -> &'static RwLock<HashMap<String, Id<EmojiMarker>>> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue