コード例 #1
0
def load_metadata(item,
                  collection=None,
                  filename=None,
                  get_thumbnail=False,
                  missing_only=False,
                  check_for_sidecar=False,
                  notify_plugins=True):
    if item.meta is not None:
        meta = item.meta.copy()
    else:
        meta = None
    if filename is None:
        if collection is not None:
            filename = collection.get_path(item)
    print 'loading metadata for item', item
    if check_for_sidecar and 'sidecar' not in item.__dict__:
        p = os.path.splitext(collection.get_path(item))[0] + '.xmp'
        if os.path.exists(p):
            item.sidecar = collection.get_relpath(p)
        else:
            p = collection.get_path(item) + '.xmp'
            if os.path.exists(p):
                item.sidecar = collection.get_relpath(p)
    if check_for_sidecar and 'sidecar' in item.__dict__:
        if os.path.exists(collection.get_path(item.sidecar)):
            result = metadata.load_sidecar(item,
                                           collection.get_path(item.sidecar),
                                           missing_only)
            if get_thumbnail:
                metadata.load_thumbnail(item, collection.get_path(item))
        else:
            del item.sidecar
            result = metadata.load_metadata(item, filename, get_thumbnail,
                                            missing_only)
    else:
        result = metadata.load_metadata(item, filename, get_thumbnail,
                                        missing_only)
    if result:
        ##PICKLED DICT
        #        if isinstance(item.meta,dict):
        #            item.meta=imageinfo.PickledDict(item.meta)
        if item.thumb and get_thumbnail:
            item.thumb = orient_pixbuf(item.thumb, item.meta)
        if collection is not None and notify_plugins and item.meta != meta:
            pluginmanager.mgr.callback_collection(
                't_collection_item_metadata_changed', collection, item, meta)
    return result
コード例 #2
0
ファイル: imagemanip.py プロジェクト: spillz/picty
def load_metadata(item,collection=None,filename=None,get_thumbnail=False,missing_only=False,check_for_sidecar=False,notify_plugins=True):
    if item.meta is not None:
        meta=item.meta.copy()
    else:
        meta=None
    if filename is None:
        if collection is not None:
            filename=collection.get_path(item)
    print 'loading metadata for item',item
    if check_for_sidecar and 'sidecar' not in item.__dict__:
        p=os.path.splitext(collection.get_path(item))[0]+'.xmp'
        if os.path.exists(p):
            item.sidecar=collection.get_relpath(p)
        else:
            p=collection.get_path(item)+'.xmp'
            if os.path.exists(p):
                item.sidecar=collection.get_relpath(p)
    if check_for_sidecar and 'sidecar' in item.__dict__:
        if os.path.exists(collection.get_path(item.sidecar)):
            result=metadata.load_sidecar(item,collection.get_path(item.sidecar),missing_only)
            if get_thumbnail:
                metadata.load_thumbnail(item,collection.get_path(item))
        else:
            del item.sidecar
            result=metadata.load_metadata(item,filename,get_thumbnail,missing_only)
    else:
        result=metadata.load_metadata(item,filename,get_thumbnail,missing_only)
    if result:
##PICKLED DICT
#        if isinstance(item.meta,dict):
#            item.meta=imageinfo.PickledDict(item.meta)
        if item.thumb and get_thumbnail:
            item.thumb=orient_pixbuf(item.thumb,item.meta)
        if collection is not None and notify_plugins and item.meta!=meta:
            pluginmanager.mgr.callback_collection('t_collection_item_metadata_changed',collection,item,meta)
    return result
コード例 #3
0
def load_embedded_thumb(item, collection):
    if metadata.load_thumbnail(item, collection.get_path(item)):
        item.thumb = orient_pixbuf(item.thumb, item.meta)
        return True
    return False
コード例 #4
0
ファイル: imagemanip.py プロジェクト: spillz/picty
def load_embedded_thumb(item,collection):
    if metadata.load_thumbnail(item,collection.get_path(item)):
        item.thumb=orient_pixbuf(item.thumb,item.meta)
        return True
    return False