Fix -j argument

This commit is contained in:
Alexander Wainwright
2025-12-21 00:10:07 +10:00
parent c91a151a2b
commit f188dd04de

View File

@@ -53,9 +53,16 @@ def parse_args(config):
# Time settings
parser.add_argument('--base-date', default=None, help='Base date or date/time (e.g. 2023-04-10 or 2023-04-10 12:00:00).')
parser.add_argument('--time-increment', type=int, default=None, help='Time increment in seconds between images.')
parser.add_argument('--sidecar', action='store_true', help='Write to sidecar XMP files (e.g. image.jpg.xmp) instead of embedding.')
parser.add_argument('--embed', action='store_true', help='Embed EXIF data directly into the image file instead of a sidecar.')
parser.add_argument('--dry-run', action='store_true', help='Show what would be changed without modifying files.')
parser.add_argument('-j', '--workers', type=int, default=os.cpu_count() or 1, help='Number of parallel workers to run exiftool; defaults to number of CPUs.')
parser.add_argument(
'-j', '--workers',
type=int,
nargs='?',
const=os.cpu_count() or 1,
default=os.cpu_count() or 1,
help='Number of parallel workers to run exiftool; defaults to number of CPUs.'
)
parser.add_argument('--init-config', action='store_true', help='Create a default config file (if none exists) and exit.')
args = parser.parse_args()
@@ -257,7 +264,7 @@ def main():
timestamp_str = ts_dt.strftime("%Y:%m:%d %H:%M:%S")
sidecar_source = None
if args.sidecar:
if not args.embed:
target_file_path = f"{f}.xmp"
# If sidecar doesn't exist, we must tell ExifTool to create it from the source image
if not os.path.exists(target_file_path):