Ejemplo n.º 1
0
        private static int Main(string[] args)
        {
            var workingDirectory = new DirectoryInfo(CurrentPath);
            var exifTool         = new ExifTool(new ExifToolOptions {
                ExifToolPath = "/usr/bin/vendor_perl/exiftool"
            });
            var exifWrapper      = new ExifWrapper(exifTool);
            var rootImageHandler = new RootImageHandler(exifWrapper);

            var fromIPhoneOld = CommandExtensions.Create(
                "from-iphone-old", "Converts a dump from iPhone into a date-based directory structure",
                dryRun => FromIPhoneOld.Run(workingDirectory, dryRun));

            var fromIPhone = CommandExtensions.CreateWithOutput(
                "from-iphone", "Converts a dump from iPhone into a date-based directory structure",
                (dryRun, output) =>
            {
                new FromIPhone(exifWrapper)
                .Run(workingDirectory, output, dryRun);
            });

            var fixExif = CommandExtensions.Create(
                "fix-exif", "Set all the missing Exif dates in Exif in a directory, inferring the missing dates from directory names",
                dryRun =>
            {
                new FixExif(rootImageHandler).Run(workingDirectory, dryRun);
            });

            var removeDuplicateJpg = CommandExtensions.Create(
                "remove-duplicate-jpg", "Remove the JPG files that duplicate equivalent HEIC images",
                dryRun => RemoveDuplicateJpg.Run(workingDirectory, dryRun)
                );

            var separateIPhone5 = CommandExtensions.CreateWithOutput(
                "identify-iphone5", "Identify which photos have been taken with iPhone 5",
                (dryRun, output) =>
            {
                new IdentifyIPhone5(exifWrapper)
                .Run(workingDirectory, dryRun);
            });

            var rootCommand = new RootCommand
            {
                new Option("--version", "The current version of this tool"),
                fromIPhoneOld,
                fromIPhone,
                fixExif,
                removeDuplicateJpg,
                separateIPhone5
            };

            rootCommand.Handler = CommandHandler.Create(Version.VersionHandler);

            return(rootCommand.Invoke(args));
        }
Ejemplo n.º 2
0
        private static void AddPicturesFrom(string v)
        {
            DateTime dat;
            string   album;

            var di   = new DirectoryInfo(v);
            var name = di.Name;

            ParseName(name, out dat, out album);

            var images = Directory.GetFiles(v);

            foreach (var file in images)
            {
                var ef = new ExifWrapper(file);
                ef.AddDescription(album, dat);
            }
        }
Ejemplo n.º 3
0
 internal RootImageHandler(ExifWrapper exifWrapper)
 {
     _exifWrapper = exifWrapper;
 }