Ejemplo n.º 1
0
 void addToPlaylist(List<File> files, Playlist p) {
   if (interfaceDisabled) return;
   new Thread(
           () -> {
             setInterfaceDisabled(true);
             int total = files.size();
             AtomicInteger current = new AtomicInteger(0);
             Cache.pushToPlaylist(
                 files,
                 p,
                 (Track t) -> {
                   Platform.runLater(
                       () -> {
                         infoLabel.setText(
                             String.format(
                                 res.getString("processed"),
                                 current.incrementAndGet(),
                                 total,
                                 t.getTitle()));
                         if (p == getSelectedPlaylist()) {
                           tracksView.getItems().remove(t);
                           tracksView.getItems().add(0, t);
                         }
                       });
                 });
             setInterfaceDisabled(false);
           })
       .start();
   if (p == getSelectedPlaylist()) {
     Platform.runLater(
         () -> {
           loadSelectedPlaylist();
         });
   }
 }
Ejemplo n.º 2
0
 void addToPlaylist(Track t, Playlist p) {
   if (interfaceDisabled) return;
   Cache.pushToPlaylist(t, p);
   if (p == getSelectedPlaylist()) {
     Platform.runLater(
         () -> {
           loadSelectedPlaylist();
         });
   }
 }
Ejemplo n.º 3
0
 void addToRememberedPlaylist(Track t) {
   if (interfaceDisabled) return;
   if (t == null) return;
   if (rememberedPlaylist != null) {
     Cache.pushToPlaylist(t, rememberedPlaylist);
     infoAndAnnounce(
         String.format(
             res.getString("track_added_to_playlist"),
             rememberedPlaylist.getTitle(),
             t.getTitle()));
     if (rememberedPlaylist == getSelectedPlaylist()) loadSelectedPlaylist();
   } else {
     infoAndAnnounce(res.getString("remembered_not_yet"));
   }
 }