Added locking to exiftool
This commit is contained in:
@@ -17,6 +17,7 @@ import pathlib
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import threading
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from functools import lru_cache # pylint: disable=syntax-error
|
from functools import lru_cache # pylint: disable=syntax-error
|
||||||
|
|
||||||
@@ -249,6 +250,7 @@ class ExifTool:
|
|||||||
self._exiftoolproc = _ExifToolProc(
|
self._exiftoolproc = _ExifToolProc(
|
||||||
exiftool=exiftool, large_file_support=large_file_support
|
exiftool=exiftool, large_file_support=large_file_support
|
||||||
)
|
)
|
||||||
|
self._lock = threading.Lock()
|
||||||
self._read_exif()
|
self._read_exif()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -352,6 +354,7 @@ class ExifTool:
|
|||||||
if not commands:
|
if not commands:
|
||||||
raise TypeError("must provide one or more command to run")
|
raise TypeError("must provide one or more command to run")
|
||||||
|
|
||||||
|
with self._lock:
|
||||||
if self._context_mgr and self.overwrite:
|
if self._context_mgr and self.overwrite:
|
||||||
commands = list(commands)
|
commands = list(commands)
|
||||||
commands.append("-overwrite_original")
|
commands.append("-overwrite_original")
|
||||||
|
|||||||
Reference in New Issue
Block a user