gmyth-stream/server/lib/transcoder.py
author melunko
Mon Mar 03 11:33:49 2008 +0000 (2008-03-03)
branchtrunk
changeset 935 067904b6921f
parent 832 daa61fffb811
permissions -rw-r--r--
[svn r944] Now add/cancel a schedule recording while livetv is running is finnaly working fine.
morphbr@718
     1
#!/usr/bin/env python
morphbr@718
     2
morphbr@718
     3
__author__ = "Gustavo Sverzut Barbieri / Artur Duque de Souza"
morphbr@718
     4
__author_email__ = "barbieri@gmail.com / artur.souza@indt.org.br"
morphbr@718
     5
__license__ = "GPL"
morphbr@718
     6
__version__ = "0.4"
morphbr@718
     7
morphbr@718
     8
__all__ = ("Transcoder")
morphbr@718
     9
morphbr@718
    10
class Transcoder(object):
morphbr@718
    11
    """Transcoder's Class: parent class to implement
morphbr@718
    12
    a plugin for transcoding data."""
morphbr@718
    13
    priority = 0   # negative values have higher priorities
morphbr@718
    14
    name = None # to be used in requests
morphbr@718
    15
    status = None
morphbr@718
    16
    log = None
morphbr@718
    17
    tid = -1
morphbr@718
    18
morphbr@718
    19
    def __init__(self, params):
morphbr@718
    20
        self.params = params
morphbr@718
    21
    # __init__()
morphbr@718
    22
morphbr@718
    23
    def params_first(self, key, default=None):
morphbr@718
    24
        if default is None:
morphbr@718
    25
            return self.params[key][0]
morphbr@718
    26
        else:
morphbr@718
    27
            try:
morphbr@718
    28
                return self.params[key][0]
morphbr@718
    29
            except:
morphbr@718
    30
                return default
morphbr@718
    31
    # params_first()
morphbr@718
    32
morphbr@718
    33
    def get_mimetype(self):
renatofilho@800
    34
        return "application/octet-stream"
morphbr@718
    35
    # get_mimetype()
morphbr@718
    36
morphbr@718
    37
    def start(self, outfile):
renatofilho@800
    38
        pass
morphbr@718
    39
    # start()
morphbr@718
    40
renatofilho@800
    41
    def stop(self):
renatofilho@800
    42
        pass
renatofilho@800
    43
    # stop()
morphbr@718
    44
morphbr@837
    45
    def get_length (self):
renatofilho@800
    46
        pass
renatofilho@800
    47
    # get_leght ()
renatofilho@800
    48
renatofilho@800
    49
    def get_progress (self):
renatofilho@800
    50
        pass
renatofilho@800
    51
    # get_progress ()
morphbr@718
    52
morphbr@718
    53
    def __str__(self):
morphbr@718
    54
        return '%s: %s( params=%s ) - Status: %s%%' % \
morphbr@718
    55
               (self.__class__.__name__, self.tid,
morphbr@718
    56
                self.params, self.status)
morphbr@718
    57
    # __str__()
morphbr@718
    58
# Transcoder