Example #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'])
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'])
Example #3
0
 def _view(self):
     context_here = aq_inner(self.context)
     traverse_view = context_here.restrictedTraverse
     if HAS_FLOWPLAYER and (IVideo.providedBy(self.context)
                            or IAudio.providedBy(self.context)):
         return traverse_view('flowplayer')
     elif not self.embedcode():
         link = traverse_view('link_redirect_view')
         return link()
     else:
         return self.index()
Example #4
0
 def _view(self):
     context_here = aq_inner(self.context)
     traverse_view =  context_here.restrictedTraverse
     if HAS_FLOWPLAYER and (IVideo.providedBy(self.context) or
                            IAudio.providedBy(self.context)):
         return traverse_view('flowplayer')
     elif not self.embedcode():
         link = traverse_view('link_redirect_view')
         return link()
     else:
         return self.index()
Example #5
0
    def handleVideo(self):
        video = IVideo.providedBy(self.content)
        
        if not video:
            alsoProvides(self.content, IVideo)
            self.object.reindexObject(idxs=['object_provides'])

        info = IMediaInfo(self.content)

        if (not video) or (info.height == None or info.width == None):
            handle = self.file_handle
            try:
                metadata = parse_raw(handle)
                height, width = scale_from_metadata(metadata)
                handle.close()
            except StreamError:
                height = width = None

            if height and width:
                info.height = height
                info.width = width            
    def handleVideo(self):
        video = IVideo.providedBy(self.content)

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

        info = IMediaInfo(self.content)

        if (not video) or (info.height is None or info.width is None):
            handle = self.file_handle
            try:
                metadata = parse_raw(handle)
                height, width = scale_from_metadata(metadata)
                handle.close()
            except StreamError:
                height = width = None

            if height and width:
                info.height = height
                info.width = width
Example #7
0
 def gallery(self):
     queried_objects = list(self.context.listFolderContents())
     queried_objects = sorted(queried_objects, sort_by_position)
     result = {'gallery':[],'sound':[]}
     for obj in queried_objects:
         ptype = obj.portal_type
         if ptype == 'Image' or (ptype == 'Embed media' and obj.getMediaType() == '0') or (ptype in ['File', 'Link'] and IVideo.providedBy(obj)):
             result['gallery'].append(obj)
         if (ptype == 'Embed media' and obj.getMediaType() == '1') or (ptype in ['File', 'Link'] and IAudio.providedBy(obj)) :
             result['sound'].append(obj)
     return result