Beispiel #1
0
  private int logMessages(FileWriter f, ArrayList<MyPhoto> photos) {

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

    return photos.size();
  }
Beispiel #2
0
  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");
  }
Beispiel #3
0
  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()));
  }