示例#1
0
  public void play() {
    isPlaying = true;
    while (pl.isEmpty()) {
      Song s = pl.removeNextToPlay();
      // sent to speaker.

    }
    isPlaying = false;
  }
示例#2
0
 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);
   }
 }
示例#3
0
文件: M3UFile.java 项目: JoshP/nagare
 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";
   }
 }
示例#4
0
 /**
  * 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));
   }
 }