Ejemplo n.º 1
0
class TivoServerVideoDiscoveryTransform(Transform):
    SPEC = base.TransformSpec()
    SPEC.requires = [
        AssetPlaceholder(
            'TivoServer', {
                'id': base.TransformPlaceholder(),
                'mediaKey': base.TransformPlaceholder()
            })
    ]
    SPEC.produces = [
        AssetPlaceholder('TivoVideo', {'server': SPEC.requires[0].id})
    ]

    def __init__(self):
        Transform.__init__(self)

    def spec(self):
        return self.SPEC

    def newTask(self, env, input, output):
        if input is None:
            raise TaskLaunchError('inappropriate input arguments')
        tivo = input[0]
        return TivoServerVideoDiscovery(self, tivo, env)

    def isRunning(self, tasks, input, output):
        if input is None:
            raise TaskLaunchError('inappropriate input arguments')
        tivo = input[0]
        for task in tasks:
            if task.tivo == tivo:
                return True
        return False
Ejemplo n.º 2
0
class DownloadTivoVideo(Transform):
    SPEC = base.TransformSpec()
    SPEC.locks = [
        AssetPlaceholder(
            'TivoServer', {
                'id': base.TransformPlaceholder(),
                'mediaKey': base.TransformPlaceholder()
            })
    ]
    SPEC.requires = [
        AssetPlaceholder('TivoVideo', {'server': SPEC.locks[0].id})
    ]
    SPEC.produces = [
        AssetPlaceholder('TivoVideoDownload', {
            'mediaKey': SPEC.locks[0].mediaKey,
            '!isFile': 1,
            'fileExt': 'tivo'
        })
    ]

    def __init__(self):
        Transform.__init__(self)

    def spec(self):
        return self.SPEC

    def newTask(self, env, input, output):
        if input is None:
            raise TaskLaunchError('inappropriate input arguments')
        if output is None:
            raise TaskLaunchError('inappropriate output arguments')
        infile = input[0]
        outfile = output[0]
        mediaKey = infile.server.mediaKey
        #self.fetchFile(mediaKey, infile, outfile)
        tempAttr = dict(infile.details)
        if 'ContentType' in tempAttr:
            del tempAttr['ContentType']
        if 'SourceFormat' in tempAttr:
            del tempAttr['SourceFormat']
        if 'SourceSize' in tempAttr:
            del tempAttr['SourceSize']
        if 'ByteOffset' in tempAttr:
            del tempAttr['ByteOffset']
        for attr in tempAttr:
            outfile.details[attr] = tempAttr[attr]
        outfile.mediaKey = mediaKey

        query = TivoServerQuery(mediaKey)
        req = query.openSimplePath(
            query.crackUrl(infile.links['Content']['Url']))
        file = outfile.open('wb')
        return TivoDownloadTask(outfile, req, file, infile.server, env)
Ejemplo n.º 3
0
class TivoServerListenerTransform(Transform):
    SPEC = base.TransformSpec()
    SPEC.produces = [
        AssetPlaceholder(
            'TivoServer', {
                'id': base.TransformPlaceholder(),
                'mediaKey': base.TransformPlaceholder()
            })
    ]

    def __init__(self):
        Transform.__init__(self)

    def spec(self):
        return self.SPEC

    def newTask(self, env, input, output):
        return TivoServerListenerTask(self, env)

    def isRunning(self, tasks, input, output):
        for task in tasks:
            return True
        return False
Ejemplo n.º 4
0
class DecryptTivoVideoDSD(base.ToolchainTransform):
    SPEC = base.TransformSpec()
    SPEC.requires = [
        AssetPlaceholder(
            'TivoVideoDownload', {
                'mediaKey': base.TransformPlaceholder(),
                '!isFile': 1,
                'fileExt': 'tivo'
            })
    ]
    SPEC.produces = [
        AssetPlaceholder('MpegVideo', {
            '!isFile': 1,
            'fileExt': 'mpg'
        })
    ]
    TOOL = base.Tool({
        'name': 'DirectShow Dump',
        'cmd': 'DSDCmd',
        'path': 'c:\program files\DirectShow Dump',
        'url': 'http://prish.com/etivo/tbr.htm'
    })

    def spec(self):
        return self.SPEC

    def newTask(self, env, input, output):
        if input is not None:
            raise TaskLaunchError('inappropriate input arguments')
        if output is not None:
            raise TaskLaunchError('inappropriate output arguments')
        infile = input[0]
        outfile = output[0]
        self.callTool(self.toolPath + ' -s "%s" -t "%s"' %
                      (infile.filePath, outfile.filePath))
        tempAttr = dict(infile.details)
        if 'Duration' in tempAttr:
            del tempAttr['Duration']
        for attr in tempAttr:
            outfile.meta[attr] = tempAttr[attr]
Ejemplo n.º 5
0
class DecryptTivoVideoTD(base.ToolchainTransform):
    SPEC = base.TransformSpec()
    SPEC.requires = [
        AssetPlaceholder(
            'TivoVideoDownload', {
                'mediaKey': base.TransformPlaceholder(),
                '!isFile': 1,
                'fileExt': 'tivo'
            })
    ]
    SPEC.produces = [
        AssetPlaceholder('MpegVideo', {
            '!isFile': 1,
            'fileExt': 'mpg'
        })
    ]
    TOOL = base.Tool({
        'name': 'tivodecode',
        'cmd': 'tivodecode',
        'url': 'http://tivodecode.sourceforge.net'
    })

    def spec(self):
        return self.SPEC

    def newTask(self, env, input, output):
        if input is not None:
            raise TaskLaunchError('inappropriate input arguments')
        if output is not None:
            raise TaskLaunchError('inappropriate output arguments')
        infile = input[0]
        outfile = output[0]
        self.callTool(self.toolPath + ' --mak "%s" --out "%s" "%s"' %
                      (infile.mediaKey, outfile.filePath, infile.filePath))
        tempAttr = dict(infile.details)
        if 'Duration' in tempAttr:
            del tempAttr['Duration']
        for attr in tempAttr:
            outfile.meta[attr] = tempAttr[attr]