示例#1
0
 public static void addToPlaylist(File[] filesnames) throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Add to playlist (with parameters - filenames[]).");
   File f = new File(Lecteur.CURRENTPLAYLIST.NAME);
   File Fe =
       new File(
           Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19)
               + "wssederdferdtdfdgetrdfdte.pl");
   PrintWriter br = new PrintWriter(new BufferedWriter(new FileWriter(Fe)));
   BufferedReader br1 = new BufferedReader(new FileReader(f));
   String st = null;
   while ((st = br1.readLine()) != null) {
     br.println(st);
   }
   for (int i = 0; i < filesnames.length - 1; i++) {
     br.println(filesnames[i].toString());
   }
   br.print(filesnames[filesnames.length - 1].toString());
   br.close();
   br1.close();
   new File(Lecteur.CURRENTPLAYLIST.NAME).delete();
   (new File(
           Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19)
               + "wssederdferdtdfdgetrdfdte.pl"))
       .renameTo(new File(Lecteur.CURRENTPLAYLIST.NAME));
 }
示例#2
0
 public static void saveAsPlaylist(String message) throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Save as playlist.");
   String s = GUI.messageDialog2(message);
   if (s != null) {
     String s2 =
         Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19);
     String sa = s2 + s + ".pl";
     File f = new File(sa);
     copy(new File(Lecteur.CURRENTPLAYLIST.NAME), f);
     currentNAME = f.toString();
     GUI.getInstance().createOpenItem(sa);
     GUI.getInstance().createdeleteItem(sa);
   }
 }
示例#3
0
 // c'est 2 methodes d'ajouter un ou des medias dans la playlist r�p�r� par
 // CURRENTPLAYLIST a partir de
 // l'index en cours r�p�r� par CURRENTINDEXMEDIA
 public static void removeFromPlaylist(int[] index) throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Remove from playlist.");
   GUI.saveData = new String[GUI.data.length - index.length];
   BufferedReader br = new BufferedReader(new FileReader(new File(Lecteur.CURRENTPLAYLIST.NAME)));
   String s0 =
       Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19);
   PrintWriter pw =
       new PrintWriter(
           new BufferedWriter(new FileWriter(new File(s0 + "wssederdferdtdfdgetrdfdte.pl"))));
   String s;
   int k = 0;
   int p = 0;
   int i = index[0];
   int indice = 0;
   if ((s = br.readLine()) != null) {
     if (k == i) {
       indice++;
       if (indice < index.length) i = index[indice];
       k++;
     } else {
       GUI.saveData[p] = (String) GUI.data[k][2];
       p++;
       k++;
       pw.print(s);
     }
   }
   while ((s = br.readLine()) != null) {
     if (k == i) {
       indice++;
       if (indice < index.length) i = index[indice];
       k++;
     } else {
       if (index[0] == 0) index[0] = -1;
       else pw.println();
       GUI.saveData[p] = (String) GUI.data[k][2];
       p++;
       k++;
       pw.print(s);
     }
   }
   pw.close();
   br.close();
   (new File(Lecteur.CURRENTPLAYLIST.NAME)).delete();
   (new File(s0 + "wssederdferdtdfdgetrdfdte.pl"))
       .renameTo(new File(Lecteur.CURRENTPLAYLIST.NAME));
 }