Example #1
0
def forward_to_local(request, uid):
    full_path = content.fullpath(uid)

    if full_path is None:
        log.error('requested uid({}) is invalid'.format(uid))
        raise Http404
    return static.serve(request, path=full_path, document_root='/')
Example #2
0
    def _display_single(self, uid, device_idx):
        full_path = content.fullpath(uid)
        unit_time = settings.get('airplay', 'time_per_slide')

        if full_path is not None:
            data   = open(full_path).read()
            self.header['Content-Length'] = len(data)           
            request = urllib2.Request('http://{}:7000/photo'.format(self.devices[device_idx]), data=data, headers=self.header)
            request.get_method = lambda: 'PUT'
            url = self.opener.open(request)
            time.sleep(int(unit_time))
Example #3
0
    def _display_single(self, uid, device_idx):
        full_path = content.fullpath(uid)
        unit_time = settings.get('airplay', 'time_per_slide')

        if full_path is not None:
            data = open(full_path).read()
            self.header['Content-Length'] = len(data)
            request = urllib2.Request('http://{}:7000/photo'.format(
                self.devices[device_idx]),
                                      data=data,
                                      headers=self.header)
            request.get_method = lambda: 'PUT'
            url = self.opener.open(request)
            time.sleep(int(unit_time))
Example #4
0
    def _do_video(self, request):
        self.args['id'] = str(request.GET.get('id', content.VIDEO))
        self._prepare_browse(request)
        if self.args['self'].get('child_container_count', 0) != 0:
            for row in self.args['rows']:
                self._pretty_format(request, row)
        else:
            self.args['view_mode'] = 'on'
            for row in self.args['rows']:
                row['video_width'], row['video_height'] = \
                    get_resize(row.get('width', 0), row.get('height', 0), 900, 600)
                row['fullpath'] = content.fullpath(row['uid']).lstrip(settings.get("web", "path_base"))

        self.args['cur_menu'] = 'video'
        return ('video.html', self.args)