![]() |
#136 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jan 2011
Device: Kindle
|
Custom Pegboard Request
I just purchased a Kindle, and I wish to have the title of each book include not only the series name, but also the over-arching meta series name and index, if available. For example:
The book "Rogue Squadron" is book one of the series "X-Wing", which is itself a part of the meta-series "Star Wars". I would like the title to appear as "Star Wars: X-Wing - 01 - Rogue Squadron". I have created a custom field in Calibre titled "Meta Series" which holds the data "Star Wars". I'd want to be sure that the colon or dash marks don't appear if there is nothing in the fields. How would I go about setting up a pegboard for this? Any help is appreciated. Thank you. |
![]() |
![]() |
![]() |
#137 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
![]()
Hi All
The following HOWTO was developped in another thread. Chaley suggested to put it here as well. Do you have a Kindle ? Did you ever want Calibre to show "Read Status" of your books in a column ? Automagically ? Then the following might for you as well. You must be running Calibre 0.7.40 or newer to use this. Also you must use "Fetch annotations" from you Kindle. The following example is based on the following Kindler requirements: "What I want is a custom column to show the "Last Opened" Date if Last location read > 95%. If the book shows >0% but < 95%, I want the column to show "Reading" And if the book is 0%, or unopened, the column should show "Not Read". Howto "Fetch annotations" from you Kindle: Start Calibre, Connect your Kindle, wait a bit, Click on the arrow just to the right of the "Send to Device" icon, choose "Fetch Annotations" and the Kindle "Book status" is added to the Calibre book details, in the comments. You should Fetch fresh Annotations everytime you connect your Kindle to get updated information. This is just an example of what I could get with my K3: 25-12-2010 Last Page Read: Location 7365 (68%) Location 4603 • Bookmark Location 4942 • Bookmark Location 4980 • Bookmark Location 5984 • Bookmark Location 7363 • Bookmark The best/fastest way, but hardest way, to get the needed information into a custom column, is to use Python Template functions. Sounds scary, but don't worry. Copy/paste is your helper Simply do as follows: 1) go to Preferences -> Advanced -> Template Functions. 2) in the Function box type: kindle_read_status 3) in the Arg count box type: 4 4) in the Documentation box, paste the following: Code:
Check if the associated field contains a kindle annotation for percent read. If not, return no_page_read_str. If annotations are found, then compare that percent against is_read_pct. If the val is larger, then return date, 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(95,Not Read,Reading)} ( use the above when defining your custom column ) 95 goes into variable is_read_pct Not Read goes into variable no_page_read_str Reading goes into variable is_reading_str Feel free to change the %, the test strings to suit your needs. Do this in the custom column definition. 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 7) Still in Preferences, Choose Add your own columns 8) Choose Add custom column bar at the bottom 9) enter the following into your custom column: Lookup name: read_status Column Heading: Read Status Column type: Column built from other columns Template: Code:
{comments:kindle_read_status(95,Reading,Not Read)} 11) Click Ok to the Restart Warning 12) Shutdown Calibre 13) Start Calibre If you followed instructions minutely, you should have a new column showing the "Read Status" for your books. If you like this functionality, please remember to send some Karma to chaley https://www.mobileread.com/forums/rep....php?p=1351864 He has been absolutely fantastic and helpfull with this. If this fails, please try one more time before posting to this thread. This has been tested by several Kindlers succesfully. Enjoy Note: If you want a text returned instead of a date when a book is read have a look here: https://www.mobileread.com/forums/sho...&postcount=172 Last edited by pchrist7; 04-26-2011 at 10:01 AM. Reason: Make it work for K2, KDX. Year was 4 digits and gave problems for these readers |
![]() |
![]() |
![]() |
#138 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Very interesting, one question though: Why does this new column not show up in the columns section on the left? Now I have to go "read" books I have already read so that they are all registering correctly. Thank you all for this one.
![]() Nyn |
![]() |
![]() |
![]() |
#139 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,882
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
|
![]() |
![]() |
![]() |
#140 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
No, a restart does not produce it either, but no big deal.
One more question: Is there a way to adjust the template to pull the annotations from K4PC, since that is easier to use to go back to adjust the locations for the books? |
![]() |
![]() |
![]() |
#141 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
|
![]() |
![]() |
![]() |
#142 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Me again, I am having a little trouble with where the data is being inputted from the annotation. This is what the format is:
Code:
1/24/2011 Last Page Read: Location 721 (99%) |
![]() |
![]() |
![]() |
#143 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Hmm
Quote:
I can confirm that something is going on with the tags, adding a + Don't use/show tags myself, so this I missed. Will try to find out what/why, but still new to this. The example will only return one value. The example wanted to use 95% as the comparison value. Try changing you costum column definition to Code:
{comments:kindle_read_status(99,Reading,Not Read)} |
|
![]() |
![]() |
![]() |
#144 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,882
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
I don't know why a + is being added as a tag, but when creating a catalog in calibre I believe every book that has a + as a tag is treated as read.
Last edited by DoctorOhh; 01-24-2011 at 06:22 AM. |
![]() |
![]() |
![]() |
#145 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
Thats it
Quote:
Yep - did a lot of Googling, to confirm this. I'm sure that the + is added by "Fetch Annotations", no matter which custom columns you might have had. I would guess the idea was to Mark a book "read" by adding the + to the tags. This was way before custom columns etc. Not sure what value for inserting the + is |
|
![]() |
![]() |
![]() |
#146 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 385
Karma: 6514
Join Date: Aug 2010
Location: Denmark
Device: Kindle 3 3G+Wifi, Oasis
|
|
![]() |
![]() |
![]() |
#147 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,270
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I looked at the code. It is using the 'Read tag' value from the catalog options, which defaults to a '+'. My guess is that you can turn off adding the tag by emptying that option in catalog setup.
|
![]() |
![]() |
![]() |
#148 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
|
![]() |
![]() |
![]() |
#149 |
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
|
![]() |
![]() |
![]() |
#150 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,270
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Click the dropdown arrow on Convert Books or right-click on a book in the library view, choose 'create catalog', select Epub or Mobi, change the option near the middle of the page, and push Apply.
I have no way of testing if making this change actually accomplishes what you want. |
![]() |
![]() |
![]() |
Tags |
custom column, tag, tags |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 03:41 AM |
Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 06:06 AM |
Accessories Decalgirl Kindle 2 custom skin template | srmalloy | Amazon Kindle | 6 | 04-09-2010 09:55 PM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |