32 lines
676 B
Python
32 lines
676 B
Python
|
|
import logging
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
from quote_service import QuoteService
|
||
|
|
from quote_db import QuoteDatabase
|
||
|
|
from quote_contracts import IngestAllRequest
|
||
|
|
|
||
|
|
logging.basicConfig(level=logging.INFO)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
if len(sys.argv) > 1:
|
||
|
|
|
||
|
|
folder_path = Path(sys.argv[1])
|
||
|
|
else:
|
||
|
|
folder_path = Path("./archives")
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if not folder_path.exists() or not folder_path.is_dir():
|
||
|
|
logging.error(f"Sorry, folder {folder_path} does not exist or not a directory.")
|
||
|
|
|
||
|
|
db = QuoteDatabase("quotes.db")
|
||
|
|
service = QuoteService(db)
|
||
|
|
|
||
|
|
|
||
|
|
service.ingest_archives_from_folder(folder_path)
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|