コード例 #1
0
ファイル: ComplexComparison.java プロジェクト: blackco/photos
  private int logMessages(FileWriter f, ArrayList<MyPhoto> photos) {

    for (MyPhoto p : photos) {
      this.log(f, p.getFilename());
    }

    return photos.size();
  }
コード例 #2
0
ファイル: ComplexComparison.java プロジェクト: blackco/photos
  public void process(boolean tryAgain) {

    int count = 0;

    ArrayList<MyPhoto> list = new ArrayList<MyPhoto>();

    for (String dir : myPhotos.getDirectories()) {
      list.addAll(myPhotos.getUnprocessedPhotos(dir));
      logger.debug(
          "process: unprocessed photos(): dir = "
              + dir
              + ", photos="
              + myPhotos.getUnprocessedPhotos(dir));

      if (tryAgain) {
        list.addAll(myPhotos.getUnmatchedPhotos(dir));
        list.addAll(myPhotos.getInsufficientMetaDataNoCamera(dir));
        list.addAll(myPhotos.getInsufficientMetaDataNoDate(dir));
      }
    }

    logger.info("tryAgain=" + tryAgain + ",photos to process " + list);

    for (MyPhoto p : list) {

      count++;
      if (p.getDateTaken() == null) {

        p.setFlickrPhotoId((FlickrPhoto.INSUFFICIENT_METADATA_NO_DATE));
      } else if (p.getCamera() == null) {

        p.setFlickrPhotoId((FlickrPhoto.INSUFFICIENT_METADATA_NO_CAMERA));
      } else {

        p.setFlickrPhotoId((FlickrPhoto.UNMATCHED));

        ArrayList<FlickrPhoto> found = this.getPhotosForTakenOn(p.getDateTaken());

        for (FlickrPhoto potentialMatchOnFlickr : found) {
          getExif.getExif(potentialMatchOnFlickr.id);

          if (this.compare(p, potentialMatchOnFlickr)) {

            p.setFlickrPhotoId(potentialMatchOnFlickr.id);
          }
        }
      }

      logger.debug("MyPhoto=" + p);

      logger.info("ComplexComparision: Processed " + count + " of " + list.size());

      myPhotos.save();
    }

    logger.info("ComplexComparision: Persisted");
  }
コード例 #3
0
ファイル: ComplexComparison.java プロジェクト: blackco/photos
  public boolean compare(MyPhoto photo, FlickrPhoto potentialMatchOnFlickr) {

    logger.info(
        "Matching : "
            + photo.getFilename()
            + ", "
            + photo.getDateTaken()
            + " comparing "
            + potentialMatchOnFlickr.dateTaken
            + " and  "
            + photo.getCamera()
            + potentialMatchOnFlickr.camera);

    return (FlickrPhotoDate.compareToSecondPrecision(
            potentialMatchOnFlickr.dateTaken, photo.getDateTaken())
        && potentialMatchOnFlickr.camera.equals(photo.getCamera()));
  }