gmyth-stream/server/lib/transcoder.py
branchtrunk
changeset 835 36720270b368
parent 800 2b1824e138b1
child 837 6b3c7c0b32ad
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmyth-stream/server/lib/transcoder.py	Thu Aug 30 12:51:31 2007 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +__author__ = "Gustavo Sverzut Barbieri / Artur Duque de Souza"
     1.7 +__author_email__ = "barbieri@gmail.com / artur.souza@indt.org.br"
     1.8 +__license__ = "GPL"
     1.9 +__version__ = "0.4"
    1.10 +
    1.11 +__all__ = ("Transcoder")
    1.12 +
    1.13 +class Transcoder(object):
    1.14 +    """Transcoder's Class: parent class to implement
    1.15 +    a plugin for transcoding data."""
    1.16 +    priority = 0   # negative values have higher priorities
    1.17 +    name = None # to be used in requests
    1.18 +    status = None
    1.19 +    log = None
    1.20 +    tid = -1
    1.21 +
    1.22 +    def __init__(self, params):
    1.23 +        self.params = params
    1.24 +    # __init__()
    1.25 +
    1.26 +    def params_first(self, key, default=None):
    1.27 +        if default is None:
    1.28 +            return self.params[key][0]
    1.29 +        else:
    1.30 +            try:
    1.31 +                return self.params[key][0]
    1.32 +            except:
    1.33 +                return default
    1.34 +    # params_first()
    1.35 +
    1.36 +    def get_mimetype(self):
    1.37 +        return "application/octet-stream"
    1.38 +    # get_mimetype()
    1.39 +
    1.40 +    def start(self, outfile):
    1.41 +        pass
    1.42 +    # start()
    1.43 +
    1.44 +    def stop(self):
    1.45 +        pass
    1.46 +    # stop()
    1.47 +
    1.48 +    def get_legth (self):
    1.49 +        pass
    1.50 +    # get_leght ()
    1.51 +
    1.52 +    def get_progress (self):
    1.53 +        pass
    1.54 +    # get_progress ()
    1.55 +
    1.56 +    def __str__(self):
    1.57 +        return '%s: %s( params=%s ) - Status: %s%%' % \
    1.58 +               (self.__class__.__name__, self.tid,
    1.59 +                self.params, self.status)
    1.60 +    # __str__()
    1.61 +# Transcoder