-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbta.py
34 lines (25 loc) · 905 Bytes
/
bta.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
from lib.BookToAnki import BookToAnki
import sys
def run(listArgs):
if len(listArgs) < 3:
print('usage: python kindle_to_anki.py [BOOK_FILE_PATH] [ANKI_DECK_NAME] [OPTIONAL DELIMITER]')
return
bTa = BookToAnki()
strBookFilePath = listArgs[1]
strAnkiDeckName = listArgs[2]
if len(listArgs) == 4:
strDelim = listArgs[3]
try:
bTa.makeDeck(strBookFilePath,strAnkiDeckName,strDelim)
except Exception as e:
print('error:\n{}'.format(e))
return
try:
bTa.makeDeck(strBookFilePath,strAnkiDeckName)
except Exception as e:
print('error:\n{}'.format(e))
return
if __name__ == "__main__":
run(sys.argv)
print('\nThank you for using this program!\nIf you would like to contribute, find the repo at:\n{}\n'.format('https://github.com/lxaw/kindle-to-anki-deck'))