예제 #1
0
 def fetchListings():
     fetchXTVD.fetchXTVDtoFile(fetchXTVDConfig.schedulesDirectUsername,
                               fetchXTVDConfig.schedulesDirectPassword,
                               fetchXTVDConfig.listingsFile)
     dbInterface = parseXTVD.carbonDVRDatabase(dbConnection,
                                               carbonDVRConfig.schema)
     parseXTVD.parseXTVD(fetchXTVDConfig.listingsFile, dbInterface)
예제 #2
0
def importIntoPostgresql(xtvdFile):
    dbConnectString = os.environ.get('DB_CONNECT_STRING')
    if dbConnectString is None:
        print('DB_CONNECT_STRING environment variable is not set')
        sys.exit(1)
    logger.info('DB_CONNECT_STRING=%s', dbConnectString)
    dbConnection = psycopg2.connect(dbConnectString)

    schema = os.environ.get('DB_SCHEMA')
    if schema is not None:
        logger.info('DB_SCHEMA=%s', schema)
        with dbConnection.cursor() as cursor:
            cursor.execute("SET SCHEMA %s", (schema, ))

    dbInterface = parseXTVD.carbonDVRDatabase(dbConnection, schema)

    parseXTVD.parseXTVD(xtvdFile, dbInterface)
예제 #3
0
 def fetchListings():
     fetchXTVD.fetchXTVDtoFile(fetchXTVDConfig.schedulesDirectUsername, fetchXTVDConfig.schedulesDirectPassword, fetchXTVDConfig.listingsFile)
     dbInterface = parseXTVD.carbonDVRDatabase(dbConnection, carbonDVRConfig.schema)
     parseXTVD.parseXTVD(fetchXTVDConfig.listingsFile, dbInterface)
예제 #4
0
import parseXTVD
import psycopg2
import sys

if __name__ == '__main__':
    FORMAT = "%(asctime)-15s: %(name)s:  %(message)s"
    logging.basicConfig(level=logging.INFO, format=FORMAT)
    logger = logging.getLogger(__name__)

    dbConnectString = os.environ.get('DB_CONNECT_STRING')
    if dbConnectString is None:
        print('DB_CONNECT_STRING environment variable is not set')
        sys.exit(1)
    logger.info('DB_CONNECT_STRING=%s', dbConnectString)
    dbConnection = psycopg2.connect(dbConnectString)

    schema = os.environ.get('DB_SCHEMA')
    if schema is not None:
        logger.info('DB_SCHEMA=%s', schema)
        with dbConnection.cursor() as cursor:
            cursor.execute("SET SCHEMA %s", (schema, ))

    dbInterface = parseXTVD.carbonDVRDatabase(dbConnection, schema)

    parser = argparse.ArgumentParser(description='Parse listings in XTVD format.')
    parser.add_argument('-f', '--file', default='ddata.xml')
    args = parser.parse_args()

    parseXTVD.parseXTVD(args.file, dbInterface)