コード例 #1
0
ファイル: views.py プロジェクト: old-fashion/mediaplat
    def _prepare_browse(self, request):
        self.args['start'] = str(request.GET.get('start', 0))
        self.args['count'] = str(request.GET.get('count', settings.get('web', 'count_per_page')))

        page = int(request.GET.get('page', '0'))
        if self.args['id'].find('image') < 0:
            request_count = int(settings.get('web', 'count_per_page'))
        else:
            request_count = int(settings.get('web', 'image_per_page'))
        start_index = request_count * page

        self.args['self'] = content.browse_metadata(self.args['id'])

        if self.args['self'].get('type') == 'container':
            self.args['single'] = False
            self.args['parents'] = content.parents(self.args['id'])
            self.args['rows'] = content.browse_children(self.args['id'], 
                                start_index = start_index, request_count = request_count)
            self.args['cur_page'] = page
            page_node = self.args['self']
        else:
            self.args['single'] = True
            self.args['parents'] = content.parents(self.args['self'].get('pid'))
            self.args['rows'] = [ self.args['self'] ]
            self.args['cur_page'] = page
            #page_node = content.browse_metadata(self.args['self'].get('pid'))
            page_node = self.args['self']

        self.args['page_range'] = range(page_node.get('child_count', 0) / request_count + 1) 
        items = page_node.get('child_item_count', 0)
        containers = page_node.get('child_container_count', 0)
        self.args['items'] = pretty_count([(containers, " container", " containers"), (items, " item", " items")])
コード例 #2
0
ファイル: airplay.py プロジェクト: mattli001/mediaplat
    def send_image(self, uid, device_idx):
        meta   = content.browse_metadata(str(uid))

        if meta is not None:
            if meta.get('type') == 'container':
                for item in content.browse_children(str(uid)):
                    self._display_single(item['uid'], device_idx)
            else:
                self._display_single(uid, device_idx)
コード例 #3
0
    def send_image(self, uid, device_idx):
        meta = content.browse_metadata(str(uid))

        if meta is not None:
            if meta.get('type') == 'container':
                for item in content.browse_children(str(uid)):
                    self._display_single(item['uid'], device_idx)
            else:
                self._display_single(uid, device_idx)