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