Save This Page
Home » openjdk-7 » net.sourceforge » neurosdbm » db » [javadoc | source]
    1   //
    2   //  Neuros Database Manipulator
    3   //  Copyright (C) 2003  Neuros Database Manipulator
    4   //
    5   //  This program is free software; you can redistribute it and/or modify
    6   //  it under the terms of the GNU General Public License as published by
    7   //  the Free Software Foundation; either version 2 of the License, or
    8   //  (at your option) any later version.
    9   //
   10   //  This program is distributed in the hope that it will be useful,
   11   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
   12   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13   //  GNU General Public License for more details.
   14   //
   15   //  You should have received a copy of the GNU General Public License
   16   //  along with this program; if not, write to the Free Software
   17   //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   18   //
   19   //  For information about Neuros Database Manipulator and its authors,
   20   //  please contact the Neuros Database Manipulator Web Site at
   21   //  http://neurosdbm.sourceforge.net
   22   //
   23   //
   24   
   25   package net.sourceforge.neurosdbm.db;
   26   
   27   
   28   import java.io.File;
   29   import java.io.FileNotFoundException;
   30   import java.io.IOException;
   31   import java.text.SimpleDateFormat;
   32   import java.util.ArrayList;
   33   import java.util.Calendar;
   34   import java.util.Date;
   35   import java.util.Iterator;
   36   
   37   import javax.swing.JOptionPane;
   38   
   39   import net.sourceforge.neurosdbm.Listener;
   40   import net.sourceforge.neurosdbm.Logging;
   41   import net.sourceforge.neurosdbm.NeurosProperties;
   42   import net.sourceforge.neurosdbm.actions.RebuildDatabase;
   43   import net.sourceforge.neurosdbm.db.track.MP3Track;
   44   import net.sourceforge.neurosdbm.db.track.OGGTrack;
   45   import net.sourceforge.neurosdbm.db.track.WAVTrack;
   46   import net.sourceforge.neurosdbm.db.track.WMATrack;
   47   
   48   import com.jcraft.jorbis.JOrbisException;
   49   
   50   public class Database {
   51   
   52     private NeurosDevice device;
   53     
   54     private AudioDB audioDB;
   55     private UnidedHiSiDB unidedhisiDB;
   56     private IdedHiSiDB idedhisiDB;
   57     private FailedHiSiDB failedhisiDB;
   58     private PCAudioDB pcaudioDB;
   59     private String path;
   60     private boolean modifiedPlaylists = false;
   61   
   62     private ArrayList syncQueue;
   63     private ArrayList deleteQueue;
   64   
   65     public Database(String _path, boolean createNew, int _device)
   66       throws FileNotFoundException, IOException, DatabaseCorruptException,
   67       DatabaseDoesNotExistException {
   68       
   69       this.path = _path;
   70       this.device = new NeurosDevice(_device);
   71       
   72       if (createNew == false) {
   73         loadExistingDatabase();
   74       } else {
   75         createEmptyDatabase();
   76       }
   77       syncQueue = new ArrayList();
   78       deleteQueue = new ArrayList();
   79     }
   80     
   81     public Database(String _path, int _device)
   82       throws FileNotFoundException, IOException, DatabaseCorruptException,
   83       DatabaseDoesNotExistException {
   84   
   85       this.path = _path;
   86       this.device = new NeurosDevice(_device);
   87   
   88       loadExistingDatabase();
   89       
   90       syncQueue = new ArrayList();
   91       deleteQueue = new ArrayList();
   92     }
   93   
   94     private void loadExistingDatabase()
   95       throws FileNotFoundException, IOException, DatabaseCorruptException,
   96       DatabaseDoesNotExistException {
   97       
   98       File checkSNfile = new File(path + "/sn.txt");
   99       if (!checkSNfile.exists()) {
  100         throw new IOException("Not attached to Neuros device");
  101       }
  102       
  103       File checkPath = new File(path + "/woid_db");
  104       if (!checkPath.exists()) {
  105         throw new DatabaseDoesNotExistException();
  106       }
  107   
  108       audioDB = new AudioDB(path + "/woid_db/audio");
  109       unidedhisiDB = new UnidedHiSiDB(path + "/woid_db/unidedhisi");
  110       idedhisiDB = new IdedHiSiDB(path + "/woid_db/idedhisi");
  111       failedhisiDB = new FailedHiSiDB(path + "/woid_db/failedhisi");
  112       pcaudioDB = new PCAudioDB(path + "/woid_db/pcaudio");
  113     }
  114     
  115     public void createEmptyDatabase()
  116       throws FileNotFoundException, IOException, DatabaseCorruptException {
  117       audioDB = new AudioDB(path + "/woid_db/audio", true);
  118       unidedhisiDB = new UnidedHiSiDB(path + "/woid_db/unidedhisi", true);
  119       idedhisiDB = new IdedHiSiDB(path + "/woid_db/idedhisi", true);
  120       failedhisiDB = new FailedHiSiDB(path + "/woid_db/failedhisi", true);
  121       pcaudioDB = new PCAudioDB(path + "/woid_db/pcaudio", true);
  122       syncQueue = new ArrayList();
  123       deleteQueue = new ArrayList();
  124     }
  125     
  126   
  127     public void refreshDatabase()
  128       throws FileNotFoundException, IOException, DatabaseCorruptException,
  129       DatabaseDoesNotExistException {
  130         
  131       loadExistingDatabase();
  132     }
  133   
  134     
  135     public void refreshDatabase(String _path, int _device)
  136       throws FileNotFoundException, IOException, DatabaseCorruptException,
  137       DatabaseDoesNotExistException {
  138   
  139       this.path = _path;
  140       this.device = new NeurosDevice(_device);
  141       loadExistingDatabase();
  142     }
  143   
  144     
  145     public void deleteDatabase() {
  146       new File(path + "/woid_db/audio/albums.mdb").delete();
  147       new File(path + "/woid_db/audio/albums.pai").delete();
  148       new File(path + "/woid_db/audio/albums.sai").delete();
  149       new File(path + "/woid_db/audio/artist.mdb").delete();
  150       new File(path + "/woid_db/audio/artist.pai").delete();
  151       new File(path + "/woid_db/audio/artist.sai").delete();
  152       new File(path + "/woid_db/audio/audio.mdb").delete();
  153       new File(path + "/woid_db/audio/audio.sai").delete();
  154       new File(path + "/woid_db/audio/genre.mdb").delete();
  155       new File(path + "/woid_db/audio/genre.pai").delete();
  156       new File(path + "/woid_db/audio/genre.sai").delete();
  157       new File(path + "/woid_db/audio/playlist.mdb").delete();
  158       new File(path + "/woid_db/audio/playlist.pai").delete();
  159       new File(path + "/woid_db/audio/playlist.sai").delete();
  160       new File(path + "/woid_db/audio/recordings.mdb").delete();
  161       new File(path + "/woid_db/audio/recordings.pai").delete();
  162       new File(path + "/woid_db/audio/recordings.sai").delete();
  163       new File(path + "/woid_db/failedhisi/failedhisi.mdb").delete();
  164       new File(path + "/woid_db/failedhisi/failedhisi.sai").delete();
  165       new File(path + "/woid_db/idedhisi/idedhisi.mdb").delete();
  166       new File(path + "/woid_db/idedhisi/idedhisi.sai").delete();
  167       new File(path + "/woid_db/pcaudio/albums.mdb").delete();
  168       new File(path + "/woid_db/pcaudio/albums.pai").delete();
  169       new File(path + "/woid_db/pcaudio/albums.sai").delete();
  170       new File(path + "/woid_db/pcaudio/artist.mdb").delete();
  171       new File(path + "/woid_db/pcaudio/artist.pai").delete();
  172       new File(path + "/woid_db/pcaudio/artist.sai").delete();
  173       new File(path + "/woid_db/pcaudio/pcaudio.mdb").delete();
  174       new File(path + "/woid_db/pcaudio/pcaudio.sai").delete();
  175       new File(path + "/woid_db/pcaudio/genre.mdb").delete();
  176       new File(path + "/woid_db/pcaudio/genre.pai").delete();
  177       new File(path + "/woid_db/pcaudio/genre.sai").delete();
  178       new File(path + "/woid_db/pcaudio/playlist.mdb").delete();
  179       new File(path + "/woid_db/pcaudio/playlist.pai").delete();
  180       new File(path + "/woid_db/pcaudio/playlist.sai").delete();
  181       new File(path + "/woid_db/pcaudio/recordings.mdb").delete();
  182       new File(path + "/woid_db/pcaudio/recordings.pai").delete();
  183       new File(path + "/woid_db/pcaudio/recordings.sai").delete();
  184       new File(path + "/woid_db/unidedhisi/unidedhisi.mdb").delete();
  185       new File(path + "/woid_db/unidedhisi/unidedhisi.sai").delete();
  186     }
  187   
  188   
  189     public void write()
  190       throws IOException, DatabaseInternalCorruptionException {
  191   
  192       write(false);
  193     }
  194     
  195     public void write(boolean disableAutoBackup)
  196       throws IOException, DatabaseInternalCorruptionException {
  197   
  198       if (NeurosProperties.isAutoBackup() && !disableAutoBackup) {
  199         autoBackup();
  200       }
  201       audioDB.write();
  202       unidedhisiDB.write();
  203       idedhisiDB.write();
  204       failedhisiDB.write();
  205       pcaudioDB.write();
  206     }
  207     
  208     
  209     // constants for the query command
  210     static public final int DB_AUDIO = 1;
  211     static public final int DB_FAILEDHISI = 2;
  212     static public final int DB_IDEDHISI = 3;
  213     static public final int DB_PCAUDIO = 4;
  214     static public final int DB_UNIDEDHISI = 5;
  215   
  216     static public final int DB_TRACKS = 11;
  217     static public final int DB_PLAYLISTS = 12;
  218     static public final int DB_ARTISTS = 13;
  219     static public final int DB_ALBUMS = 14;
  220     static public final int DB_GENRES = 15;
  221     static public final int DB_HISI = 16;
  222   
  223     public ArrayList query(int database, int type) {
  224       ArrayList returnArrayList = null;
  225   
  226       switch (database) {
  227       case DB_AUDIO:
  228         returnArrayList = audioDB.query(DisplayIndex.DB_AUDIO, type);
  229         break;
  230   
  231       case DB_FAILEDHISI:
  232         returnArrayList = failedhisiDB.query(type);
  233         break;
  234   
  235       case DB_IDEDHISI:
  236         returnArrayList = idedhisiDB.query(type);
  237         break;
  238   
  239       case DB_UNIDEDHISI:
  240         returnArrayList = failedhisiDB.query(type);
  241         break;
  242         
  243       case DB_PCAUDIO:
  244         returnArrayList = pcaudioDB.query(DisplayIndex.DB_PCAUDIO, type);
  245         break;
  246       }
  247   
  248       return returnArrayList;
  249     }
  250   
  251   
  252     public ArrayList query(int database, int type, int key) {
  253       ArrayList returnArrayList = null;
  254   
  255       switch (database) {
  256       case DB_AUDIO:
  257         returnArrayList = audioDB.query(DisplayIndex.DB_AUDIO, type, key);
  258         break;
  259       }
  260       
  261       return returnArrayList;
  262     }
  263     
  264     public DisplayRecord query(DisplayIndex index) {
  265       switch (index.getDatabase()) {
  266       case DB_AUDIO:
  267         return audioDB.query(index);
  268   
  269       case DB_FAILEDHISI:
  270         return failedhisiDB.query(index);
  271   
  272       case DB_IDEDHISI:
  273         return idedhisiDB.query(index);
  274   
  275       case DB_UNIDEDHISI:
  276         return failedhisiDB.query(index);
  277         
  278       case DB_PCAUDIO:
  279         return pcaudioDB.query(index);
  280       }
  281   
  282       return null;
  283     }
  284   
  285   
  286     public void sort(ArrayList list) {
  287       if (list.size() == 0) {
  288         return;
  289       }
  290       DisplayIndex index = (DisplayIndex) list.get(0);
  291       switch (index.getDatabase()) {
  292       case DB_AUDIO:
  293         audioDB.sort(list);
  294         return;
  295   
  296       case DB_FAILEDHISI:
  297   
  298       case DB_IDEDHISI:
  299   
  300       case DB_UNIDEDHISI:
  301         
  302       case DB_PCAUDIO:
  303         pcaudioDB.sort(list);
  304         return;
  305       }
  306   
  307     }
  308   
  309     
  310     public String getPath() {
  311       return path;
  312     }
  313   
  314     
  315     public void backup(File newPathFile)
  316       throws FileNotFoundException, IOException {
  317       String newPath = newPathFile.toString();
  318   
  319       File checkPath = new File(newPath + "/woid_db");
  320       if (checkPath.exists()) {
  321         throw new IOException("Backup already exists - will not overwrite");
  322       }
  323           
  324       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  325                     "albums.mdb");
  326       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  327                     "albums.pai");
  328       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  329                     "albums.sai");
  330       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  331                     "artist.mdb");
  332       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  333                     "artist.pai");
  334       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  335                     "artist.sai");
  336       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  337                     "audio.mdb");
  338       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  339                     "audio.sai");
  340       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  341                     "genre.mdb");
  342       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  343                     "genre.pai");
  344       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  345                     "genre.sai");
  346       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  347                     "playlist.mdb");
  348       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  349                     "playlist.pai");
  350       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  351                     "playlist.sai");
  352       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  353                     "recordings.mdb");
  354       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  355                     "recordings.pai");
  356       Util.fileCopy(path + "/woid_db/audio", newPath + "/woid_db/audio",
  357                     "recordings.sai");
  358       Util.fileCopy(path + "/woid_db/failedhisi", newPath + "/woid_db/failedhisi",
  359                     "failedhisi.mdb");
  360       Util.fileCopy(path + "/woid_db/failedhisi", newPath + "/woid_db/failedhisi",
  361                     "failedhisi.sai");
  362       Util.fileCopy(path + "/woid_db/idedhisi", newPath + "/woid_db/idedhisi",
  363                     "idedhisi.mdb");
  364       Util.fileCopy(path + "/woid_db/idedhisi", newPath + "/woid_db/idedhisi",
  365                     "idedhisi.sai");
  366       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  367                     "albums.mdb");
  368       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  369                     "albums.pai");
  370       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  371                     "albums.sai");
  372       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  373                     "artist.mdb");
  374       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  375                     "artist.pai");
  376       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  377                     "artist.sai");
  378       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  379                     "pcaudio.mdb");
  380       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  381                     "pcaudio.sai");
  382       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  383                     "genre.mdb");
  384       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  385                     "genre.pai");
  386       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  387                     "genre.sai");
  388       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  389                     "playlist.mdb");
  390       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  391                     "playlist.pai");
  392       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  393                     "playlist.sai");
  394       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  395                     "recordings.mdb");
  396       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  397                     "recordings.pai");
  398       Util.fileCopy(path + "/woid_db/pcaudio", newPath + "/woid_db/pcaudio",
  399                     "recordings.sai");
  400       Util.fileCopy(path + "/woid_db/unidedhisi", newPath + "/woid_db/unidedhisi",
  401                     "unidedhisi.mdb");
  402       Util.fileCopy(path + "/woid_db/unidedhisi", newPath + "/woid_db/unidedhisi",
  403                     "unidedhisi.sai");
  404     }
  405   
  406   
  407     public void restore(File restorePathFile)
  408       throws FileNotFoundException, IOException {
  409       String restorePath = restorePathFile.toString();
  410   
  411       File checkPath = new File(restorePath + "/woid_db");
  412       if (!checkPath.exists()) {
  413         throw new IOException("Restore database not found");
  414       }
  415           
  416       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  417                     "albums.mdb");
  418       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  419                     "albums.pai");
  420       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  421                     "albums.sai");
  422       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  423                     "artist.mdb");
  424       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  425                     "artist.pai");
  426       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  427                     "artist.sai");
  428       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  429                     "audio.mdb");
  430       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  431                     "audio.sai");
  432       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  433                     "genre.mdb");
  434       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  435                     "genre.pai");
  436       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  437                     "genre.sai");
  438       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  439                     "playlist.mdb");
  440       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  441                     "playlist.pai");
  442       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  443                     "playlist.sai");
  444       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  445                     "recordings.mdb");
  446       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  447                     "recordings.pai");
  448       Util.fileCopy(restorePath + "/woid_db/audio", path + "/woid_db/audio",
  449                     "recordings.sai");
  450       Util.fileCopy(restorePath + "/woid_db/failedhisi", path + "/woid_db/failedhisi",
  451                     "failedhisi.mdb");
  452       Util.fileCopy(restorePath + "/woid_db/failedhisi", path + "/woid_db/failedhisi",
  453                     "failedhisi.sai");
  454       Util.fileCopy(restorePath + "/woid_db/idedhisi", path + "/woid_db/idedhisi",
  455                     "idedhisi.mdb");
  456       Util.fileCopy(restorePath + "/woid_db/idedhisi", path + "/woid_db/idedhisi",
  457                     "idedhisi.sai");
  458       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  459                     "albums.mdb");
  460       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  461                     "albums.pai");
  462       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  463                     "albums.sai");
  464       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  465                     "artist.mdb");
  466       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  467                     "artist.pai");
  468       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  469                     "artist.sai");
  470       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  471                     "pcaudio.mdb");
  472       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  473                     "pcaudio.sai");
  474       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  475                     "genre.mdb");
  476       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  477                     "genre.pai");
  478       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  479                     "genre.sai");
  480       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  481                     "playlist.mdb");
  482       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  483                     "playlist.pai");
  484       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  485                     "playlist.sai");
  486       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  487                     "recordings.mdb");
  488       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  489                     "recordings.pai");
  490       Util.fileCopy(restorePath + "/woid_db/pcaudio", path + "/woid_db/pcaudio",
  491                     "recordings.sai");
  492       Util.fileCopy(restorePath + "/woid_db/unidedhisi", path + "/woid_db/unidedhisi",
  493                     "unidedhisi.mdb");
  494       Util.fileCopy(restorePath + "/woid_db/unidedhisi", path + "/woid_db/unidedhisi",
  495                     "unidedhisi.sai");
  496     }
  497   
  498     
  499     public int rebuild()
  500       throws DatabaseInternalCorruptionException, DatabaseCorruptException,
  501       FileNotFoundException, IOException {
  502         
  503       return rebuild(null);
  504     }
  505       
  506     // rebuilds the database - returns the number of tracks found
  507     public int rebuild(RebuildDatabase.RebuildDialog dialog)
  508       throws DatabaseInternalCorruptionException, DatabaseCorruptException,
  509       FileNotFoundException, IOException {
  510         
  511       createEmptyDatabase();
  512       File[] pathFiles = new File[1];
  513       pathFiles[0] = new File(path);
  514       int numberTracks = rebuildTracks(0, pathFiles, dialog);
  515       if (dialog != null) {
  516         dialog.updatePath("Sorting Database");
  517         dialog.updateFileName("");
  518       }
  519       sort();
  520       if (dialog != null) {
  521         dialog.updatePath("Writing Database");
  522       }
  523       syncQueue = new ArrayList();
  524       deleteQueue = new ArrayList();
  525       write();
  526       FullTrackInfo.save();
  527       modifiedPlaylists = false;
  528       return numberTracks;
  529     }
  530   
  531   
  532     private int rebuildTracks(int numberRebuilt, File[] files,
  533                               RebuildDatabase.RebuildDialog dialog) {
  534   
  535       if (files == null) {
  536         return 0;
  537       }
  538       
  539       for (int cnt=0; cnt<files.length; cnt++) {
  540         File nextFile = files[cnt];
  541         try {
  542           if (nextFile.isDirectory()) {
  543             if (dialog != null) {
  544               dialog.updatePath("Path: " + nextFile);
  545               dialog.updateFileName("Looking in directory");
  546             }
  547             numberRebuilt = rebuildTracks(numberRebuilt, nextFile.listFiles(),
  548                                           dialog);
  549           } else {
  550             boolean musicTrack = false;
  551             String extension = Util.getExtension(nextFile);
  552             if (extension.equalsIgnoreCase("mp3")) {
  553               if (dialog != null) {
  554                 dialog.updateFileName("Found: " + nextFile.getName());
  555               }
  556               queueMP3TrackAdd(nextFile, true);
  557               numberRebuilt++;
  558               if (dialog != null) {
  559                 dialog.updateTracks(numberRebuilt);
  560               }
  561               musicTrack = true;
  562             }
  563             if (extension.equalsIgnoreCase("ogg")) {
  564               if (dialog != null) {
  565                 dialog.updateFileName("Found: " + nextFile.getName());
  566               }
  567               queueOGGTrackAdd(nextFile, true);
  568               numberRebuilt++;
  569               if (dialog != null) {
  570                 dialog.updateTracks(numberRebuilt);
  571               }
  572               musicTrack = true;
  573             }
  574             if (extension.equalsIgnoreCase("wma")) {
  575               if (dialog != null) {
  576                 dialog.updateFileName("Found: " + nextFile.getName());
  577               }
  578               queueWMATrackAdd(nextFile, true);
  579               numberRebuilt++;
  580               if (dialog != null) {
  581                 dialog.updateTracks(numberRebuilt);
  582               }
  583               musicTrack = true;
  584             }
  585             if (extension.equalsIgnoreCase("wav")) {
  586               if (dialog != null) {
  587                 dialog.updateFileName("Found: " + nextFile.getName());
  588               }
  589               queueWAVTrackAdd(nextFile, true);
  590               numberRebuilt++;
  591               if (dialog != null) {
  592                 dialog.updateTracks(numberRebuilt);
  593               }
  594               musicTrack = true;
  595             }
  596             if (!musicTrack) {
  597               if (dialog != null) {
  598                 dialog.updateFileName("Ignoring: " + nextFile.getName());
  599               }
  600             }
  601           }
  602         } catch (Exception exp) {
  603           Logging.warning("Could not add track [Exception]: "
  604                           + nextFile.getName());
  605           Logging.warning(exp);
  606           dialog.updateFileName("Error: " + nextFile.getName());
  607         }
  608       }
  609       
  610       return numberRebuilt;
  611     }
  612   
  613     
  614       public boolean queueMP3TrackAdd(File trackToAdd) throws DatabaseInternalCorruptionException {
  615           return queueMP3TrackAdd(trackToAdd, false);
  616       }
  617       public boolean queueMP3TrackAdd(File trackToAdd, boolean rebuild)
  618           throws DatabaseInternalCorruptionException {
  619   
  620           boolean result = false;
  621           try {
  622               NewTrack newTrack = new MP3Track(trackToAdd, rebuild, path, device);
  623               result = queueTrackAdd(newTrack);
  624           } catch (DatabaseInternalCorruptionException exp) {
  625               Logging.warning(exp);
  626               Logging.warning("Could not add track [" + exp.getMessage() + "]: " + trackToAdd);
  627               throw exp;
  628           } catch (Exception exp) {
  629               Logging.warning(exp);
  630               Logging.warning("Could not add track [" + exp.getMessage() + "]: " + trackToAdd);
  631           }
  632           return result;
  633       }
  634       private boolean queueOGGTrackAdd(File trackToAdd) throws DatabaseInternalCorruptionException {
  635           return queueOGGTrackAdd(trackToAdd, false);
  636       }
  637       private boolean queueOGGTrackAdd(File trackToAdd, boolean rebuild)
  638           throws DatabaseInternalCorruptionException {
  639           boolean result = false;
  640           try {
  641               NewTrack newTrack = new OGGTrack(trackToAdd, rebuild, path, device);
  642               result = queueTrackAdd(newTrack);
  643           } catch (JOrbisException exp) {
  644               Logging.warning(exp);
  645               Logging.warning("Could not add track [" + exp.getMessage() + "]: " + trackToAdd);
  646           }
  647           return result;
  648       }
  649       public boolean queueWMATrackAdd(File trackToAdd) throws DatabaseInternalCorruptionException {
  650           return queueWMATrackAdd(trackToAdd, false);
  651       }
  652       public boolean queueWMATrackAdd(File trackToAdd, boolean rebuild)
  653           throws DatabaseInternalCorruptionException {
  654           return queueTrackAdd(new WMATrack(trackToAdd, rebuild, device));
  655       }
  656       public boolean queueWAVTrackAdd(File trackToAdd) throws DatabaseInternalCorruptionException {
  657           return queueWMATrackAdd(trackToAdd, false);
  658       }
  659       public boolean queueWAVTrackAdd(File trackToAdd, boolean rebuild)
  660           throws DatabaseInternalCorruptionException {
  661           return queueTrackAdd(new WAVTrack(trackToAdd, rebuild, device));
  662       }
  663   
  664     public int queueTracksRecurseDirectories(File[] files)
  665       throws DatabaseInternalCorruptionException {
  666         
  667       int numberQueued = 0;
  668   
  669       for (int cnt=0; cnt<files.length; cnt++) {
  670         File nextFile = files[cnt];
  671         if (nextFile.isDirectory()) {
  672           numberQueued += queueTracksRecurseDirectories(nextFile.listFiles());
  673         } else {
  674           String extension = Util.getExtension(nextFile);
  675           if (extension.equalsIgnoreCase("mp3")) {
  676             if (queueMP3TrackAdd(nextFile)) {
  677               numberQueued += 1;
  678             }
  679           }
  680           if (extension.equalsIgnoreCase("ogg")) {
  681             if (queueOGGTrackAdd(nextFile)) {
  682               numberQueued += 1;
  683             }
  684           }
  685           if (extension.equalsIgnoreCase("wma")) {
  686             if (queueWMATrackAdd(nextFile)) {
  687               numberQueued += 1;
  688             }
  689           }
  690           if (extension.equalsIgnoreCase("wav")) {
  691             if (queueWAVTrackAdd(nextFile)) {
  692               numberQueued += 1;
  693             }
  694           }
  695         }
  696       }
  697   
  698       return numberQueued;
  699     }
  700   
  701     
  702     /**
  703      * Queues the new track for copying over to the Neuros.  The track
  704      * can be of any type.
  705      *
  706      * @param newTrack The track to add.
  707      * @return true if successfully added
  708      * @exception DatabaseInternalCorruptionException Database is corrupted.
  709      */
  710     public boolean queueTrackAdd(NewTrack newTrack)
  711       throws DatabaseInternalCorruptionException {
  712   
  713       // We need to see if this is a duplicate
  714       if (!NeurosProperties.allowDuplicates()) {
  715         if (audioDB.isADuplicate(newTrack)) {
  716           Logging.warning("Could not add track [Duplicate Track]: "
  717                           + newTrack.harddriveFilename);
  718           return false;
  719         }
  720       }
  721       newTrack.prepareFields(); //calls on demand, default - false, flag should be set in system properties
  722       newTrack.copied = false;
  723       audioDB.addNewTrack(newTrack);
  724       syncQueue.add(newTrack);
  725       return true;
  726     }
  727   
  728   
  729     public void sort() {
  730       ArrayList tracks = audioDB.query(DisplayIndex.DB_AUDIO,
  731                                     Database.DB_TRACKS);
  732       audioDB.sort(tracks);
  733       
  734       ArrayList playlists = audioDB.query(DisplayIndex.DB_AUDIO,
  735                                        Database.DB_PLAYLISTS);
  736       audioDB.sort(playlists);
  737       
  738       ArrayList artists = audioDB.query(DisplayIndex.DB_AUDIO,
  739                                      Database.DB_ARTISTS);
  740       audioDB.sort(artists);
  741       for (Iterator i = artists.iterator(); i.hasNext(); ) {
  742         DisplayIndex index = (DisplayIndex) i.next();
  743         ArrayList artist = audioDB.query(DisplayIndex.DB_AUDIO,
  744                                       Database.DB_ARTISTS,
  745                                       index.getKey());
  746         audioDB.sort(artist, Database.DB_ARTISTS, index.getKey());
  747       }
  748       
  749       ArrayList albums = audioDB.query(DisplayIndex.DB_AUDIO,
  750                                     Database.DB_ALBUMS);
  751       audioDB.sort(albums);
  752       for (Iterator i = albums.iterator(); i.hasNext(); ) {
  753         DisplayIndex index = (DisplayIndex) i.next();
  754         ArrayList album = audioDB.query(DisplayIndex.DB_AUDIO,
  755                                      Database.DB_ALBUMS,
  756                                      index.getKey());
  757         audioDB.sort(album, Database.DB_ALBUMS, index.getKey());
  758       }
  759       
  760       ArrayList genres = audioDB.query(DisplayIndex.DB_AUDIO,
  761                                     Database.DB_GENRES);
  762       audioDB.sort(genres);
  763       for (Iterator i = genres.iterator(); i.hasNext(); ) {
  764         DisplayIndex index = (DisplayIndex) i.next();
  765         ArrayList genre = audioDB.query(DisplayIndex.DB_AUDIO,
  766                                      Database.DB_GENRES,
  767                                      index.getKey());
  768         audioDB.sort(genre, Database.DB_GENRES, index.getKey());
  769       }
  770       
  771     }
  772   
  773     File music = new File(NeurosProperties.getDevicePath(), "music");
  774     private void checkParents(File file) {
  775       if ( file.exists() && file.isDirectory() && file.list().length == 0 && !music.equals(file)) {
  776         file.delete();
  777         checkParents(file.getParentFile());
  778       }
  779     }
  780     
  781     public SyncStats synchronize(final Listener progress) {
  782    
  783       SyncStats stats = new SyncStats();
  784       try {
  785         stats.success = true;
  786       
  787         Calendar before = Calendar.getInstance();
  788         progress.setMinimum(0);
  789         progress.setMaximum(syncQueue.size()+1);
  790         
  791         if (NeurosProperties.isDeleteFile()) {
  792           for (Iterator iter=deleteQueue.iterator();
  793                iter.hasNext() && stats.success; ) {
  794             AudioRecord audioRecord = (AudioRecord)iter.next();
  795             // actually delete here and remove from database
  796             
  797   		  int audioKey = audioRecord.getKey();
  798   		  int artistKey = audioRecord.getArtistKey();
  799   		  int albumKey = audioRecord.getAlbumKey();
  800   		  int genreKey = audioRecord.getGenreKey();
  801   		  audioDB.deleteTrack(audioKey, artistKey, albumKey, genreKey);
  802   		  progress.setNote( "Removing tracks marked for deletion...");
  803             String pathOfFile = audioRecord.getPath().toString();
  804             pathOfFile = pathOfFile.substring(3);
  805             pathOfFile = path + File.separator + pathOfFile;
  806             File file = new File(pathOfFile);
  807             file.delete();
  808             checkParents( file.getParentFile());
  809           }
  810         }
  811   
  812         int number = 0;
  813         progress.setNote( "Synchronizing...");
  814         for (Iterator iter=syncQueue.iterator();
  815              iter.hasNext() && stats.success; ) {
  816           NewTrack nextTrack = (NewTrack)iter.next();
  817           // strip drive letter
  818           String target = nextTrack.neurosPath.substring(2);
  819           target = path + "/" + target;
  820           progress.setNote("Track " + (number + 1)
  821                            + "/" + (progress.getMaximum()-1) + "  ("
  822                            + nextTrack.neurosFilename + ")");
  823           progress.setProgress(number);
  824           try {
  825             Util.fileCopy(nextTrack.harddrivePath, target,
  826                           nextTrack.harddriveFilename, nextTrack.neurosFilename);
  827           } catch (FileNotFoundException exp) {
  828             stats.success = false;
  829             stats.exceptionMessage = exp.getMessage();
  830           } catch (IOException exp) {
  831             stats.success = false;
  832             stats.exceptionMessage = exp.getMessage();
  833           }
  834           nextTrack.copied = true;
  835           number++;
  836         }
  837   
  838         if (stats.success) {
  839           syncQueue = new ArrayList();
  840           deleteQueue = new ArrayList();
  841           
  842           progress.setNote("Writing database...");
  843           progress.setProgress(number);
  844           try {
  845             write();
  846           } catch (IOException exp) {
  847             stats.success = false;
  848             stats.exceptionMessage = exp.getMessage();
  849           } catch (DatabaseInternalCorruptionException exp) {
  850             stats.success = false;
  851             stats.exceptionMessage = exp.getMessage();
  852           }
  853   
  854           if (stats.success) {
  855             progress.setNote("Writing XML file...");
  856             FullTrackInfo.save();
  857           }
  858           Calendar after = Calendar.getInstance();
  859           stats.time = after.getTimeInMillis() - before.getTimeInMillis();
  860         }
  861   	  modifiedPlaylists = false;
  862         return stats;
  863       } catch (Exception exp) {
  864         Logging.fatal("Exception occured");
  865         java.io.StringWriter sw = new java.io.StringWriter();
  866         exp.printStackTrace(new java.io.PrintWriter(sw));
  867         String stacktrace = sw.toString();
  868         Logging.fatal(stacktrace);
  869   
  870         System.err.println("An exception occured.  Please check the log file.");
  871         String message = "An exception occured.  Please check the log file.\n";
  872         message += "Exception: " + exp + "\n";
  873         if (exp.getMessage() != null)
  874           message += "Message: " + exp.getMessage();
  875         JOptionPane.showMessageDialog(null, message,
  876                                       "Neuros Database Manipulator",
  877                                       JOptionPane.ERROR_MESSAGE);
  878       }
  879       stats.success = false;
  880       return stats;
  881     }
  882   
  883     public class SyncStats {
  884       public boolean success;
  885       public String exceptionMessage;
  886       public long time;
  887     }
  888     
  889     // Pick the next backup slot and backup the database to that directory
  890     public void autoBackup() throws FileNotFoundException, IOException {
  891       SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
  892       SimpleDateFormat df2 = new SimpleDateFormat("HH.mm.ss");
  893       Date currentTime = new Date();
  894       String filePath = path + "/ndbm/" + df1.format(currentTime) + "/"
  895         + df2.format(currentTime);
  896       File backupPath = new File(filePath);
  897       backupPath.mkdirs();
  898       Logging.warning("Backing up to: " + backupPath.toString());
  899       backup(backupPath);
  900     }
  901   
  902     
  903     public void testTrackAdd1()
  904       throws DatabaseInternalCorruptionException {
  905         
  906       NewTrack newTrack = new NewTrack();
  907       newTrack.harddrivePath = "C:\\test";
  908       newTrack.neurosPath = device.getDriveLetter() + ":/music";
  909       newTrack.harddriveFilename = "test.mp3";
  910       newTrack.neurosFilename = "test.mp3";
  911       newTrack.neurosTitle = "Test Title";
  912       newTrack.neurosArtist = "Test Artist";
  913       newTrack.neurosAlbum = "Test Album";
  914       newTrack.neurosGenre = "Test Genre";
  915       newTrack.length = 37;
  916       newTrack.fileSize = 1000;
  917       queueTrackAdd(newTrack);
  918     }
  919   
  920     
  921     public void testTrackAdd2()
  922       throws DatabaseInternalCorruptionException {
  923         
  924       NewTrack newTrack = new NewTrack();
  925       newTrack.harddrivePath = "C:\\test";
  926       newTrack.neurosPath = device.getDriveLetter() + ":/music";
  927       newTrack.harddriveFilename = "test2.mp3";
  928       newTrack.neurosFilename = "test2.mp3";
  929       newTrack.neurosTitle = "Test Title 2";
  930       newTrack.neurosArtist = "Test Artist 2";
  931       newTrack.neurosAlbum = "Test Album 2";
  932       newTrack.neurosGenre = "Test Genre 2";
  933       newTrack.length = 200;
  934       newTrack.fileSize = 2000;
  935       queueTrackAdd(newTrack);
  936     }
  937   
  938   
  939     public void testTrackAddRandom()
  940       throws DatabaseInternalCorruptionException {
  941         
  942       NewTrack newTrack = new NewTrack();
  943       newTrack.harddrivePath = "C:\\test";
  944       newTrack.neurosPath = device.getDriveLetter() + ":/music";
  945       newTrack.harddriveFilename = Util.randomString(10) + ".mp3";
  946       newTrack.neurosFilename = newTrack.harddriveFilename;
  947       newTrack.neurosTitle = Util.randomString(10);
  948       newTrack.neurosArtist = Util.randomString(10);
  949       newTrack.neurosAlbum = Util.randomString(10);
  950       newTrack.neurosGenre = Util.randomString(10);
  951       newTrack.length = (int)(Math.random()*1000);
  952       newTrack.fileSize = (int)(Math.random()*10000);
  953       queueTrackAdd(newTrack);
  954     }
  955   
  956   
  957     public int getNumberQueued() {
  958       if (syncQueue == null)
  959         return 0;
  960       return syncQueue.size();
  961     }
  962   
  963   
  964     public int getNumberDeleted() {
  965       if (deleteQueue == null)
  966         return 0;
  967       return deleteQueue.size();
  968     }
  969   
  970   
  971     public void markTracksForDeletion(ArrayList tracks) {
  972       for (Iterator iter = tracks.iterator(); iter.hasNext(); ) {
  973         AudioDisplayRecord track = (AudioDisplayRecord)iter.next();
  974         AudioRecord audioRecord = track.getAudioRecord();
  975         if (syncQueue.contains(audioRecord))  {
  976         	syncQueue.remove(audioRecord);
  977   		int audioKey = audioRecord.getKey();
  978   		int artistKey = audioRecord.getArtistKey();
  979   		int albumKey = audioRecord.getAlbumKey();
  980   		int genreKey = audioRecord.getGenreKey();
  981   		audioDB.deleteTrack(audioKey, artistKey, albumKey, genreKey);
  982         }
  983         else 
  984         	deleteQueue.add(audioRecord);
  985         
  986       }
  987     }
  988   
  989   
  990     /**
  991      * Creates a new playlist.  The key of the new playlist is returned.
  992      *
  993      * @param name The name of this playlist.
  994      * @return The key of the newly created playlist.
  995      */
  996     public int createPlaylist(String name) {
  997     	modifiedPlaylists = true;
  998       return audioDB.createPlaylist(name);
  999     }
 1000   
 1001   
 1002     public void removePlaylist(int playlistKey) {
 1003     	modifiedPlaylists = true;
 1004       audioDB.removePlaylist(playlistKey);
 1005       modifiedPlaylists = true;
 1006     }
 1007   
 1008   
 1009     public void addToPlaylist(ArrayList tracks, int playlistKey)
 1010       throws DatabaseInternalCorruptionException {
 1011         
 1012       for (Iterator iter = tracks.iterator(); iter.hasNext(); ) {
 1013         AudioDisplayRecord track = (AudioDisplayRecord)iter.next();
 1014         audioDB.addToPlaylist(track.getKey(), playlistKey);
 1015       }
 1016       modifiedPlaylists = true;
 1017     }
 1018     
 1019   
 1020     public void deleteFromPlaylist(ArrayList tracks, int playlistKey)
 1021       throws DatabaseInternalCorruptionException {
 1022         
 1023       for (Iterator iter = tracks.iterator(); iter.hasNext(); ) {
 1024         AudioDisplayRecord track = (AudioDisplayRecord)iter.next();
 1025         audioDB.deleteFromPlaylist(track.getKey(), playlistKey);
 1026       }
 1027       modifiedPlaylists = true;
 1028     }
 1029   
 1030   
 1031     public void rearrangePlaylist(ArrayList tracks, int playlistKey) {
 1032       audioDB.reorder(tracks, DB_PLAYLISTS, playlistKey);
 1033       modifiedPlaylists = true;
 1034     }
 1035     
 1036   
 1037     public void renamePlaylist(String newName, int playlistKey) {
 1038       audioDB.renamePlaylist(newName, playlistKey);
 1039       modifiedPlaylists = true;
 1040     }
 1041   
 1042     
 1043     public NeurosDevice getDevice() {
 1044       return device;
 1045     }
 1046   
 1047     
 1048     static public void main(String[] args)
 1049       throws FileNotFoundException, IOException, DatabaseCorruptException,
 1050       DatabaseDoesNotExistException{
 1051   //     String path = net.sourceforge.neurosdbm.NeurosProperties.getDevicePath();
 1052       String path = "C:\\db\\test";
 1053   
 1054       // Empty database creation start
 1055   //     Database db = new Database(path, true);
 1056   //     db.write();
 1057       // Empty database creation end
 1058   
 1059       // Load and save start
 1060   //     Database db = new Database(path);
 1061   //     db.write();
 1062       // Load and save end
 1063   
 1064       // Add tracks start
 1065       Database db = new Database(path, NeurosDevice.NEUROS_20GBHD);
 1066   //     Database db = new Database(path, true, NeurosDevice.NEUROS_20GBHD);
 1067   //     db.write();
 1068   //     db.testTrackAdd1();
 1069   //     db.testTrackAdd1();
 1070       System.out.println(db);
 1071       // Add tracks end
 1072     }
 1073   
 1074   
 1075     public String toString() {
 1076       String returnString = new String();
 1077       returnString += "path = " + path + "\n";
 1078       returnString += audioDB.toString();
 1079   //     returnString += unidedhisiDB.toString();
 1080   //     returnString += idedhisiDB.toString();
 1081   //     returnString += failedhisiDB.toString();
 1082   //     returnString += pcaudioDB.toString();
 1083   
 1084       return returnString;
 1085     }
 1086     
 1087     public boolean deleteQueueContains(AudioRecord record){
 1088     	if (deleteQueue.contains(record)) {
 1089     		return true;
 1090     	}
 1091     	else {
 1092     		return false;
 1093     	}
 1094     }
 1095     
 1096     public boolean syncQueueContains(AudioRecord record){
 1097     	if (syncQueue.contains(record)){
 1098     		return true;
 1099     	}
 1100     	else {
 1101     		return false;
 1102     	}
 1103     }
 1104     
 1105     public ArrayList queryTracksForArtist(int artistKey){
 1106     	ArrayList retList = new ArrayList();
 1107     	ArrayList displayIndexes = audioDB.query(AudioDBBase.DBTYPE_AUDIO, DB_ARTISTS, artistKey);
 1108     	for (int i = 0; i < displayIndexes.size(); i++) {
 1109     		AudioDisplayRecord track = (AudioDisplayRecord) query((DisplayIndex) displayIndexes.get(i));
 1110     		retList.add(track);
 1111     	}
 1112     	return retList;
 1113     }
 1114     
 1115     public ArrayList queryTracksForAlbum(int albumKey) {
 1116   	ArrayList retList = new ArrayList();
 1117   	ArrayList displayIndexes = audioDB.query(AudioDBBase.DBTYPE_AUDIO, DB_ALBUMS, albumKey);
 1118   	for (int i = 0; i < displayIndexes.size(); i++) {
 1119   		AudioDisplayRecord track = (AudioDisplayRecord) query((DisplayIndex) displayIndexes.get(i));
 1120   		retList.add(track);
 1121   	}
 1122   	return retList;
 1123     }
 1124     
 1125     public ArrayList queryTracksForGenre(int genreKey) {
 1126   	ArrayList retList = new ArrayList();
 1127   	ArrayList displayIndexes = audioDB.query(AudioDBBase.DBTYPE_AUDIO, DB_GENRES, genreKey);
 1128   	for (int i = 0; i < displayIndexes.size(); i++) {
 1129   		AudioDisplayRecord track = (AudioDisplayRecord) query((DisplayIndex) displayIndexes.get(i));
 1130   		retList.add(track);
 1131   	}
 1132   	return retList;
 1133     }
 1134   
 1135     public ArrayList queryTracksForPlaylist(int playlistKey) {
 1136   	ArrayList retList = new ArrayList();
 1137   	ArrayList displayIndexes = audioDB.query(AudioDBBase.DBTYPE_AUDIO, DB_PLAYLISTS, playlistKey);
 1138   	for (int i = 0; i < displayIndexes.size(); i++) {
 1139   		AudioDisplayRecord track = (AudioDisplayRecord) query((DisplayIndex) displayIndexes.get(i));
 1140   		retList.add(track);
 1141   	}
 1142   	return retList;
 1143     }
 1144     
 1145     public boolean hasModifiedPlaylists() {
 1146     	return modifiedPlaylists;
 1147     }  
 1148   }

Save This Page
Home » openjdk-7 » net.sourceforge » neurosdbm » db » [javadoc | source]