From a92d89d3fcc826cd0a7164201c6f25f756fd9afc Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 4 May 2024 18:59:57 +0200 Subject: edit-in-place operations now require an additional --edit-in-place flag --- bin/pyggle | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/pyggle b/bin/pyggle index 07b778a..dbccd55 100755 --- a/bin/pyggle +++ b/bin/pyggle @@ -548,6 +548,11 @@ if __name__ == "__main__": action="store_true", help="Store captions as EXIF comments (IN-PLACE EDIT)", ) + parser.add_argument( + "--edit-in-place", + action="store_true", + help="Enable options that edit images in-place", + ) parser.add_argument( "--exif-copyright", metavar="STRING", @@ -598,6 +603,18 @@ if __name__ == "__main__": args = parser.parse_args() + if ( + args.caption_to_exif + or args.exif_copyright + or args.resize + or args.scrub_metadata + ) and not args.edit_in_place: + print( + "in-place edit option used without --edit-in-place, aborting", + file=sys.stderr, + ) + sys.exit(1) + base_dir = "/".join(os.path.realpath(sys.argv[0]).split("/")[:-2]) copy_files(f"{base_dir}/share") @@ -629,7 +646,11 @@ if __name__ == "__main__": ) thumbnails.append(thumbnail) - if args.resize and (im.size[0] > args.resize or im.size[1] > args.resize): + if ( + args.edit_in_place + and args.resize + and (im.size[0] > args.resize or im.size[1] > args.resize) + ): subprocess.run( [ "mogrify", @@ -658,7 +679,7 @@ if __name__ == "__main__": ] ) - if exiftool_args: + if args.edit_in_place and exiftool_args: subprocess.run( [ "exiftool", -- cgit v1.2.3