Пример #1
0
def build_watermark_arg(watermark, vsize):
    # calc video rect & watermark rect
    wfile = vtxutil.get_file_from_fs(watermark.fileKey)
    wsize = imageutil.get_image_size(wfile)
    vrect = Rect(0, 0, vsize[0], vsize[1])
    offsetx, offsety = _calc_offset(watermark, wsize, vsize)
    wrect = Rect(offsetx, offsety, wsize[0], wsize[1])

    # build arg string
    source = _build_watermark_source(wrect, vrect, wfile)
    if source is None:
        return None
    overlay = _build_watermark_overlay(offsetx, offsety)
    return source + overlay
Пример #2
0
def build_watermark_arg(watermark, vsize):
    # calc video rect & watermark rect
    wfile = vtxutil.get_file_from_fs(watermark.fileKey)
    wsize = imageutil.get_image_size(wfile)
    vrect = Rect(0, 0, vsize[0], vsize[1])
    offsetx, offsety = _calc_offset(watermark, wsize, vsize)
    wrect = Rect(offsetx, offsety, wsize[0], wsize[1])
    
    # build arg string
    source = _build_watermark_source(wrect, vrect, wfile)
    if source is None:
        return None
    overlay = _build_watermark_overlay(offsetx, offsety)
    return source + overlay
Пример #3
0
        def _read_headers(self):
            return self._read_headers_from_dict(self.request.META)

        def _process_resp(self, resp):
            r = HttpResponse(resp.body)
            r.status_code = resp.code
            for k, v in resp.headers.items():
                r[k] = v
            return r

    DEBUG = False
    FORCE_SCRIPT_NAME = ''
    MIDDLEWARE_CLASSES = ()
    ROOT_URLCONF = __name__
    urlpatterns = None
    FILE_UPLOAD_TEMP_DIR = vtxutil.get_file_from_fs('tmp')
    if not os.path.exists(FILE_UPLOAD_TEMP_DIR):
        os.makedirs(FILE_UPLOAD_TEMP_DIR)
    FILE_UPLOAD_HANDLERS = (
        "django.core.files.uploadhandler.TemporaryFileUploadHandler", )

    def run_server(coor=None):
        _run(coor, ['runserver', '8080'])

    def run_fcgi(coor=None):
        _run(coor, ['runfcgi', 'socket=/tmp/fastcgi.socket-0'])

    def _run(coor, argv):
        global urlpatterns
        urlpatterns = patterns('', url('.*', coor or DjangoCoor()))
        os.environ['DJANGO_SETTINGS_MODULE'] = __name__
Пример #4
0
        def _read_headers(self):
            return self._read_headers_from_dict(self.request.META)
        
        def _process_resp(self, resp):
            r = HttpResponse(resp.body)
            r.status_code = resp.code
            for k, v in resp.headers.items():
                r[k] = v
            return r

    DEBUG = False
    FORCE_SCRIPT_NAME = ''
    MIDDLEWARE_CLASSES = ()
    ROOT_URLCONF = __name__
    urlpatterns = None
    FILE_UPLOAD_TEMP_DIR = vtxutil.get_file_from_fs('tmp')
    if not os.path.exists(FILE_UPLOAD_TEMP_DIR):
        os.makedirs(FILE_UPLOAD_TEMP_DIR)
    FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.TemporaryFileUploadHandler",)

    def run_server(coor=None):
        _run(coor, ['runserver', '8080'])
        
    def run_fcgi(coor=None):
        _run(coor, ['runfcgi', 'socket=/tmp/fastcgi.socket-0'])
        
    def _run(coor, argv):
        global urlpatterns
        urlpatterns = patterns('',
            url('.*', coor or DjangoCoor())
        )