001package ca.bc.webarts.tools;
002
003import java.io.File;
004import ca.bc.webarts.widgets.DirReadBean;
005
006class TestApp
007{
008
009  public static void main (String [] args)
010  {
011    int numFiles = 0;
012    File tempFile = null;
013    File tempFile2 = null;
014    File tempFile3 = null;
015    //DirReadBean dirlist1 = new DirReadBean();
016    DirReadBean dirlist2 = null;
017    DirReadBean dirlist3 = null;
018    String dir1 = "g:\\snd\\ogg";
019    String[] currentDirfiles = (new File(dir1)).list();
020    //dirlist1.initFile(dir1);
021    //dirlist1.autoFormatFileNames();
022    
023    // now go back and grab the sub dirs
024    for (int i=0; i< currentDirfiles.length; i++)
025    {
026      tempFile = new File(dir1+File.separator+currentDirfiles[i]);
027      if(tempFile.isDirectory())
028      {
029        //dirlist2 = new DirReadBean();
030        String dir2 = dir1+File.separator+currentDirfiles[i];
031        String[] current2Dirfiles = (new File(dir2)).list();
032        if (current2Dirfiles.length > 0 && false)
033        {
034          dirlist2.setDirString("");
035          dirlist2.initFileName();
036          dirlist2.initDir(dir2);
037          dirlist2.autoFormatFileNames();
038        }
039        
040        // now go back and grab the sub dirs
041        for (int ii=0; ii< current2Dirfiles.length; ii++)
042        {
043          tempFile2 = new File(dir2+File.separator+current2Dirfiles[ii]);
044          if(tempFile2.isDirectory())
045          {
046            dirlist3 = new DirReadBean();
047            String dir3 = dir2+File.separator+current2Dirfiles[ii];
048            String[] current3Dirfiles = (new File(dir3)).list();
049            dirlist3.setDirString("");
050            dirlist3.initFileName();
051            dirlist3.initDir(dir3);
052            dirlist3.autoFormatFileNames();
053          }
054        }
055      }
056    }
057    
058    //dirlist1.setWinampFilename("warp2OggFiles.m3u");
059    //String playlist = dirlist1.
060    //          createWinampList("http://warp2.webarts.bc.ca/ogg/", dir1, false);
061    /*dirlist1.initDir(dir1, true); // true to recurse
062    String aList = dirlist1.getTitledAuthorList("ogg");
063    String [] magNames = dirlist1.getArtistsNames();
064    String currName = "";
065    for (int i=0; i< magNames.length; i++)
066    {
067      currName = magNames[i];
068      System.out.println(currName);
069    }
070    System.out.println(aList);
071    */
072
073  }
074}