优化m3u文件转换工具
This commit is contained in:
parent
805b3c41c8
commit
4a234e8829
@ -33,10 +33,11 @@ function convertToJSON() {
|
||||
var musicsArray = [];
|
||||
var currentName = '';
|
||||
lines.forEach(function(line) {
|
||||
if (line.startsWith('#EXTINF:-1,')) {
|
||||
currentName = line.substring(11).trim();
|
||||
line = line.trim();
|
||||
if (line.startsWith('#EXTINF:')) {
|
||||
currentName = line.replace(/.*,/g, '');
|
||||
} else if (line.startsWith('http') && currentName !== '') {
|
||||
musicsArray.push({"name": currentName, "type": "radio", "url": line.trim()});
|
||||
musicsArray.push({"name": currentName, "type": "radio", "url": line});
|
||||
currentName = ''; // Reset the name for the next entry
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user