Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| This script initializes the abjad.db database with Quran verses. | |
| Run this script once before using the Daily Sura feature. | |
| """ | |
| import logging | |
| import argparse | |
| import os | |
| from quran import initialize_quran_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 Quran database.') | |
| parser.add_argument('--db-file', default='abjad.db', | |
| help='SQLite database file path (default: abjad.db)') | |
| parser.add_argument('--max-phrase-length', type=int, default=1, | |
| help='Maximum phrase length to process (default: 1)') | |
| args = parser.parse_args() | |
| logger.info(f"Starting Quran database initialization with max phrase length: {args.max_phrase_length}") | |
| initialize_quran_database(args.db_file, args.max_phrase_length) | |
| logger.info(f"Database initialization completed: {args.db_file}") | |
| if __name__ == "__main__": | |
| main() | |