mirror of
https://github.com/hanxi/xiaomusic.git
synced 2025-12-16 16:38:16 +08:00
优化m3u文件转换工具
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user