Allow to add process limit
This commit is contained in:
parent
fc9de0953c
commit
967dbd8d4f
1 changed files with 9 additions and 0 deletions
|
@ -45,6 +45,10 @@ if __name__ == '__main__':
|
|||
# Load saved pictures cache
|
||||
saved_pictures = _load_pictures_cache()
|
||||
|
||||
# Keep track of processed pictures
|
||||
processed_pictures = 0
|
||||
max_processed_pictures = None if len(sys.argv) < 3 else int(sys.argv[2])
|
||||
|
||||
for file in Path(sys.argv[1]).rglob("*.ARW"):
|
||||
filename = os.fsdecode(file)
|
||||
|
||||
|
@ -63,6 +67,11 @@ if __name__ == '__main__':
|
|||
|
||||
saved_pictures[picture_metadata['path']] = True
|
||||
|
||||
processed_pictures = processed_pictures + 1
|
||||
|
||||
if max_processed_pictures is not None and processed_pictures >= max_processed_pictures:
|
||||
break
|
||||
|
||||
# Insert into MongoDB
|
||||
if len(metadata_pictures) > 0:
|
||||
collection.insert_many(metadata_pictures)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue