private void parsePlaylist(String uri, InputStream stream, Playlist playlist) throws IOException, JPlaylistParserException {
        String line = null;
        BufferedReader reader = null;
        PlaylistEntry playlistEntry = null;
        
        String host = getHost(uri);
        
		// Start the query
		reader = new BufferedReader(new InputStreamReader(stream));
        
		while ((line = reader.readLine()) != null) {
			if (!(line.equalsIgnoreCase(EXTENDED_INFO_TAG) ||
					line.matches(INFO_TAG) ||
					line.trim().equals(""))) {
		    	if (line.matches(RECORD_TAG)) {
		    		playlistEntry = new PlaylistEntry();
		        	playlistEntry.set(PlaylistEntry.PLAYLIST_METADATA, line.replaceAll("^(.*?),", ""));
		    		processingEntry = true;
		    	} else {
		    		if (!processingEntry) {
		    			playlistEntry = new PlaylistEntry();
		    		}
		    		
		    		playlistEntry.set(PlaylistEntry.URI, generateUri(line.trim(), host));
		    		savePlaylistFile(playlistEntry, playlist);
		    	}
		    }           
        }
    }