diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 28c3ba84..f868ff99 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -53,6 +53,7 @@ import net.filebot.Settings; import net.filebot.hash.HashType; import net.filebot.media.FFProbe; import net.filebot.media.ImageMetadata; +import net.filebot.media.LocalDatasource.PhotoFile; import net.filebot.media.MetaAttributes; import net.filebot.media.PlexNamingStandard; import net.filebot.media.VideoFormat; @@ -945,6 +946,9 @@ public class MediaBindingBean { @Define("photo") public ImageMetadata getPhoto() throws Exception { + if (infoObject instanceof PhotoFile) { + return ((PhotoFile) infoObject).getMetadata(); + } return new ImageMetadata((File) infoObject); } diff --git a/source/net/filebot/media/LocalDatasource.java b/source/net/filebot/media/LocalDatasource.java index 861e77b1..d855f859 100644 --- a/source/net/filebot/media/LocalDatasource.java +++ b/source/net/filebot/media/LocalDatasource.java @@ -73,7 +73,7 @@ public enum LocalDatasource implements Datasource { try { ImageMetadata metadata = new ImageMetadata(f); if (metadata.getDateTaken().isPresent()) { - exifMap.put(f, f); // photo mode is the same as generic file mode (but only select photo files) + exifMap.put(f, new PhotoFile(f, metadata)); // photo mode is the same as generic file mode (but only select photo files) } else if (!strict) { exifMap.put(f, f); } @@ -90,4 +90,18 @@ public enum LocalDatasource implements Datasource { // enable xattr regardless of -DuseExtendedFileAttributes system properties private static final XattrMetaInfo xattr = new XattrMetaInfo(true, false); + public static class PhotoFile extends File { + + private final ImageMetadata metadata; + + public PhotoFile(File file, ImageMetadata metadata) { + super(file.getPath()); + this.metadata = metadata; + } + + public ImageMetadata getMetadata() { + return metadata; + } + } + }