示例#1
0
def remove_marker(object):
    changed = False
    if IAudio.providedBy(object):
        noLongerProvides(object, IAudio)
        changed = True
    if IVideo.providedBy(object):
        noLongerProvides(object, IVideo)
        changed = True
    if changed:
        object.reindexObject(idxs=['object_provides'])
示例#2
0
    def handleVideo(self):
        handle = self.file_handle
        try:
            metadata = parse_raw(handle)
            height, width = scale_from_metadata(metadata)
            handle.close()
        except StreamError:
            height = width = None

        if not IVideo.providedBy(self.content):
            alsoProvides(self.content, IVideo)
            self.object.reindexObject(idxs=['object_provides'])

        if height and width:
            info = IMediaInfo(self.content)
            info.height = height
            info.width = width