예제 #1
0
def main(crinacle=False, oratory1990=False, rtings=False):
    classes = []
    if crinacle or (not oratory1990 and not rtings):
        classes.append(CrinacleCrawler)
    if oratory1990 or (not crinacle and not rtings):
        classes.append(Oratory1990Crawler)
    if rtings or (not oratory1990 and not crinacle):
        classes.append(RtingsCrawler)

    if Oratory1990Crawler in classes:
        opts = Options()
        opts.add_argument('--headless')
        driver = webdriver.Chrome(options=opts)
    else:
        driver = None

    for cls in classes:
        print(f'Running {cls.__name__}')
        crawler = cls(driver=driver)
        crawler.process_new(prompt=True)
        crawler.write_name_index()

    for dir_path in glob(os.path.join(DIR_PATH, '*', 'data', '*')):
        average_measurements(input_dir=dir_path, output_dir=dir_path)

    if driver is not None:
        driver.close()
예제 #2
0
def main(crinacle=False,
         oratory1990=False,
         rtings=False,
         referenceaudioanalyzer=False,
         prompt=False):
    classes = []
    if not (crinacle | oratory1990 | rtings | referenceaudioanalyzer):
        # None means all
        crinacle = True
        oratory1990 = True
        rtings = True
        referenceaudioanalyzer = True

    if crinacle:
        classes.append(CrinacleCrawler)
    if oratory1990:
        classes.append(Oratory1990Crawler)
    if rtings:
        classes.append(RtingsCrawler)
    if referenceaudioanalyzer:
        classes.append(ReferenceAudioAnalyzerCrawler)

    if Oratory1990Crawler in classes or ReferenceAudioAnalyzerCrawler in classes:
        # oratory1990 and Reference Audio Analyzer crawlers require Selenium Web Driver
        opts = Options()
        opts.add_argument('--headless')
        driver = webdriver.Chrome(options=opts)
    else:
        driver = None

    for cls in classes:
        print(f'Running {cls.__name__}')
        crawler = cls(driver=driver)
        crawler.process_new(prompt=prompt)
        crawler.write_name_index()

    for dir_path in glob(os.path.join(DIR_PATH, '*', 'data', '*')):
        average_measurements(input_dir=dir_path, output_dir=dir_path)

    if driver is not None:
        driver.close()