Skip to content

Commit

Permalink
Merge pull request 27 smarnach#27 which also exists in a different repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sylikc committed Jul 17, 2019
1 parent 4d60d49 commit d6db5b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Date (Timezone) | Version | Comment
07/17/2019 12:50:20 AM (PDT) | 0.1 | Convert leading spaces to tabs
07/17/2019 12:52:33 AM (PDT) | 0.1.1 | Merge [Pull request #10 "add copy_tags method"](https://github.com/smarnach/pyexiftool/pull/10) by [Maik Riechert (letmaik) Cambridge, UK](https://github.com/letmaik) on May 28, 2014<br> *This adds a small convenience method to copy any tags from one file to another. I use it for several month now and it works fine for me.*
07/17/2019 01:05:37 AM (PDT) | 0.1.2 | Merge [Pull request #25 "Added option for keeping print conversion active. #25"](https://github.com/smarnach/pyexiftool/pull/25) by [Bernhard Bliem (bbliem)](https://github.com/bbliem) on Jan 17, 2019<br> *For some tags, disabling print conversion (as was the default before) would not make much sense. For example, if print conversion is deactivated, the value of the Composite:LensID tag could be reported as something like "8D 44 5C 8E 34 3C 8F 0E". It is doubtful whether this is useful here, as we would then need to look up what this means in a table supplied with exiftool. We would probably like the human-readable value, which is in this case "AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED".*<br>*Disabling print conversion makes sense for a lot of tags (e.g., it's nicer to get as the exposure time not the string "1/2" but the number 0.5). In such cases, even if we enable print conversion, we can disable it for individual tags by appending a # symbol to the tag name.*
07/17/2019 01:20:15 AM (PDT) | 0.1.3 | Merge with slight modifications to variable names for clarity (Kevin Mak) [Pull request #27 "Add "shell" keyword argument to ExifTool initialization"](https://github.com/smarnach/pyexiftool/pull/27) by [Douglas Lassance (douglaslassance) Los Angeles, CA](https://github.com/douglaslassance) on 5/29/2019<br>*On Windows this will allow to run exiftool without showing the DOS shell.*<br>**This might break Linux but I don't know for sure**<br>Alternative source location with only this patch: https://github.com/blurstudio/pyexiftool/tree/shell-option



Expand Down
12 changes: 10 additions & 2 deletions exiftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class ExifTool(object):
associated with a running subprocess.
"""

def __init__(self, executable_=None, print_conversion=False):
def __init__(self, executable_=None, win_shell=True, print_conversion=False):
self.win_shell = win_shell
self.print_conversion = print_conversion
if executable_ is None:
self.executable = executable
Expand All @@ -179,10 +180,17 @@ def start(self):
command.append("-n")

with open(os.devnull, "w") as devnull:
startup_info = subprocess.STARTUPINFO()
if not self.win_shell:
SW_FORCEMINIMIZE = 11 # from win32con
# Adding enum 11 (SW_FORCEMINIMIZE in win32api speak) will
# keep it from throwing up a DOS shell when it launches.
startup_info.dwFlags |= 11

self._process = subprocess.Popen(
command,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=devnull)
stderr=devnull, startupinfo=startup_info)
self.running = True

def terminate(self):
Expand Down

0 comments on commit d6db5b3

Please sign in to comment.