コード例 #1
0
 def get_context(self, url, context):
     c = {
         'url': url,
         'parameters': dict((key, context[key])
                            for key in self.supported_parameters
                            if key in context)
     }
     if 'mime_type' in context:
         c['mime_type'] = normalize_mimetype(context['mime_type'])
     return c
コード例 #2
0
ファイル: files.py プロジェクト: sanyaade-teachings/djvideo
 def get_context(self, url, context):
     c = super(FileEmbedGenerator, self).get_context(url, context)
     mime_type = context.get('mime_type')
     if not mime_type:
         mime_type = mimetypes.guess_type(url, strict=False)[0]
     mime_type = normalize_mimetype(mime_type)
     c['mime_type'] = mime_type
     if mime_type in QUICKTIME_MIMETYPES:
         c['fallback_template'] = 'djvideo/files/quicktime.html'
     elif mime_type in FLASH_MIMETYPES:
         c['fallback_template'] = 'djvideo/files/flash.html'
     else:
         c['fallback_template'] = 'djvideo/files/default.html'
     return c
コード例 #3
0
ファイル: files.py プロジェクト: pculture/djvideo
 def get_context(self, url, context):
     c = super(FileEmbedGenerator, self).get_context(url, context)
     mime_type = context.get("mime_type")
     if not mime_type:
         mime_type = mimetypes.guess_type(url, strict=False)[0]
     mime_type = normalize_mimetype(mime_type)
     c["mime_type"] = mime_type
     if mime_type in QUICKTIME_MIMETYPES:
         c["fallback_template"] = "djvideo/files/quicktime.html"
     elif mime_type in FLASH_MIMETYPES:
         c["fallback_template"] = "djvideo/files/flash.html"
     else:
         c["fallback_template"] = "djvideo/files/default.html"
     return c
コード例 #4
0
ファイル: base.py プロジェクト: pculture/djvideo
 def get_context(self, url, context):
     c = {"url": url, "parameters": dict((key, context[key]) for key in self.supported_parameters if key in context)}
     if "mime_type" in context:
         c["mime_type"] = normalize_mimetype(context["mime_type"])
     return c