from word import Kindle, Text, Input, Subs from config import sources, auth from service import Lingualeo import sys import traceback email = auth.get('email') password = auth.get('password') try: export_type = sys.argv[1] if export_type == 'text': if len(sys.argv) == 3: source = sys.argv[2] else: source = sources.get('text') handler = Text(source) elif export_type == 'kindle': handler = Kindle(sources.get('kindle')) elif export_type == 'input': handler = Input(sys.argv[2:]) elif export_type == 'subs': handler = Subs(sys.argv[2:]) else: raise Exception('unsupported type') handler.read() lingualeo = Lingualeo(email, password) lingualeo.auth() exist = 0
#!/usr/bin/env python # -*- coding: utf-8 -*- from config import sources import sqlite3 database = sources.get('kindle') conn = sqlite3.connect(database) with conn: conn.execute("DELETE FROM WORDS;") conn.execute("DELETE FROM LOOKUPS;") conn.execute("UPDATE METADATA SET sscnt = 0 WHERE id in ('WORDS', 'LOOKUPS');") conn.commit() print("Database cleared")