Skip to content

Commit

Permalink
grab: whitespace fixes (trailing tabs)
Browse files Browse the repository at this point in the history
..and sorry about missing user info in the previous commit
  • Loading branch information
pieterg committed Jul 21, 2012
1 parent b4cd2c6 commit a4e13dd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions plugin/controllers/models/grab.py
Expand Up @@ -18,21 +18,21 @@ def __init__(self, path = ""):
resource.Resource.__init__(self)
self.container = eConsoleAppContainer()
self.container.appClosed.append(self.grabFinished)

def render(self, request):
self.request = request
graboptions = ""

if "format" in request.args.keys():
self.fileformat = request.args["format"][0]
else:
self.fileformat = "jpg"

if self.fileformat == "jpg":
graboptions += " -j 100"
elif self.fileformat == "png":
graboptions += " -p"

if "r" in request.args.keys():
size = request.args["r"][0]
graboptions += " -r %s" % size
Expand All @@ -43,12 +43,12 @@ def render(self, request):
graboptions += " -o"
elif mode == "video":
graboptions += " -v"

self.filepath = "/tmp/screenshot." + self.fileformat
grabcommand = GRAB_PATH + graboptions + " " + self.filepath

#self.container.execute(grabcommand)

os.system(grabcommand)
self.grabFinished()
return server.NOT_DONE_YET
Expand All @@ -61,13 +61,13 @@ def grabFinished(self, data=""):
self.request.setHeader('Content-Disposition', 'inline; filename=screenshot.%s;' % self.fileformat)
self.request.setHeader('Content-Type','image/%s' % fileformat)
self.request.setHeader('Content-Length', '%i' % os.path.getsize(self.filepath))

file = open(self.filepath)
self.request.write(file.read())
file.close()
self.request.finish()
except Exception, error:
self.request.setResponseCode(http.OK)
self.request.write("Error creating screenshot:\n %s" % error)
self.request.finish()
self.request.finish()

0 comments on commit a4e13dd

Please sign in to comment.