首页 > 代码库 > temp
temp
const fs = require(‘fs‘);
fs.readFile("./mp3.lrc", ‘utf-8‘, (err, data) => {
var lines = data.split(‘\n‘);
//[00:01.00] dfgdfgfdfgfgdfgd
for (var key in lines) {
var matchArray = /\[(\d{2}):(\d{2}).(\d{2})\] (.*)/g.exec(lines[key]);
if (matchArray && matchArray.length == 5) {
var current = matchArray[1] * 60 * 1000 + matchArray[2] * 1000 + parseInt(matchArray[3]);
setTimeout(function () {
console.log(matchArray[4]);
}, current);
} else {
console.log(lines[key]);
}
}
});
const fs = require(‘fs‘);
fs.readFile("./mp3.lrc", ‘utf-8‘, (err, data) => {
var lines = data.split(‘\n‘);
//[00:01.00] dfgdfgfdfgfgdfgd
lines.forEach(function (value, index) {
var matchArray = /\[(\d{2}):(\d{2}).(\d{2})\] (.*)/g.exec(value);
if (matchArray && matchArray.length == 5) {
var current = matchArray[1] * 60 * 1000 + matchArray[2] * 1000 + parseInt(matchArray[3]);
setTimeout(function () {
console.log(matchArray[4]);
}, current);
} else {
console.log(value);
}
});
});
temp