From 7b28990b5af30df5f624c94e39699cec8839543a Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Sun, 6 Apr 2008 05:00:01 -0500 Subject: [PATCH] Unlink the video adter sending it. We could unlink it when the tranfer failed, but we would send a 206 response anyway. --- plugins/webvideo/webvideo.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/webvideo/webvideo.py b/plugins/webvideo/webvideo.py index 4fd522f..710a4d1 100644 --- a/plugins/webvideo/webvideo.py +++ b/plugins/webvideo/webvideo.py @@ -9,6 +9,8 @@ import urllib2 import os.path import shutil import os.path +import os +import urlparse import urllib import xml.etree.ElementTree as ElementTree import Queue @@ -139,3 +141,13 @@ class WebVideo(Video): shutil.copyfileobj(infile, outfile, 8192) print 'done downloading %s to %s' % (url, file_path) + + def send_file(self, handler, container, name): + Video.send_file(self, handler, container, name) + + o = urlparse.urlparse("http://fake.host" + handler.path) + path = urllib.unquote(o[2]) + file_path = container['path'] + path[len(name) + 1:] + if os.path.exists(file_path): + os.unlink(file_path) + -- 2.11.4.GIT