|
|
#46 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1050426
Join Date: Feb 2010
Location: California
Device: iPad Mini w/Retina, Kindle 3, Kindle Fire HDX 8.9, & Asus Transformer
|
Thanks that did the trick. Do you know why the different variations?
|
|
|
|
|
|
#47 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1050426
Join Date: Feb 2010
Location: California
Device: iPad Mini w/Retina, Kindle 3, Kindle Fire HDX 8.9, & Asus Transformer
|
I did notice that some that are showing the below example have a date in the column as if read:
In a magical world at war, passion abounds as four people are stripped to their souls, but will love or lust conquer all? 10/21/2010 Last Page Read: Location 35 (0%) Is there any way to show this as reading? |
|
|
|
| Advert | |
|
|
|
|
#48 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
It is possible, but I have reached my limit. I don't have a kindle, so have no real reason to be doing this stuff. Perhaps a kindle owner will come along and take on the question.
Good luck... |
|
|
|
|
|
#49 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1050426
Join Date: Feb 2010
Location: California
Device: iPad Mini w/Retina, Kindle 3, Kindle Fire HDX 8.9, & Asus Transformer
|
Thank you so much. I really appreciate it.
|
|
|
|
|
|
#50 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
|
|
|
|
| Advert | |
|
|
|
|
#51 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Date = Last opened
Quote:
You should think of the date as the time the book was last opened. You can open a book without turning any pages, and thereby changing % read. Show as reading ? You mean the user column using the python template ? Try changing the line Code:
elif f > 0: Code:
elif f >= 0: |
|
|
|
|
|
|
#52 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1050426
Join Date: Feb 2010
Location: California
Device: iPad Mini w/Retina, Kindle 3, Kindle Fire HDX 8.9, & Asus Transformer
|
Quote:
{comments:'contains($, 'Last Page Read:', re($, '(?is).*(\d\d[-/]\d\d[-/]\d\d\d\d).*?Last Page Read:.*', '\1'), 'Not Read')'} But I was wondering is there anyway if a book has been partially read to say reading, instead of the date. Last edited by beckywc; 01-19-2011 at 10:47 AM. |
|
|
|
|
|
|
#53 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Quote:
Havent had enough time to look at this. Want to, cause this is fun. A bit hard to learn, but ... SO - you don't want the last opened date ? OR you want another custom column showing "read" status ? Please explain further. Please understand English is not my native language. So please be precise. Also, how many books do you have in your Calibre library ? I have 900, and some of these customn columns using "just" templates, slows Calibre startup from 1-2 second to 1-2 minuttes. That's why I asked chaley, brilliant work, to help with the python Template functions. Anyways. A quick, (slow with many books, not nice) fix for a new column could be: Code:
{comments:'contains($, 'Last Page Read:', re($, '(?is).*\s(\d+[-/]\d+[-/]\d\d\d\d).*?Last Page Read:.*', 'Reading'), 'Not Read')'}
Please let me know what you're looking for. Edit: Simpler template than above, could be faster. Code:
{comments:'contains($,'Last Page Read: ', 'Read', 'Not Read')'}
Last edited by pchrist7; 01-20-2011 at 10:39 AM. Reason: spelling, new code |
|
|
|
|
|
|
#54 |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1050426
Join Date: Feb 2010
Location: California
Device: iPad Mini w/Retina, Kindle 3, Kindle Fire HDX 8.9, & Asus Transformer
|
What I want the custom column to show is the date read if > 95%. If the book shows >0% but < 95% I want the colunn to show reading and if the book is 0% or unopened not read.
So I probably do need a program code, I just don't know how to do it. Trying to read and figure out how to program in python and I feel utterly lost. Thanks so much for your time. |
|
|
|
|
|
#55 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Ahh - now I understand
Quote:
Got it. wonder if it can be done. Will give it a try or two during the weekend. |
|
|
|
|
|
|
#56 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Try playing with some variant of this Code:
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct, is_read_str,
is_reading_str, no_page_read_str):
try:
test_val = int(is_read_pct)
except:
return 'is_read_pct is not a number'
import re
mg = re.match('\s(\d+[-/]\d+[-/]\d\d\d\d).*?Last Page Read: location \d+ \((\d+)%\)', val, re.I + re.DOTALL);
if mg is None:
return no_page_read_str
date = mg.group(1)
pct = mg.group(2)
try:
f = int(pct)
if f >= test_val:
return date
return is_reading_str + ': ' + pct + '%'
except:
pass
return no_page_read_str
I changed the regexp in the re(...) clause to carve out both the date and the percent. If it finds them, then the ifs below choose what to return. Have fun.
|
|
|
|
|
|
|
#57 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Thanks !
Quote:
Thanks a lot. You probably saved a lot testing hours, trying to grab the date. Will test a bit later today when I'm home from work.
|
|
|
|
|
|
|
#58 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Just noticed: you must use re.match('.*\s(\d+ (note the new .* at the beginning of the string). It won't work as I wrote it, because re.match is an anchored search. The pattern must match all characters from the beginning. This is done to ensure efficient location of the last annotation group. |
|
|
|
|
|
|
#59 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Quote:
You were SO close ! All I had to do was add .* in re.match since the date is not at the start of comments. RTFM helped with that one ![]() Bit tricky to find. Added more return strings to determine that mg was empty. Now I know what I wish for my birthday: python debugger, line by line, integrated in Calibre ![]() I know, keep dreaming. How do you debug ? Just looking, trying, etc. ? ![]() @beckywc: Will post my suggestions for you shortly. |
|
|
|
|
|
|
#60 | |
|
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Refresh page before posting. Sigh
Quote:
Posted before reading this post. Good part is I figured it out myself ! ![]() Thank you, once more |
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "integrity error column book is not unique" | Atiajar | Calibre | 4 | 12-21-2010 11:22 PM |
| Can Comments be "saved to disk" for reading? | sailingpeanut | Recipes | 1 | 10-10-2010 10:06 AM |
| (2 books) in "On Device" column Sony Reader | phenomshel | Calibre | 23 | 09-19-2010 05:43 PM |
| Bug? "Insert metadata as page at start of book" doesnt encode Comments field properly | rollercoaster | Calibre | 2 | 04-24-2010 10:40 PM |