def main(file_paths):

    # unpack file paths:
    videos_table_file_path = file_paths['videos_table']
    manually_added_data_table_file_path = file_paths[
        'manually_added_data_table']
    videos_query = file_paths['populate_videos']
    manually_added_data_table_query = file_paths[
        'populate_manually_added_data']

    # Step 1, initialize script:
    tools.InitializeScript(os.path.basename(__file__), **tools.kwargs)

    # Step 2, read tables:
    videos_table = tools.ReadDataFromFile(videos_table_file_path)
    manually_added_data_table = tools.ReadDataFromFile(
        manually_added_data_table_file_path)

    # Step 3, prep tables for entry:
    videos_table = funcs.PrepVideosTable(videos_table)
    manually_added_data_table = funcs.PrepManuallyAddedDataTable(
        manually_added_data_table)

    # Step 4, populate postgres:
    funcs.PopulateVideosTable(videos_table, videos_query)
    funcs.PopulateManuallyAddedDataTable(manually_added_data_table,
                                         manually_added_data_table_query)
Пример #2
0
def main(file_paths):

    # Unpack files:
    reports_table = file_paths['reports_table']
    descriptors_file = file_paths['descriptors']
    export_file = file_paths['reports_table_export']
    populate_query = file_paths['populate_query']

    # Step 1, initialize script:
    tools.InitializeScript(os.path.basename(__file__))

    # Step 2, read reports files:
    reports = tools.ReadDataFromFile(reports_table)

    # Step 3, parse reports:
    reports = funcs.ParseReports(reports)

    # Step 4, read descriptors:
    descriptors = funcs.ReadDescriptors(descriptors_file)

    # Step 5, get dictionary of normal descriptors:
    normal_features = funcs.GetDictionaryOfNormalDescriptors(descriptors)

    # Step 6, build reports table:
    reports_table = funcs.BuildReportTable(normal_features, reports,
                                           descriptors)

    # Step 7, write reports table to database:
    tools.ExportDataToFile(reports_table, export_file)
    funcs.ExportReportsTable(reports_table, populate_query)

    return reports, descriptors, reports_table
Пример #3
0
def main(file_paths):

    # unpack file paths:
    videos_table_file_path = file_paths['videos_table']
    manually_added_data_table_file_path = file_paths[
        'manually_added_data_table']

    # Step 1, initialize script:
    tools.InitializeScript(os.path.basename(__file__), **tools.kwargs)

    # Step 2, read vidoes table:
    videos_table = tools.ReadDataFromFile(videos_table_file_path)

    # Step 3, create manually added data table:
    manually_added_data_table = funcs.BuildManuallyAddedDataTable(videos_table)

    # Step 4, build webms:
    funcs.BuildWebmFiles(manually_added_data_table)

    # Step 5, export data:
    tools.ExportDataToFile(manually_added_data_table,
                           manually_added_data_table_file_path)