Exemplo n.º 1
0
 def __init__(self, store, path, title, count=-1, contents=None, contentsfunc=None, pt=None, publish_time=None, viewpath='', imageviewpath='', order=None, caption='', highlightpath=''):
     self.path = path
     self.title = title
     if highlightpath:
         self.highlightpath = highlightpath
     if pt:
         self.publish_time = pt
     elif publish_time:
         self.publish_time = publish_time
     else:
         self.publish_time = dtfromtimestamp(time.time())
     if order != None:
         self.order = order
     self.__count = count
     self.caption = caption
     if contentsfunc:
         self.__contentsfunc = contentsfunc
     else:
         self.__contents = contents
     if viewpath:
         self.viewpath = store.find_template(viewpath)
     else:
         self.viewpath = store.find_template('album.html')
     if imageviewpath:
         self.imageviewpath = store.find_template(imageviewpath)
     else:
         self.imageviewpath = store.find_template('view.html')
Exemplo n.º 2
0
 def load_path(self, path, fileinfo):
     if path.endswith(fileinfo.extension):
         path = path[: -len(fileinfo.extension)]
     img = ImageItem()
     img.path = path
     img.aliases = (path + fileinfo.extension,)
     img.rawimagepath = fileinfo.path
     img.filename = fileinfo.filename
     self.store.handler.load_metadata(img, fileinfo)
     img.modify_time = fileinfo.mtime
     if not img.publish_time:
         p = month_dir(fileinfo.dirname)
         if p:
             year, month, t = p
             img.publish_time = t
         else:
             img.publish_time = dtfromtimestamp(fileinfo.mtime)
     if not img.title.strip():
         img.title = img.filename
     rootzor = fileinfo.dirname[len(self.store.root) + 1 :]
     img.viewfilepath = os.path.join(self.store.view_root, rootzor)
     return img