(info, chan_file)
Generate the channels.conf file
Generate the channels.conf file
Generate the channels . conf file
def _cfg_chan_conf(info, chan_file):
    """Generate the channels.conf file"""

    util.print_header("Channel Configuration")

    print(
        textwrap.fill("This step will generate the channel configuration "
                      "file that is required when launching the USB "
                      "receiver in Linux.") + "\n")

    if (os.path.isfile(chan_file)):
        print("Found previous %s file:" % (chan_file))

        if (not util.ask_yes_or_no("Remove and regenerate file?")):
            print("Configuration aborted.")
            return
        else:
            os.remove(chan_file)

    with open(chan_file, 'w') as f:
        f.write('[blocksat-ch]\n')
        f.write('\tDELIVERY_SYSTEM = DVBS2\n')
        f.write('\tFREQUENCY = %u\n' % (int(info['sat']['dl_freq'] * 1000)))
        if (info['lnb']['pol'].lower() == "dual"
                and 'v1_pointed' in info['lnb'] and info['lnb']['v1_pointed']):
            # If a dual-polarization LNB is already pointed for Blocksat v1,
            # then we must use the polarization that the LNB was pointed to
            # originally, regardless of the satellite signal's polarization. In
            # v1, what mattered the most was the power supply voltage, which
            # determined the polarization of the dual polarization LNBs. If the
            # power supply provides voltage >= 18 (often the case), then the
            # LNB necessarily operates currently with horizontal polarization.
            # Thus, on channels.conf we must use the same polarization in order
            # for the DVB adapter to supply the 18VDC voltage.
            if (info['lnb']["v1_psu_voltage"] >= 16):  # 16VDC threshold
                f.write('\tPOLARIZATION = HORIZONTAL\n')
            else:
                f.write('\tPOLARIZATION = VERTICAL\n')
        else:
            if (info['sat']['pol'] == 'V'):
                f.write('\tPOLARIZATION = VERTICAL\n')
            else:
                f.write('\tPOLARIZATION = HORIZONTAL\n')
        f.write('\tSYMBOL_RATE = {}\n'.format(
            defs.sym_rate[info['sat']['alias']]))
        f.write('\tINVERSION = AUTO\n')
        f.write('\tMODULATION = QPSK\n')
        pids = "+".join([str(x) for x in defs.pids])
        f.write('\tVIDEO_PID = {}\n'.format(pids))

    print("File \"%s\" saved." % (chan_file))

    with open(chan_file, 'r') as f:
        logging.debug(f.read())
def _cfg_chan_conf ( info , chan_file ) : util . print_header ( "Channel Configuration" ) print ( textwrap . fill ( "This step will generate the channel configuration " "file that is required when launching the USB " "receiver in Linux." ) + "\n" ) if ( os . path . isfile ( chan_file ) ) : print ( "Found previous %s file:" % ( chan_file ) ) if ( not util . ask_yes_or_no ( "Remove and regenerate file?" ) ) : print ( "Configuration aborted." ) return else : os . remove ( chan_file ) with open ( chan_file , 'w' ) as f : f . write ( '[blocksat-ch]\n' ) f . write ( '\tDELIVERY_SYSTEM = DVBS2\n' ) f . write ( '\tFREQUENCY = %u\n' % ( int ( info [ 'sat' ] [ 'dl_freq' ] * 1000 ) ) ) if ( info [ 'lnb' ] [ 'pol' ] . lower ( ) == "dual" and 'v1_pointed' in info [ 'lnb' ] and info [ 'lnb' ] [ 'v1_pointed' ] ) : # If a dual-polarization LNB is already pointed for Blocksat v1, # then we must use the polarization that the LNB was pointed to # originally, regardless of the satellite signal's polarization. In # v1, what mattered the most was the power supply voltage, which # determined the polarization of the dual polarization LNBs. If the # power supply provides voltage >= 18 (often the case), then the # LNB necessarily operates currently with horizontal polarization. # Thus, on channels.conf we must use the same polarization in order # for the DVB adapter to supply the 18VDC voltage. if ( info [ 'lnb' ] [ "v1_psu_voltage" ] >= 16 ) : # 16VDC threshold f . write ( '\tPOLARIZATION = HORIZONTAL\n' ) else : f . write ( '\tPOLARIZATION = VERTICAL\n' ) else : if ( info [ 'sat' ] [ 'pol' ] == 'V' ) : f . write ( '\tPOLARIZATION = VERTICAL\n' ) else : f . write ( '\tPOLARIZATION = HORIZONTAL\n' ) f . write ( '\tSYMBOL_RATE = {}\n' . format ( defs . sym_rate [ info [ 'sat' ] [ 'alias' ] ] ) ) f . write ( '\tINVERSION = AUTO\n' ) f . write ( '\tMODULATION = QPSK\n' ) pids = "+" . join ( [ str ( x ) for x in defs . pids ] ) f . write ( '\tVIDEO_PID = {}\n' . format ( pids ) ) print ( "File \"%s\" saved." % ( chan_file ) ) with open ( chan_file , 'r' ) as f : logging . debug ( f . read ( ) )