Beispiel #1
0
 def get_gallery_pictures(self):
     gallery = None
     pictures = []
     num_pictures = self.data.entries
     gallery = self.get_results()
     for i in gallery:
         iobj = i.getObject()
         if iobj.portal_type == 'on.video.Video':
             rdict = {'url': i.getURL()}
             vth = ViewThumbnail(iobj, iobj)            
             rdict['thumbnail'] = vth.thumbnail()
             rdict['title'] = vth.title()
             rdict['id'] = vth.id
             pictures.append(rdict)
     return pictures
Beispiel #2
0
def genSmallView(item, request=None):
    """Turn a content item into a dictionary. We only need specific
       information, depending on type.
    """
    result = dict(portaltype=item.portal_type, id=item.id, title=item.title)
    result["banner"] = "/++resource++on.video/nothumbnail.png"
    # import pdb; pdb.set_trace()
    try:  # Are we are in a collection?
        result["path"] = item.getPath()
    except:  # Or in a Folder?
        result["path"] = item.absolute_url()

    if item.portal_type == "Folder":
        (folders, videos) = countFolderItems(item)
        result["sub_folder"] = folders
        result["sub_videos"] = videos
        # assumption: the image is an ArcheTypes image
        if "bannerimage" in item.keys():
            result["thumb"] = "%s/bannerimage/image" % item.id
        titles = shorttitle(item.title)
        result["title"] = titles["short"]
        result["longtitle"] = titles["long"]

    elif item.portal_type == "on.video.Video":
        result["sub_folder"] = None
        result["sub_videos"] = None
        # this information is not accessible from here:
        vtn = ViewThumbnail(item, request)
        result["playingtime"] = vtn.playing_time
        result["thumb"] = vtn.thumbnail()
        titles = shorttitle(item.title)
        result["title"] = titles["short"]
        result["director"] = item.director or ""
        result["longtitle"] = titles["long"]

    elif item.portal_type == "Image":
        result["sub_folder"] = None
        result["sub_videos"] = None
        result["thumb"] = "%s/image" % item.id
        titles = shorttitle(item.title)
        result["title"] = titles["short"]
        result["longtitle"] = titles["long"]
    else:
        raise ValueError, "item %s is an object of an illegal type." % str(item)
    # print result
    return result