Plugin 1.2.0: Taste 'Gefaellt mir nicht', Fortschrittsbalken auf 'Aktueller Titel'
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+15
-1
@@ -103,8 +103,22 @@ function buildInfoSvg(view) {
|
||||
return `${head}${parts.join('')}</svg>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normale Taste "Aktueller Titel": Cover mit duennem Fortschrittsbalken oben (unten steht der Titel).
|
||||
* @param {string} coverDataUri
|
||||
* @param {number} ratio - 0..1
|
||||
*/
|
||||
function buildCoverProgressSvg(coverDataUri, ratio) {
|
||||
const clamped = Math.max(0, Math.min(1, Number(ratio) || 0));
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" width="${SIZE}" height="${SIZE}" viewBox="0 0 ${SIZE} ${SIZE}">`
|
||||
+ `<rect width="${SIZE}" height="${SIZE}" fill="${BACKGROUND}"/>`
|
||||
+ `<image x="0" y="0" width="${SIZE}" height="${SIZE}" preserveAspectRatio="xMidYMid slice" href="${coverDataUri}"/>`
|
||||
+ `<rect x="0" y="0" width="${SIZE}" height="7" fill="#000" fill-opacity="0.55"/>`
|
||||
+ `<rect x="0" y="0" width="${(SIZE * clamped).toFixed(1)}" height="7" fill="${ACCENT}"/></svg>`;
|
||||
}
|
||||
|
||||
function svgToDataUri(svg) {
|
||||
return `data:image/svg+xml;base64,${Buffer.from(svg, 'utf8').toString('base64')}`;
|
||||
}
|
||||
|
||||
module.exports = { buildInfoSvg, svgToDataUri, formatTime, SIZE };
|
||||
module.exports = { buildInfoSvg, buildCoverProgressSvg, svgToDataUri, formatTime, SIZE };
|
||||
|
||||
Reference in New Issue
Block a user