morphbr@718: #!/usr/bin/env python morphbr@718: morphbr@718: __author__ = "Gustavo Sverzut Barbieri / Artur Duque de Souza" morphbr@718: __author_email__ = "barbieri@gmail.com / artur.souza@indt.org.br" morphbr@718: __license__ = "GPL" morphbr@718: __version__ = "0.4" morphbr@718: morphbr@718: __all__ = ("Transcoder") morphbr@718: morphbr@718: class Transcoder(object): morphbr@718: """Transcoder's Class: parent class to implement morphbr@718: a plugin for transcoding data.""" morphbr@718: priority = 0 # negative values have higher priorities morphbr@718: name = None # to be used in requests morphbr@718: status = None morphbr@718: log = None morphbr@718: tid = -1 morphbr@718: morphbr@718: def __init__(self, params): morphbr@718: self.params = params morphbr@718: # __init__() morphbr@718: morphbr@718: def params_first(self, key, default=None): morphbr@718: if default is None: morphbr@718: return self.params[key][0] morphbr@718: else: morphbr@718: try: morphbr@718: return self.params[key][0] morphbr@718: except: morphbr@718: return default morphbr@718: # params_first() morphbr@718: morphbr@718: def get_mimetype(self): renatofilho@800: return "application/octet-stream" morphbr@718: # get_mimetype() morphbr@718: morphbr@718: def start(self, outfile): renatofilho@800: pass morphbr@718: # start() morphbr@718: renatofilho@800: def stop(self): renatofilho@800: pass renatofilho@800: # stop() morphbr@718: morphbr@837: def get_length (self): renatofilho@800: pass renatofilho@800: # get_leght () renatofilho@800: renatofilho@800: def get_progress (self): renatofilho@800: pass renatofilho@800: # get_progress () morphbr@718: morphbr@718: def __str__(self): morphbr@718: return '%s: %s( params=%s ) - Status: %s%%' % \ morphbr@718: (self.__class__.__name__, self.tid, morphbr@718: self.params, self.status) morphbr@718: # __str__() morphbr@718: # Transcoder