def picture_generator(self, host, user, key): try: shutil.rmtree(self.exportdir) # loesche altes exportDir except WindowsError: pass self.powerpoint.get_images_from_ppt(self.exportdir) imgstring = '' filelist = [os.path.join(self.exportdir, self.outfilename)] oslistdir = os.listdir(self.exportdir) sort_nicely(oslistdir) for f in oslistdir: imgstring += (" " * 50) + "{ url: '" + f + "'},\n" filelist.append(os.path.join(self.exportdir, f)) template = open(self.templatefile, 'r').read() template = template.replace('IMAGE_LIST', imgstring[:-2]) f = open(os.path.join(self.exportdir, self.outfilename), 'w+') f.write(template) f.close() fileupload = FileUpload(host, user, key) fileupload.multi_upload(filelist, self.remotepicturepath) fileupload.close()
def site_generator(self, host, user, key): content = self.dict_generator() with open('data.json', 'w') as f: json.dump(self.to_json(content), f) with open('index.html', 'w') as f: f.write(self.to_html(content)) with open('time', 'w') as f: f.write((time.time()).split(".")[0]) fileupload = FileUpload(host, user, key) fileupload.upload('index.html', "www") fileupload.upload('time', "www") fileupload.upload('data.json', "www") fileupload.close()