示例#1
0
def main():
    options, keys = parse_options()

    # set query host
    host = web.lstrips(options.server, "http://").strip("/")
    set_query_host(host)

    # load config
    config.load(options.config)

    update_keys(keys)
示例#2
0
def main():
    '''Command Line interface for search in the OL database and update the solr's search index.'''
    global options
    options = parse_options()
    if not config.runtime_config:
        config.load(options.config)
        config.load_config(options.config)

    if (options.daemon == True):
        start_daemon()
    else:
        scan_days()
示例#3
0
def main():
    '''Command Line interface for search in the OL database and update the solr's search index.'''
    global options
    options = parse_options()
    if not config.runtime_config:
        config.load(options.config)
        config.load_config(options.config)

    if (options.daemon == True):
        start_daemon()
    else:
        scan_days()
示例#4
0
def get_solr(index):
    global solr_host

    if not config.runtime_config:
        config.load('openlibrary.yml')

    if not solr_host:
        solr_host = {
            'works': config.runtime_config['plugin_worksearch']['solr'],
            'authors': config.runtime_config['plugin_worksearch']['author_solr'],
            'subjects': config.runtime_config['plugin_worksearch']['subject_solr'],
            'editions': config.runtime_config['plugin_worksearch']['edition_solr'],
        }
    return solr_host[index]
示例#5
0
def main():
    options, keys = parse_options()

    # set query host
    host = web.lstrips(options.server, "http://").strip("/")
    set_query_host(host)

    if options.monkeypatch:
        monkeypatch(options.config)

    # load config
    config.load(options.config)

    logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
    update_keys(keys, commit=not options.nocommit)
示例#6
0
def main():
    options, keys = parse_options()

    # set query host
    host = web.lstrips(options.server, "http://").strip("/")
    set_query_host(host)

    if options.monkeypatch:
        monkeypatch(options.config)

    # load config
    config.load(options.config)

    logging.basicConfig(level=logging.INFO,
                        format="%(asctime)s [%(levelname)s] %(message)s")
    update_keys(keys, commit=not options.nocommit)
示例#7
0
def get_solr(index):
    global solr_host

    if not config.runtime_config:
        config.load('openlibrary.yml')

    if not solr_host:
        solr_host = {
            'works': config.runtime_config['plugin_worksearch']['solr'],
            'authors':
            config.runtime_config['plugin_worksearch']['author_solr'],
            'subjects':
            config.runtime_config['plugin_worksearch']['subject_solr'],
            'editions':
            config.runtime_config['plugin_worksearch']['edition_solr'],
        }
    return solr_host[index]
示例#8
0
def load_config():
    if not config.runtime_config:
        config.load('openlibrary.yml')
示例#9
0
handle_author_merge = args.handle_author_merge
only_author_merge = args.only_author_merge
skip_author_merge = args.skip_author_merge

if only_author_merge:
    handle_author_merge = True

if handle_author_merge:
    from openlibrary.catalog.works.find_works import find_title_redirects, find_works, get_books, books_query, update_works

ol = OpenLibrary("http://" + args.server)
set_query_host(args.server)
done_login = False

config_file = args.config
config.load(config_file)

base = 'http://%s/openlibrary.org/log/' % config.runtime_config[
    'infobase_server']

skip_user = set(u.lower() for u in args.skip_user)
only_user = set(u.lower() for u in args.only_user)

if 'state_dir' not in config.runtime_config:
    print 'state_dir missing from ' + config_file
    sys.exit(0)

state_file = config.runtime_config['state_dir'] + '/' + args.state_file

if exists(state_file):
    offset = open(state_file).readline()[:-1]
示例#10
0
    from openlibrary.catalog.works.find_works import (
        find_title_redirects,
        find_works,
        get_books,
        books_query,
        update_works,
    )

(options, args) = parser.parse_args()

ol = OpenLibrary("http://" + options.server)
set_query_host(options.server)
done_login = False

config_file = options.config
config.load(config_file)

base = "http://%s/openlibrary.org/log/" % config.runtime_config["infobase_server"]

if "state_dir" not in config.runtime_config:
    print "state_dir missing from " + config_file
    sys.exit(0)

state_file = config.runtime_config["state_dir"] + "/" + options.state_file

if not exists(state_file):
    print "start point needed. do this:"
    print "mkdir state"
    print "echo 2010-06-01:0 > state/" + options.state_file
    sys.exit(0)
示例#11
0
def load_config(path):
    logger.info("loading config from %s", path)    
    print "***load_config", path
    config.load(path)
    config.load_config(path)
    return config.runtime_config
示例#12
0
def load_config(path):
    logger.info("loading config from %s", path)    
    print "***load_config", path
    config.load(path)
    config.load_config(path)
    return config.runtime_config
示例#13
0
def load_config():
    if not config.runtime_config:
        config.load('openlibrary.yml')