Skip to content

Commit

Permalink
avoid splitting path that contain space during gm identify call
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto512 authored and Psycojoker committed Jan 31, 2021
1 parent 87723a7 commit 6a54ee6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions prosopopee/prosopopee.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ def ratio(self):
+ " -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0"
)
command_list = command.split()
# target is Type path.Path, encodes to bytes, decodes to str, which we can append to the
# list disgusting, I know. But it works
command_list.append(target.encode().decode())
command_list.append(str(target))
out = subprocess.check_output(command_list)
width, height = out.decode("utf-8").split(",")
return float(width) / int(height)
Expand Down Expand Up @@ -384,8 +382,10 @@ def generate_thumbnail(self, gm_geometry):

@property
def ratio(self):
command = "gm identify -format %w,%h " + self.base_dir.joinpath(self.name)
out = subprocess.check_output(command.split())
command = "gm identify -format %w,%h"
command_list = command.split()
command_list.append(str(self.base_dir.joinpath(self.name)))
out = subprocess.check_output(command_list)
width, height = out.decode("utf-8").split(",")
return float(width) / int(height)

Expand Down

0 comments on commit 6a54ee6

Please sign in to comment.