예제 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.jajuk.base.Observer#update(org.jajuk.base.Event)
  */
 public void update(Event event) {
   synchronized (getLock()) {
     EventSubject subject = event.getSubject();
     if (EventSubject.EVENT_FILE_NAME_CHANGED.equals(subject)) {
       Properties properties = event.getDetails();
       File fNew = (File) properties.get(DETAIL_NEW);
       File fileOld = (File) properties.get(DETAIL_OLD);
       // search references in playlists
       Iterator it = hmItems.values().iterator();
       for (int i = 0; it.hasNext(); i++) {
         Playlist plf = (Playlist) it.next();
         if (plf.isReady()) { // check only in mounted
           // playlists, note that we can't
           // change unmounted playlists
           try {
             if (plf.getFiles().contains(fileOld)) {
               plf.replaceFile(fileOld, fNew);
             }
           } catch (Exception e) {
             Log.error(17, e);
           }
         }
       }
     }
   }
 }
예제 #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.jajuk.base.Observer#update(org.jajuk.base.Event)
  */
 public void update(JajukEvent event) {
   JajukEvents subject = event.getSubject();
   if (JajukEvents.FILE_NAME_CHANGED.equals(subject)) {
     Properties properties = event.getDetails();
     File fNew = (File) properties.get(Const.DETAIL_NEW);
     File fileOld = (File) properties.get(Const.DETAIL_OLD);
     // search references in playlists
     ReadOnlyIterator<Playlist> it = getPlaylistsIterator();
     while (it.hasNext()) {
       Playlist plf = it.next();
       if (plf.isReady()) { // check only in mounted
         // playlists, note that we can't
         // change unmounted playlists
         try {
           if (plf.getFiles().contains(fileOld)) {
             plf.replaceFile(fileOld, fNew);
           }
         } catch (Exception e) {
           Log.error(17, e);
         }
       }
     }
   }
 }