Exemplo n.º 1
0
  public void go() {
    FileList fl = null;
    try {
      fl = new FileList(inputPath);
      fl.read();
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(-1);
    }

    Queue<File> filesQ = fl.getFiles();

    LOG.info("Found " + filesQ.size() + " files to process");

    int c = 1;
    for (File file : filesQ) {
      String sum = null;
      String date = null;
      String type = getType(file);
      System.out.print(c + " ");
      if ((c % 20) == 0) {
        System.out.println();
      }
      c++;

      if (imageFile(type)) {
        try {
          sum = SHA256.digest(file);
        } catch (IOException e) {
          LOG.info("NOSHA: IO: " + file.getAbsolutePath());
        }

        try {
          date = getDate(file);
        } catch (IOException e) {
          LOG.info("NODATE: IO: " + file.getAbsolutePath());
        }

        if (sum != null && date != null) {
          storePhotoInfo(sum, date, file.getAbsolutePath());
        }
      } else {
        LOG.info("SKIP: skipping non-image file: " + file.getAbsolutePath());
      }
    }

    for (Photo p : pstore.getPhotos()) {
      savePhoto(p);
    }
  }
Exemplo n.º 2
0
 private void storePhotoInfo(String sum, String date, String path) {
   pstore.store(sum, date, path);
 }