Spaces:
Running
Running
#!/usr/bin/env python3 | |
""" | |
This script initializes the bible.db database with Bible verses. | |
Run this script once before using the Daily Bible feature. | |
""" | |
import logging | |
import argparse | |
import os | |
from bible import initialize_bible_database | |
from tqdm import tqdm | |
# Set up logging | |
logging.basicConfig(level=logging.INFO, | |
format='%(asctime)s - %(levelname)s - %(message)s') | |
logger = logging.getLogger(__name__) | |
def main(): | |
parser = argparse.ArgumentParser(description='Initialize the Bible database.') | |
parser.add_argument('--db-file', default='bible.db', | |
help='SQLite database file path (default: bible.db)') | |
parser.add_argument('--max-phrase-length', type=int, default=1, | |
help='Maximum phrase length to process (default: 1)') | |
args = parser.parse_args() | |
if not os.path.exists(os.path.dirname(args.db_file)) and os.path.dirname(args.db_file): | |
os.makedirs(os.path.dirname(args.db_file)) | |
initialize_bible_database(args.db_file, args.max_phrase_length) | |
logger.info(f"Bible database initialization complete: {args.db_file}") | |
if __name__ == "__main__": | |
main() | |