Package elisa :: Package core :: Package utils :: Module mime_getter :: Class MimeGetter
[hide private]
[frames] | no frames]

Class MimeGetter

source code

Class for getting the type and mime info of a file.

Instance Methods [hide private]
 
__init__(self) source code
 
_set_up_pipeline(self, source='filesrc') source code
Deferred
get_type(self, source, location)
Return a defer which will look up the type of a file.
source code
 
_set_pipeline(self, source, location) source code
 
_unknown_type_cb(self, dbin, pad, caps) source code
 
_notify_caps_cb(self, pad, args) source code
 
_new_decoded_pad_cb(self, dbin, pad, is_last) source code
 
_got_type(self, typefind, arg1, mime_type) source code
 
_event_cb(self, bus, msg) source code
Method Details [hide private]

get_type(self, source, location)

source code 

Return a defer which will look up the type of a file. This defer might needs a lot of time, because we are currently only doing one lookup at a time and the other ones are put into a queue.

The callback-result of the Deferred then is a dictionary containing this:
  • file_type: mapped to a string, which is one of 'video', 'audio' or 'image' or '' (if none of these three)
  • mime_type: mapped to a string, containing the mime_type
Parameters:
  • source (String) - the name of the gstreamer-source element to use for e.g. 'filesrc' or 'gnomevfssrc'
  • location (String) - to which location should the source be set to?
Returns: Deferred