示例#1
0
def main():
    args = parser.parse_args()
    create_loggers()
    log.info('This is the EBU-TT-D encoder')

    manifest_path = args.manifest_path

    websocket_url = args.websocket_url
    websocket_channel = args.websocket_channel

    fs_reader = None

    if manifest_path:
        do_tail = args.do_tail
        consumer_impl = FilesystemConsumerImpl()
        fs_reader = FilesystemReader(manifest_path, consumer_impl, do_tail)
    else:
        consumer_impl = TwistedConsumerImpl()

    if args.output_format == 'xml':
        outbound_carriage = SimpleFolderExport(args.output_folder,
                                               'ebuttd-encode-{}.xml')
    else:
        raise Exception('Invalid output format: {}'.format(args.output_format))

    reference_clock = LocalMachineClock()
    reference_clock.clock_mode = 'local'

    media_time_zero = \
        args.media_time_zero == 'current' and reference_clock.get_time() \
        or bindings.ebuttdt.LimitedClockTimingType(str(args.media_time_zero)).timedelta

    ebuttd_converter = EBUTTDEncoder(node_id='simple-consumer',
                                     carriage_impl=consumer_impl,
                                     outbound_carriage_impl=outbound_carriage,
                                     reference_clock=reference_clock,
                                     segment_length=args.interval,
                                     media_time_zero=media_time_zero,
                                     segment_timer=start_timer,
                                     discard=args.discard)

    if manifest_path:
        fs_reader.resume_reading()
        # TODO: Do segmentation in filesystem mode. Especially bad is the tail usecase #209
    else:
        factory_args = {}
        if args.proxy:
            proxyHost, proxyPort = args.proxy.split(':')
            factory_args['proxy'] = {'host': proxyHost, 'port': int(proxyPort)}
        factory = BroadcastClientFactory(
            url=websocket_url,
            channels=[websocket_channel],
            consumer=TwistedConsumer(custom_consumer=consumer_impl),
            **factory_args)
        factory.protocol = ClientNodeProtocol

        factory.connect()

        reactor.run()
def main():
    args = parser.parse_args()
    create_loggers()
    log.info('This is the EBU-TT-D encoder')

    manifest_path = args.manifest_path

    websocket_url = args.websocket_url
    websocket_channel = args.websocket_channel

    fs_reader = None

    if manifest_path:
        do_tail = args.do_tail
        consumer_impl = FilesystemConsumerImpl()
        fs_reader = FilesystemReader(manifest_path, consumer_impl, do_tail)
    else:
        consumer_impl = TwistedConsumerImpl()

    if args.output_format == 'xml':
        outbound_carriage = SimpleFolderExport(args.output_folder, 'ebuttd-encode-{}.xml')
    else:
        raise Exception('Invalid output format: {}'.format(args.output_format))

    reference_clock = LocalMachineClock()
    reference_clock.clock_mode = 'local'

    media_time_zero = \
        args.media_time_zero == 'current' and reference_clock.get_time() \
        or bindings.ebuttdt.LimitedClockTimingType(str(args.media_time_zero)).timedelta

    ebuttd_converter = EBUTTDEncoder(
        node_id='simple-consumer',
        carriage_impl=consumer_impl,
        outbound_carriage_impl=outbound_carriage,
        reference_clock=reference_clock,
        segment_length=args.interval,
        media_time_zero=media_time_zero,
        segment_timer=start_timer,
        discard=args.discard
    )

    if manifest_path:
        fs_reader.resume_reading()
        # TODO: Do segmentation in filesystem mode. Especially bad is the tail usecase #209
    else:
        factory_args = {}
        if args.proxy:
            proxyHost, proxyPort = args.proxy.split(':')
            factory_args['proxy'] = {'host': proxyHost, 'port': int(proxyPort)}
        factory = BroadcastClientFactory(
            url=websocket_url,
            channels=[websocket_channel],
            consumer=TwistedConsumer(
                custom_consumer=consumer_impl
            ),
            **factory_args
        )
        factory.protocol = ClientNodeProtocol

        factory.connect()

        reactor.run()
示例#3
0
 def test_instantiation(self):
     clock = LocalMachineClock()
     self.assertIsInstance(clock.get_time(), timedelta)