public void play() { isPlaying = true; while (pl.isEmpty()) { Song s = pl.removeNextToPlay(); // sent to speaker. } isPlaying = false; }
private static void commit() { switch (command) { case "add": log("Added {" + param1 + ", " + param2 + "} to playlist."); playList.add(param1, param2); break; case "delete": log("Deleted " + param1 + " from playlist."); playList.delete(param1); break; case "editName": log("Edited {" + param1 + ", " + param2 + "} in playlist."); playList.editName(param1, param2); break; case "editUrl": log("Edited {" + param1 + ", " + param2 + "} in playlist."); playList.editUrl(param1, param2); break; case "NULL": conf.logger.severe("Invalid NULL command"); default: conf.logger.severe("Unrecognised command " + command); } }
public void parse() { File file = new File(m_uri.getPath()); FileReader file_reader; try { file_reader = new FileReader(file); LineNumberReader line_number_reader = new LineNumberReader(file_reader); String line; while ((line = line_number_reader.readLine()) != null) { if (line.trim().equals("")) { continue; } if (line.startsWith("#")) { continue; } m_play_list.add(line.trim()); } } catch (Exception e) { m_errors += "Error parsing m3u file '" + file.getAbsolutePath() + "': " + e.toString() + "\n"; } if (m_play_list.isEmpty()) { m_errors += "The m3u file '" + file.getAbsolutePath() + "' doesn't seem to define any files.\n"; } }
/** * Merges this playlist with another * * * @param p The playlist to be merged with this one. */ public void mergePlaylist(PlayList p) { for (int i = 0; i < p.numberOfSongs(); i++) { songlist.add(p.getSong(i)); } }