10-13-2013, 03:32 AM | #331 |
Grand Sorcerer
Posts: 11,862
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@Ayack:
Try 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 pattern = u'.*(\d+[-/]\d+[-/]\d+).*?Dernière page lue : Emplacement \d+ \((\d+)%\)' mg = re.match(pattern, val, re.U + 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 1) Your sample string from the comment has no space before the date. The original function required that space ('\s' before the '(' in the pattern). 2) You must tell python that the strings contain unicode (the u' in the pattern). 3) You should tell the re.match function that the arguments are unicode (re.U). 4) The character after 'lue' is very strange. It is not a space. I had to change it to be a real space character. You might be able to change it back if you put that same character into the pattern. I cannot guarantee that this function will work with your data because the comments are in html. What you see might not be what is actually in the comment. |
10-19-2013, 05:52 AM | #332 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jun 2012
Device: Kindle
|
Thanks! It works changing back the character after 'lue' (it's a "nnsbp" see here: https://translations.launchpad.net/c...293/+translate).
So, for the record, in French you can use this code: 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 pattern = u'.*(\d+[-/]\d+[-/]\d+).*?Dernière page lue : Emplacement \d+ \((\d+)%\)' mg = re.match(pattern, val, re.U + 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 |
Advert | |
|
10-25-2013, 08:38 AM | #333 |
Groupie
Posts: 197
Karma: 318144
Join Date: Jul 2013
Location: Well, there will always be a big time delay because I'm not living in the US! And there could be some communication difficulties too because I'm not a native speaker!
Device: Sony PRS-T3S
|
Template for title with more info on Sony reader PRS-T1.
I don't know if this is right here but after I created this template for me I thought I share but since this is the first time I done a template, I don't know if this is even helpful to anyone but me.
Anyway, I came up with this because I'm reading a lot of fanfiction and wasn't happy with the title info my Sony reader supplied for me. I wanted to see more just by scrolling through my library on my reader. Since Sony gives the option to show the title in one line (with the author smaller beneath) or two lines (without the author) and you can easy switch between that two versions, I thought I try this. So my goal was a title for lets say the fanfiction story 'Reaction' (by Blind Author) to show on my reader like this: Reaction (45,438) [Completed] read: Yes Or a story of a series like 'There But for the Grace of John Watson' (by Skyfullofstars) to show like this: There But for the Grace of John Watson (114,950) - 001. The Grace of John Watson [Completed] read: No Necessary custom columns for this are: {#words} - for the Word Count (in connection with the Count Pages Plugin) {#status} - displaying Completed or In-Progress for a story {#read} - a Yes/No column My custom column I greated for my new title info on my Sony reader is: Lockup name: title_sony Column heading: Title Sony Column type: Column build from other columns Template: {title} {#words:|(|)} {series_index:0>3s|- |.} {series} {#status:|[|]} {#read:|read: |} Now go to Preferences in calibre, to Import/Export and the Metadata plugboards and add a new one: format: device_db device: PRST1 (or choose: any device) source template: {#title_sony} destination field: title Done! MiniMouse Last edited by MiniMouse; 10-25-2013 at 01:18 PM. |
11-01-2013, 07:15 PM | #334 |
Junior Member
Posts: 6
Karma: 10
Join Date: Sep 2013
Location: Moscow, Russia
Device: iPad
|
Initials vs full name
Anybody know how to do this?
I'd like to see {#author_title_sort} like "Andersen, H.C. - Fairy Tales" With initials, not full name. |
11-01-2013, 07:54 PM | #335 | |
US Navy, Retired
Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
{author_sort:re(\, (.).*?( &|$),\, \1\2)} - {title} Good Luck Last edited by DoctorOhh; 11-01-2013 at 07:59 PM. |
|
Advert | |
|
11-09-2013, 08:57 AM | #336 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Sep 2013
Location: Moscow, Russia
Device: iPad
|
Quote:
With this formula 'James Fenimore Cooper' looks like 'Cooper, J', but not 'Cooper, J.F.' |
|
11-17-2013, 05:06 PM | #337 |
Connoisseur
Posts: 77
Karma: 3090
Join Date: Apr 2013
Location: California
Device: Kobo Aura One, Kobo Aura H20,Kindle PW1
|
Help needed - collection, author, series creation on PW1 and calibre database
Hi, I was wondering if anyone would have some suggestions for me. I am new plugboards column management. I have been reading and trying various different ideas others have posted, but haven't found exactly what I am looking for.
Firstly, I have a large book database and so I am looking for something that will be a little less time consuming then editing individual entries. I am currently using calibre 1.11 64bit using the kindle collections plugin on a jailbroken Kindle PW1 with K5 collection manager. What I would like to do it to ultimately have my books sent to and displayed on my PW1 in the format: [1] A Game of Thrones - A Song of Ice and Fire George R. R. Martin Now I have achieved this using metadata plugboard entry post from another member (see attachment "metadata plugboard"). This method requires me to modify the "title" of each of my entries and copy from the series field in calibre and paste it into the title field in order to show the series information on my PW1 "A Game of Thrones - A Song of Ice and Fire [01] at which point I then need to remove the "[1]" because if a title is too long it gets cut off, and in the metadata plugboard it puts it in front. SO can always see which book number it is on my PW1. This method also doesn't create collections on my PW1 for organization purposes on my PW1. I would like collections to ultimately created in this format using the above example: Martin, George R.R - A Song of Fire and Ice (and then I can use the k5 collection manager to tag the various books in that series) I have tried time and time again to use some form of custom column using the "columns built from other columns, behaves like tags which would make use of the calibre kindle collection plugin which would eliminate the need to modify the title field with the series in it but for some reason it doesn't work out that way once it is sent to my PW1 and I implement the k5 collection manager to create collections.. it creates several collections under author, under series, and under title. I used the {author_sort} - {series}{series_index:| - | - }{title} as template entry. If anyone can help me with this I would greatly appreciate it. Thanks and sorry for the long winded post. Just trying to give all the information I can first off. Crissman |
11-17-2013, 08:07 PM | #338 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Why is your custom column of type "columns built from other columns, behaves like tags" when it should be "columns built from other columns"?
Also, use the template Code:
{author_sort}{series:| - |} Code:
{series_index:| - | - }{title} If you use Code:
{author_sort} - {series}{series_index:| - | - }{title} |
11-18-2013, 09:51 AM | #339 | |
Groupie
Posts: 180
Karma: 299
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
|
Quote:
Details are always important when asking for help. I am WAAAAAY more long winded than you were. So don't worry. I threw in a query about series 'shortening' back in post #52 in this thread. And that brought Chaley into the discussion two posts later. And if you read the thread from there, you will get what you are looking for, I promise. There's a bunch of columns you have to create to make his suggestions work for you. But they are clearly outlined instruction-wise, with the only warning I have to COPY and PASTE from the examples, since there is a space that is required that can be missed when typing. My own version of Chaley's hard work is: [{#readrank:ifempty(9)}{#genre:ifempty(SF) {#stripped_series:lookup(.\s,#initials,.,#shortene d,series)}{series_index:|-|-}{title} You won't need readrank, that's my estimation on how quickly I want to read the book, with 0 being NOW and 9 being when prodded into doing it by others. I also have a genre field which is my SINGLE selection of the various possible tags. Something like 0MY or 1SF to start my onKindle title. My shortened series field is a product of another Chaley suggestion to test for series length, and if TOO long, reduce it to just initials. So Game of Thrones becomes GoT. My titles are started with a controllable indicator of series and number, or nothing if not standalone, and then the title. NONE of the work is mine, so I ask you review Chaley's responses in the thread starting with #54. After that, you'll feel like a calibre programmer. |
|
11-18-2013, 04:01 PM | #340 | ||||
Connoisseur
Posts: 77
Karma: 3090
Join Date: Apr 2013
Location: California
Device: Kobo Aura One, Kobo Aura H20,Kindle PW1
|
ALMOST THERE!!!!
Quote:
Quote:
I have done "customize collections to create in calibre" to create collections based on my column using the Template {author_sort}{series:| - |}. After which I then did "Create Collections on the Kindle from Calibre" this worked perfectly. I then went to my PW1 and opened up K5 Collection Manager Menu/Synchronization/Import collections from Calibre. What it created collection Martin, George R.R. - A Song of Ice and Fire No Items Am I missing something, I could have sworn using the collection manager in the past created the collections and auto-populated the collections the books inside that collection?((I know it is tags and not truly folders) without having to manually add the books using the move/copy command in the CM and moving them into the collections? Quote:
Quote:
As a side question.. my mother has a kobo Aura HD any ideas if this would also work on hers or not. I am not familiar with the layout of books and collections on kobo. Thank you very much for all this help. 3 Cheers to Chaley as well!!! Last edited by crissman; 11-19-2013 at 01:46 AM. |
||||
11-19-2013, 01:48 AM | #341 | |
Groupie
Posts: 180
Karma: 299
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
|
Quote:
Oddly enough, I ran into an Aura last week. Getting the books onto the system proved a little more adventuresome then when my Mom had an original Kobo (three different ones over 28 months) and it was easy as pie to have Calibre send the books to her device. I ended up treating the Aura as other for the purposes of connecting the device and it went adequately from there. Course, we are talking MOBI and EPUB when talking the two devices. Some conversion will be necessary. But doable for anything that doesn't have retail DRM encrypting it. (and yes, I know there are no limits in the real world). I used the same template and got basically the same result. The plugboard produces a ON-BOOK title as you want. I just copied the plugboard entry to the clipboard, added the second device and pasted it back in. Got the same result that I was used to. Now, your mom's preferences might be for something less cryptic. Maybe she's okay with an ENDING of [01] Game of Thrones, which can be cut off without losing the cardinality. My mom consumers her author list as they come out. She bookmarks FantasticFiction.co.uk and knows the release date of her authors. She has no need for series info. SHE can tell ME what the book numbers are, without having to look it up. 'course, she has about ten authors to watch. I'm tracking 119 at last count. Harrumph. I think you'll find a happy medium for yourself and your device, and devices for others by just asking and trying to make it work they way they want. You might get surprised. Happy programming (and plugboard programming IS calibre programming). But just for you. |
|
11-19-2013, 04:06 AM | #342 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
The KoboTouch driver in calibre supports all the current Kobo ereaders. The driver also supports creating collection/shelves from one or more columns in the library. The plugboards discussed here will work, but Kobo ereaders have support for series information. It is displayed in the lists on the device and is searchable.
|
11-22-2013, 10:55 AM | #343 | ||
Connoisseur
Posts: 77
Karma: 3090
Join Date: Apr 2013
Location: California
Device: Kobo Aura One, Kobo Aura H20,Kindle PW1
|
Quote:
Quote:
|
||
12-21-2013, 11:35 PM | #344 |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Hi Plugboard Experts:
I am hoping you could help me modify my plugboard so that I can get information that will display fully on my kindle. I currently have the following plugboard: {tags} - #purchased1 - {#stripped_series:lookup(.\s,#initials,.,#shortene d,series)}{series_index:0>2s| [|] } - {title} I would like to keep the following plugboard except I would like to be able to set it up so that only the first three letters of the custom column #purchased1 displays. I tried to follow the setup for the stripped series but I am completely lost and I think I've messed something else. Can someone help me set up the shortened #purchased1 column?? |
12-22-2013, 12:26 AM | #345 | |||
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Using your plugboard, that gets you: Quote:
If {#purchased1} is sometimes empty, you may want to use this: Quote:
Last edited by eschwartz; 12-22-2013 at 12:31 AM. |
|||
Tags |
custom column, tag, tags |
|
Similar Threads | ||||
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 |