Esempio n. 1
0
 def add_thing_folder_to_library(self, thing, tmp_path):
     thing_dir = os.path.join('/tmp', tmp_path, str(thing.id))
     if not os.path.exists(thing_dir):
         os.makedirs(thing_dir)
     thing2opf(thing, path=os.path.join(thing_dir, 'metadata.opf'))
     preview = thing.preview(filename="x350-0.jpg")
     #preview = 'http://ecx.images-amazon.com/images/I/51fMBpPKSZL._SX331_BO1,204,203,200_.jpg'
     if preview:
         try:
             urllib.urlretrieve(
                 'http://aaaaarg.fail/pages/' + preview, os.path.join(thing_dir, "cover.jpg"))
         except:
             print "Could not generate cover: ", preview
     return thing_dir
Esempio n. 2
0
 def add_thing_folder_to_library(self, thing, tmp_path):
     thing_dir = os.path.join('/tmp', tmp_path, str(thing.id))
     if not os.path.exists(thing_dir):
         os.makedirs(thing_dir)
     thing2opf(thing, path=os.path.join(thing_dir, 'metadata.opf'))
     preview = thing.preview(filename="x350-0.jpg")
     #preview = 'http://ecx.images-amazon.com/images/I/51fMBpPKSZL._SX331_BO1,204,203,200_.jpg'
     if preview:
         try:
             urllib.urlretrieve('http://aaaaarg.fail/pages/' + preview,
                                os.path.join(thing_dir, "cover.jpg"))
         except:
             print "Could not generate cover: ", preview
     return thing_dir
Esempio n. 3
0
 def reset_opf(self):
     self.opf = thing2opf(self.thing)
     self.save()