punktdateien/kde/plasma/plasmoids/com.siezi.plasma.mpdWidget/contents/scripts/formatHelpers.js

37 lines
704 B
JavaScript
Raw Normal View History

2024-02-14 21:14:16 +01:00
.pragma library
function title(mpdItem) {
let title = mpdItem.title;
if (mpdItem.tracknumber)
title = mpdItem.tracknumber + ". " + title;
return title;
}
function artist(mpdItem) {
return mpdItem.artist || mpdItem.albumartist || "";
}
function album(mpdItem) {
let album = mpdItem.album || "";
if (album && mpdItem.date)
album += " (" + mpdItem.date + ")";
return album
}
function queueAlbumLine(model) {
let line = []
line.push(model.tracknumber ? model.tracknumber + ". " : "")
if (model.album) {
line.push(model.album + " ")
}
if (model.time) {
line.push("(" + model.time + ")")
}
return line.join("")
}