function playlistProc(file) { var playlist = file.split("\n"); for(var x = 0; x < playlist.length; x++) { var e1 = playlist[x], e2 = playlist[x+1]; if(e1.substr(0,7) != '#EXTM3U') { var info='', thefile=''; if(e1.substr(0,8) == '#EXTINF:') { info = e1.substr(e1.indexOf(',')+1); thefile = e2; } else thefile = e1; } //do stuff with 'info' and 'thefile' } }