(args)
Launch the DVB interface from scratch

    Handles the launch subcommand
Launch the DVB interface from scratch
Launch the DVB interface from scratch
def launch(args):
    """Launch the DVB interface from scratch

    Handles the launch subcommand

    """

    common_params = _common(args)
    if (common_params is None):
        return
    user_info, adapter, frontend = common_params

    # Check if all dependencies are installed
    if (not dependencies.check_apps(["dvbv5-zap"])):
        return

    # Check conflicting logging options
    if ((args.monitor or args.record_file)
            and (args.log_scrolling or args.log_file)):
        raise ValueError("Logging options are disabled when running with "
                         "-m/--monitor or -r/--record-file")

    # Log Monitoring
    monitor = monitoring.Monitor(args.cfg_dir,
                                 logfile=args.log_file,
                                 scroll=args.log_scrolling,
                                 min_interval=args.log_interval,
                                 server=args.monitoring_server,
                                 port=args.monitoring_port,
                                 report=args.report,
                                 report_opts=monitoring.get_report_opts(args),
                                 utc=args.utc)

    # Channel configuration file
    chan_conf = user_info['setup']['channel']

    # Zap
    zap_ps = zap(adapter,
                 frontend,
                 chan_conf,
                 user_info,
                 lnb=args.lnb,
                 output=args.record_file,
                 timeout=args.timeout,
                 monitor=args.monitor)

    # Handler for SIGINT
    def signal_handler(sig, frame):
        print('Stopping...')
        zap_ps.terminate()
        sys.exit(zap_ps.poll())

    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)

    util.print_header("Receiver Monitoring")
    print()

    # Listen to dvbv5-zap indefinitely
    if (args.monitor or args.record_file):
        zap_ps.wait()
    else:
        while (zap_ps.poll() is None):
            line = zap_ps.stderr.readline()
            metrics = _parse_log(line)
            if (metrics is None):
                continue
            monitor.update(metrics)
    print()
    sys.exit(zap_ps.poll())
def launch ( args ) : common_params = _common ( args ) if ( common_params is None ) : return user_info , adapter , frontend = common_params # Check if all dependencies are installed if ( not dependencies . check_apps ( [ "dvbv5-zap" ] ) ) : return # Check conflicting logging options if ( ( args . monitor or args . record_file ) and ( args . log_scrolling or args . log_file ) ) : raise ValueError ( "Logging options are disabled when running with " "-m/--monitor or -r/--record-file" ) # Log Monitoring monitor = monitoring . Monitor ( args . cfg_dir , logfile = args . log_file , scroll = args . log_scrolling , min_interval = args . log_interval , server = args . monitoring_server , port = args . monitoring_port , report = args . report , report_opts = monitoring . get_report_opts ( args ) , utc = args . utc ) # Channel configuration file chan_conf = user_info [ 'setup' ] [ 'channel' ] # Zap zap_ps = zap ( adapter , frontend , chan_conf , user_info , lnb = args . lnb , output = args . record_file , timeout = args . timeout , monitor = args . monitor ) # Handler for SIGINT def signal_handler ( sig , frame ) : print ( 'Stopping...' ) zap_ps . terminate ( ) sys . exit ( zap_ps . poll ( ) ) signal . signal ( signal . SIGINT , signal_handler ) signal . signal ( signal . SIGTERM , signal_handler ) util . print_header ( "Receiver Monitoring" ) print ( ) # Listen to dvbv5-zap indefinitely if ( args . monitor or args . record_file ) : zap_ps . wait ( ) else : while ( zap_ps . poll ( ) is None ) : line = zap_ps . stderr . readline ( ) metrics = _parse_log ( line ) if ( metrics is None ) : continue monitor . update ( metrics ) print ( ) sys . exit ( zap_ps . poll ( ) )