diff options
author | luxagraf <sng@luxagraf.net> | 2015-10-01 22:10:21 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2015-10-01 22:10:21 -0400 |
commit | e0de7a6c08bbbd31fae2e7b796457a982cb3e895 (patch) | |
tree | 998de97c36aef12098f5545d3dcfd690e600b23b /app/books/kindleparser.py | |
parent | 93ac5f4acb8d1249461425c97d46bbf69915112d (diff) |
did a lot of work on the books section
Diffstat (limited to 'app/books/kindleparser.py')
-rw-r--r-- | app/books/kindleparser.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/books/kindleparser.py b/app/books/kindleparser.py index aaa742f..44a4686 100644 --- a/app/books/kindleparser.py +++ b/app/books/kindleparser.py @@ -22,11 +22,11 @@ def parse_kindle_clippings(path): except KeyError: body_markdown = "" try: - location = int(clip['locationRange']) + location = clip['locationRange'] except: location = 0 try: - page = int(clip['pageRange']) + page = int(clip['pageRange'][0]) except: page = 0 try: @@ -44,13 +44,21 @@ def parse_kindle_clippings(path): ) try: #see if we already this highlight - row = BookHighlight.objects.get( + bh = BookHighlight.objects.get( book__title=clip['title'], date_added=clip_date ) + #print(bh.book.title) + print(location) + #bh.location = location + #bh.page = page + #bh.save() #if we don't create a new book highlight except ObjectDoesNotExist: book = Book.objects.get(title=clip['title']) + print(book.title) + print(page) + print(location) bh, created = BookHighlight.objects.get_or_create( book=book, page=page, |