Skip to content

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vardecab committed Mar 17, 2021
1 parent 88cd819 commit ec433a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
### Windows

1. Connect your Kindle via USB cable to your computer.
2. Download `script.exe` from [Releases](https://github.com/vardecab/kindle-words/releases).
3. Run it.
2. Download `script.zip` from [Releases](https://github.com/vardecab/kindle-words/releases).
3. Run `script.exe`.
4. Write source & target languages or wait if defaults (`en` & `pl`) are ok.
5. Write drive letter associated with Kindle or wait if default (`D`) is ok.
6. Wait a few minutes - words are being translated.
7. Go to `output/kindle-words_export.txt` to check exported file.
7. Go to `script\output\kindle-words_export.txt` to check exported file.
8. (optional) Add it to [Quizlet](https://quizlet.com/).
9. Voilà ✨

Expand All @@ -31,6 +31,7 @@

## Release History

- 1.1.2: Added `try/except` to fix a `FileNotFoundError` error.
- 1.1.1: Fixed `io.open` bug; added some `try/except` to catch more errors; re-enabled `timeout_time`; added `last_word` export so it's easy to see which words are new and which are old. Published in [Releases](https://github.com/vardecab/kindle-words/releases).
- 1.1: Quite a big re-write: it now works properly with `My Clippings.txt` file from Kindle - all bugs are fixed. Initial run takes ~ 10 minutes to complete (depending on the size of your file) but afterwards it's usually < 1 minute because data from previous run is stored locally for comparison - only new words are being translated to save time and improve speed.
- 1.0.0: Using new API - [deep-translator](https://github.com/nidhaloff/deep-translator).
Expand Down
14 changes: 8 additions & 6 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@
os.makedirs('data')

### show the last word that was added on the previous run
with open('output/output-original_words.txt', 'r') as file:
lines = file.read().splitlines()
last_word = lines[-1]
# print(last_word) # debug
with open('output/last_word.txt', 'w') as file:
file.write(last_word)
try:
with open('output/output-original_words.txt', 'r') as file:
lines = file.read().splitlines()
last_word = lines[-1]
with open('output/last_word.txt', 'w') as file:
file.write(last_word)
except FileNotFoundError:
print('First run - no file to load data.')

### list cleanup
read_source_file = [x for x in read_source_file if not any(x1.isdigit() for x1 in x)] # remove numbers
Expand Down

0 comments on commit ec433a0

Please sign in to comment.