Skip to content
Snippets Groups Projects
Commit 16769355 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Use commands.mkarg to properly quote file names.

parent e37e6f77
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import os ...@@ -5,6 +5,7 @@ import os
import sys import sys
import time import time
import getopt import getopt
import commands
import pygtk import pygtk
pygtk.require('2.0') pygtk.require('2.0')
...@@ -30,7 +31,8 @@ class ImageCache(object): ...@@ -30,7 +31,8 @@ class ImageCache(object):
def processed_file(self, infile, rotation = 0): def processed_file(self, infile, rotation = 0):
if rotation == 0: if rotation == 0:
fp = os.popen("identify -format \"%w %h\" " + infile) fp = os.popen("identify -format \"%w %h\""
+ commands.mkarg(infile))
words = fp.read().split() words = fp.read().split()
fp.close() fp.close()
w = int(words[0]) w = int(words[0])
...@@ -51,12 +53,15 @@ class ImageCache(object): ...@@ -51,12 +53,15 @@ class ImageCache(object):
if rotation == 0: if rotation == 0:
os.system("djpeg %s" os.system("djpeg %s"
"|pnmscale -xysize %s %s|cjpeg -optimize > %s" % ( "|pnmscale -xysize %s %s|cjpeg -optimize > %s" % (
infile, self.width, self.height, fn)) commands.mkarg(infile), self.width, self.height,
commands.mkarg(fn)))
else: else:
os.system("jpegtran -rotate %s %s" os.system("jpegtran -rotate %s %s"
"|djpeg" "|djpeg"
"|pnmscale -xysize %s %s|cjpeg -optimize > %s" % ( "|pnmscale -xysize %s %s|cjpeg -optimize > %s" % (
rotation, infile, self.width, self.height, fn)) rotation, commands.mkarg(infile),
self.width, self.height,
commands.mkarg(fn)))
return fn return fn
def hint(self, infile, rotation = 0): def hint(self, infile, rotation = 0):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment