def download(request): response = urllib2.urlopen(request) self.size = self.chunk_read(response) if progress: self.progress = xbmcgui.DialogProgress() self.progress.create("Move", self.destination_file_name) xbmc.log("move %s -> %s" % (self.temp_file_path, self.destination_file_path)) vfs.rename(self.temp_file_path, self.destination_file_path) if vfs.exists(self.temp_file_path): vfs.copy(self.temp_file_path, self.destination_file_path) vfs.delete(self.temp_file_path) self.progress.close()