2019-04-01 04:02:26 +08:00
|
|
|
const SEPARATOR = " · ";
|
|
|
|
|
2019-03-22 22:35:04 +08:00
|
|
|
export function time(sec) {
|
|
|
|
sec = Math.round(sec);
|
|
|
|
let m = Math.floor(sec / 60);
|
|
|
|
let s = sec % 60;
|
|
|
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
|
|
}
|
2019-03-22 23:17:10 +08:00
|
|
|
|
2019-04-01 04:02:26 +08:00
|
|
|
export function subtitle(data) {
|
2019-03-22 23:17:10 +08:00
|
|
|
let tokens = [];
|
2019-04-01 04:02:26 +08:00
|
|
|
data["Artist"] && tokens.push(data["Artist"]);
|
|
|
|
data["Album"] && tokens.push(data["Album"]);
|
|
|
|
data["duration"] && tokens.push(time(Number(data["duration"])));
|
|
|
|
return tokens.join(SEPARATOR);
|
2019-03-22 23:17:10 +08:00
|
|
|
}
|