Package dnb.data.filetree

Examples of dnb.data.filetree.Folder


      Set<String> ignored, boolean folderNameIsLabelcode, boolean lookupLabelcodeInNfo) {
    for (Folder f : list) {
      if (f.findLabelcode() == null) { // no label code for this folder yet => assign
        CatalogNumberHibernateImpl lc = null;
        // walk bottom up and try to find label code
        Folder cur = f;
        if (folderNameIsLabelcode) {
          while(cur.getParent().getName() != null) { // walk until root
            lc = LabelcodeMatcher.findLabelcode(cur.getName());
            if (lc == null) {
              lc = LabelcodeMatcher.findLabelcode2(cur.getName());
            }
            if (lc != null) {
              break;
            }
            cur = (Folder) cur.getParent();
          }
        } else {
          while(cur.getParent().getName() != null // walk until root
              && (lc = LabelcodeMatcher.findLabelcode(cur.getName())) == null) {
            cur = (Folder) cur.getParent();
          }
        }       
        if (lc != null) { // got label code from folder => confirm
          if(!addLabelCode(interaction, labelCodes, ignored, cur, lc)) {
            // not confirmed => try get from nfo if indicated
View Full Code Here


   * @param absolutePath
   */
  public Mp3FileTreeBuilder() {
     matcher = FileSystems.getDefault().getPathMatcher("glob:*.{mp3,nfo}");
         
     this.virtualRoot = new Folder(null);  
      
  }
View Full Code Here

   * Append the current paht to the contained path.
   * @param absolutePath
   */
  public void appendPath(String absolutePath) {
    Path path = FileSystems.getDefault().getPath(absolutePath);
    Folder root = fromPath(path, true); // get root
    root.setScanDate(new Date()); // and set current scan date
   
    if (!root.isEmpty()) {
      reporter.start(absolutePath, true);
      root.clear();
    } else {
      reporter.start(absolutePath, false);
    }
    Files.walkFileTree(path, this); // populate it 
   
View Full Code Here

  private Folder fromPath(Path name, boolean appendLastAsFolder) {
    String rt = name.getRoot().toString();
    if (rt.endsWith(PATH_SEP)) {
      rt = rt.substring(0, rt.length() - PATH_SEP.length());
    }
    Folder cur = virtualRoot.getSubNode(rt);
   
    Path cpt;
    final int li = name.getNameCount() - 1;     
    // build subnode tree & add last node
    for (int i = 0; i < li; i++) {
      cpt = name.getName(i);             
      cur = cur.getSubNode(cpt.toString());       
    }
    if (appendLastAsFolder) {
      cur = cur.getSubNode(name.getName(li).toString());
    }
    return cur;
  }
View Full Code Here

    return cur;
  }
  private void addFile(Path name, BasicFileAttributes attrs) {
   
    final int li = name.getNameCount() - 1;     
    Folder cur = fromPath(name, false)
    if(!fileFolders.contains(cur)) {
      fileFolders.add(cur);
      reporter.fileFolder(cur);
    }   
    Path fil = name.getName(li);
    if (fil.toString().toLowerCase().endsWith(".mp3")) {
      mp3FileCount++;     
      Mp3File f = new Mp3File(fil.toString(), attrs.size());
      cur.add(f);
      reporter.file(f);
    } else {
      nfoFileCount++;
      NfoFile f = new NfoFile(fil.toString(), attrs.size());
      cur.add(f);
      reporter.file(f);
    }   
   
  }
View Full Code Here

TOP

Related Classes of dnb.data.filetree.Folder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.