gmyth-stream/server/0.3/lib/transcoder.py
author melunko
Tue Aug 21 16:02:24 2007 +0100 (2007-08-21)
branchtrunk
changeset 814 8a6b143057d7
parent 718 3fbcd3d9b2d1
permissions -rw-r--r--
[svn r820] Added gmyth_scheduler_add_exception() function to remove only one schedule when all occurrences options has been used.
     1 #!/usr/bin/env python
     2 
     3 __author__ = "Gustavo Sverzut Barbieri / Artur Duque de Souza"
     4 __author_email__ = "barbieri@gmail.com / artur.souza@indt.org.br"
     5 __license__ = "GPL"
     6 __version__ = "0.4"
     7 
     8 __all__ = ("Transcoder")
     9 
    10 class Transcoder(object):
    11     """Transcoder's Class: parent class to implement
    12     a plugin for transcoding data."""
    13     priority = 0   # negative values have higher priorities
    14     name = None # to be used in requests
    15     status = None
    16     log = None
    17     tid = -1
    18 
    19     def __init__(self, params):
    20         self.params = params
    21     # __init__()
    22 
    23     def params_first(self, key, default=None):
    24         if default is None:
    25             return self.params[key][0]
    26         else:
    27             try:
    28                 return self.params[key][0]
    29             except:
    30                 return default
    31     # params_first()
    32 
    33     def get_mimetype(self):
    34         return "application/octet-stream"
    35     # get_mimetype()
    36 
    37     def start(self, outfile):
    38         pass
    39     # start()
    40 
    41     def stop(self):
    42         pass
    43     # stop()
    44 
    45     def get_legth (self):
    46         pass
    47     # get_leght ()
    48 
    49     def get_progress (self):
    50         pass
    51     # get_progress ()
    52 
    53     def __str__(self):
    54         return '%s: %s( params=%s ) - Status: %s%%' % \
    55                (self.__class__.__name__, self.tid,
    56                 self.params, self.status)
    57     # __str__()
    58 # Transcoder