Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Devices

Notices

Reply
 
Thread Tools Search this Thread
Old 04-02-2011, 10:02 PM   #16
PapaJohn
Enthusiast
PapaJohn began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Feb 2011
Device: Kindle Paperwhite, Kobo Aura One
pchrist7
Well I just upgraded to the latest version of Calibre (0.7.53) and I guess some changes have been implemented in the code. My Read Staus Column was giving me an error... something about an invalid arg count. I then modified the template for an arg count of 4 (down from 5) and now I don't get the error message, but now in the case of a book that has been read the column shows a date instead of Read. Any ideas?

I also noticed that when I was in the plugboard that if I had my Kindle DX attached it showed "device attached Kindle_DX" and if I had my wifes K3 attached it showed "device attached Kindle2". I am not a programmer and don't have a clue, but I was wondering if Calibre is able to recognize the difference between the 2 devices if somehow that could be used to create 2 separate Read Status Columns???
PapaJohn is offline   Reply With Quote
Old 04-03-2011, 01:10 AM   #17
pchrist7
Addict
pchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animals
 
pchrist7's Avatar
 
Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
Quote:
Originally Posted by PapaJohn View Post
pchrist7
Well I just upgraded to the latest version of Calibre (0.7.53) and I guess some changes have been implemented in the code. My Read Staus Column was giving me an error... something about an invalid arg count. I then modified the template for an arg count of 4 (down from 5) and now I don't get the error message, but now in the case of a book that has been read the column shows a date instead of Read. Any ideas?
Will test based on your original example. Please post new example of annotation, column definition incl. python template, just in case you changed something.

Quote:
I also noticed that when I was in the plugboard that if I had my Kindle DX attached it showed "device attached Kindle_DX" and if I had my wifes K3 attached it showed "device attached Kindle2". I am not a programmer and don't have a clue, but I was wondering if Calibre is able to recognize the difference between the 2 devices if somehow that could be used to create 2 separate Read Status Columns???
As said before, Calibre stores 1 set of annotations for 1 book. It's book based, not device based. IF you want to track read status of 1 book, on 2 devices, you should have 2 Calibre libraries: 1 for KDX and 1 for K3.
I might be wrong, but I think not.
Developpers ?

Last edited by pchrist7; 04-03-2011 at 01:12 AM. Reason: spelling, formats
pchrist7 is offline   Reply With Quote
Advert
Old 04-05-2011, 05:32 PM   #18
PapaJohn
Enthusiast
PapaJohn began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Feb 2011
Device: Kindle Paperwhite, Kobo Aura One
Hi pchrist7
This is the code I am using:
Code:
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct,  
				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+).*?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
		elif f > 0:
			return is_reading_str + ': ' + pct + '%'
	except:
		pass
	return no_page_read_str
And the template for the Read Status Column:
Code:
{comments:kindle_read_status(95,Reading,Not Read)}
I don't recall making any changes.
Cheers
PapaJohn is offline   Reply With Quote
Old 04-06-2011, 08:57 AM   #19
pchrist7
Addict
pchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animalspchrist7 is kind to children and small, furry animals
 
pchrist7's Avatar
 
Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
Quote:
Originally Posted by PapaJohn View Post
Hi pchrist7
I don't recall making any changes.
Cheers
Hi
Some things changed since your own post #8 in this thread
https://www.mobileread.com/forums/sho...71&postcount=8
It appears you have the code from #137 and had arg count from post #172
in the old thread.
The code from #137 will return the date, if you want the Text Read returned, follow instructions in #172.
pchrist7 is offline   Reply With Quote
Old 11-14-2014, 07:40 PM   #20
pein2k4
Junior Member
pein2k4 began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Nov 2014
Location: Germany
Device: KPW2
Hi,
I have the same problem as PapaJohn. I'm already trying to get the read status in my Calibre for days now.

I have, as described, deleted and tried again many times, waited a day and always rebooted Calibre and it is still displaying "not read".

What am I doing wrong?
Does it work at all with the KPW2

I use the template kindle_read_status_2 with German text.
Kindle PW2 - Calibre 2.10 - OS X 10.9.5

Quote:
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+).*?Zuletzt gelesene Seite: Ort \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 is_read_str
elif f > 0:
return is_reading_str + ': ' + pct + '%'
except:
pass
return no_page_read_str
pls
pein2k4 is offline   Reply With Quote
Advert
Old 12-15-2014, 02:17 PM   #21
PapaJohn
Enthusiast
PapaJohn began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Feb 2011
Device: Kindle Paperwhite, Kobo Aura One
Hi pein2k4,
This is what I have in my template: (it is working fine for my Kindle DX and my wife's Paper White under Calibre 2.12.0)
Function: kindle_read_status
Arg Count: 5
Documentation:
Check if the associated field contains a kindle annotation for percent read.
If not, return no_page_read_str.
If so, then compare that percent against is_read_pct.
If the val is larger, then return is_read_str,
if the val is >0 and < is_read_pct return is_reading_str.
Otherwise return is_not_read_str.

One usage: {comments:kindle_read_status(90,Read,Reading,Not Read)}

( use the above when defining your custom column )

90 goes into variable is_read_pct. IF pct_read > 90 the book is "read" The text returned is
Read goes into the variable is_read_str. This ex. returns the text Read
Reading goes into variable is_reading_str. IF pct_read >0 book the text "Reading" is shown with the percentage shown as well.
Not Read goes into variable no_page_read_str. IF none of the above catch, then "Not Read" is shown.

Feel free to change the %, the text strings to suit your needs.
Remember: Do this in the custom column definition.

Program Code:
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+).*?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 is_read_str
		elif f > 0:
			return is_reading_str + ': ' + pct + '%'
	except:
		pass
	return no_page_read_str
Do a copy and paste of all of the above to the required fields and it should work.
Good Luck
Ps: Don't forget to select Fetch Annotations fron the menu once your device is connected to Calibre.

Last edited by chaley; 02-14-2015 at 06:43 AM. Reason: Add code tags so the the necessary indentation is preserved
PapaJohn is offline   Reply With Quote
Old 02-13-2015, 08:00 PM   #22
Minotaur
Enthusiast
Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.Minotaur can teach chickens to fly.
 
Posts: 40
Karma: 3798
Join Date: Nov 2014
Location: Adelaide, Australia
Device: Kobo Forma
I have used the exact code in the previous post but all I get is "Not Read" - am using a PW2.
Minotaur is offline   Reply With Quote
Old 03-14-2015, 10:27 PM   #23
FMarkus
Junior Member
FMarkus began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2012
Device: Kindle 4
Same issues here, my old read status for the german kindle (posted here) no longer work with my PW1.

Any ideas to fix this?
Why will the Annotations not be shown?
FMarkus is offline   Reply With Quote
Old 05-22-2015, 04:57 AM   #24
AJvK
Member
AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.AJvK knows the square root of minus one.
 
Posts: 24
Karma: 7940
Join Date: Jun 2013
Device: Kindle Voyage, Kobo Aura (normal and HD)
I'm having the same issues on my Kindle Voyage. Tried a few things all to no avail; see here
AJvK is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with this custom Column. Rie142 Library Management 2 02-20-2011 09:51 AM
Custom Composite Column silentguy Calibre 4 11-24-2010 10:28 AM
Custom column read ? pchrist7 Calibre 2 10-04-2010 02:52 AM
custom column i need a little help shinken Calibre 3 09-15-2010 03:41 AM
Custom Column Problem MSJim Calibre 7 09-08-2010 05:07 PM


All times are GMT -4. The time now is 12:02 PM.


MobileRead.com is a privately owned, operated and funded community.