def get_metas(dirname, picfile): picentry = {} ### chemin de la miniature extension = splitext(picfile)[1].upper() # si le fichier est une vidéo, if extension in vidsext: picentry.update( {"EXIF DateTimeOriginal": strftime("%Y-%m-%d %H:%M:%S", gmtime(stat(join(dirname, picfile)).st_mtime))} ) # si le fichier est une image elif extension in picsext: thumbnails = Thumbnails() # picentry["Thumb"]=thumbnails.get_cached_picture_thumb( join(dirname,picfile) ).decode("utf8") ############################### # getting EXIF infos # ############################### # reading EXIF infos # (file fields are creating if needed) try: exif = MPDB.get_exif(join(dirname, picfile)) # EXIF infos are added to a dictionnary picentry.update(exif) except: print "Exception thrown from MPDB.get_exif" ############################### # getting IPTC infos # ############################### try: iptc = MPDB.get_iptc(dirname, picfile) # IPTC infos are added to a dictionnary picentry.update(iptc) except: print "Exception thrown from MPDB.get_iptc" ############################### # getting XMP infos # ############################### try: xmp = MPDB.get_xmp(dirname, picfile) picentry.update(xmp) except: print "Exception thrown from MPDB.get_xmp" else: picentry = {} # this should never happen MPDB.log("file was neither of video type, nor picture type... Check the extensions in settings", LOGNOTICE) return picentry