09-22-2014, 11:49 PM | #601 |
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)
|
You'd need to have them all have some uniform style, or writing the regex could take nearly as long as doing it manually.
We could do it with multiple passes. For instance, Find: Code:
(^[^-]+)( - .*)?(: A Novel|other junk endings)? Code:
\1 Find: Code:
(^[^:]+):.*(\[\d\]|, Book \d+) Code:
\1 These two should cover every example you gave. EDIT: Combine the two together with (I think) Code:
(^[^-:]+)(: (A Novel|other junk endings|(.*(\[\d\]|, Book \d+))))?( - .*)? Last edited by eschwartz; 09-23-2014 at 12:07 AM. |
09-23-2014, 12:07 AM | #602 |
Connoisseur
Posts: 77
Karma: 3090
Join Date: Apr 2013
Location: California
Device: Kobo Aura One, Kobo Aura H20,Kindle PW1
|
Excellent.. This is exactly what I needed.. works perfectly.
as for other formats.. Umm Blush.. just noticed when trying this out that there is also a: Horizon Storms: The Saga of Seven Suns - Book 3 there is a - instead of a , like the others where. |
Advert | |
|
09-23-2014, 12:11 AM | #603 |
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)
|
Try:
Code:
(^[^-:]+)(: (A Novel|other junk endings|(.*(\[\d\]|(,|-) Book \d+))))?( - .*)? |
09-23-2014, 12:13 AM | #604 |
Connoisseur
Posts: 77
Karma: 3090
Join Date: Apr 2013
Location: California
Device: Kobo Aura One, Kobo Aura H20,Kindle PW1
|
|
10-07-2014, 02:52 AM | #605 |
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
|
Can anyone tell me how to make a re(pattern, replacement) template for multible pattern, replacements in a custom column?
|
Advert | |
|
10-07-2014, 03:13 AM | #606 |
Grand Sorcerer
Posts: 11,939
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
A bit more information will be helpful. Is the custom column a tags-like column? What sort of patterns do you want to replace with what sort of replacements? Will the pattern appear more than once in the string? Examples are good.
|
10-07-2014, 04:09 AM | #607 | |||||
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
|
Quote:
For example: Quote:
Quote:
Quote:
Quote:
Mini |
|||||
10-07-2014, 05:01 AM | #608 | |
Grand Sorcerer
Posts: 11,939
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
If your relationship names all have the form ("some characters" space "desired name") (all of your examples do have this form) then you can easily do what you want by stripping all the leading characters from the name to leave the last word. This GPM template shows how to do that. Code:
program: sample = 'S. Holmes/J. Watson, S. Moran/J. Moriarty'; list_re(sample, ',', '^.* ([^ ]*)/.* ([^ ]*$)', '\1/\2') This scheme will not work if the last word must change based on the original. For example, it won't work if you want 'S. Holmes/J. Watson' to become 'Holmes/Whatnot" because whether or not to change from Watson to Whatnot depends on the seeing "Watson" and not "Moran". It also will not work if last names can be two words, such as von Trapp. If in fact you really want a series of expressions of the form A becomes B then you would need to write each of them as a separate regular expression. If there are more than a few of them, the performance would be terrible. An alternate approach would be to write a custom template function that uses python dictionaries to make the changes. This would have acceptable performance (I think) but requires you to know how to code in python. The maintenance would also be problematic because all changes would need to be made in python. Yet another alternate approach would be to write a calibre python script that processes the relationship column to create another tags-like column containing the values you want. This would have great performance and be somewhat easier to maintain, but still suffers from having to do it in python. An example of what this might look like is under the spoiler. Spoiler:
|
|
10-07-2014, 01:52 PM | #609 | |
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
|
Quote:
Now it seems I have to learn something new... again. I think the last option could be more my solution BUT where do I put something like this? Never have done that before. Now I need a bit more information Mini |
|
10-07-2014, 03:06 PM | #610 | |
Grand Sorcerer
Posts: 11,939
Karma: 7219261
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
calibre-debug -e foo /path/to/your/library These scripts are not the easiest thing to understand, especially if you are not a programmer. If you want to try to use it or something like it, feel free to ask questions. Do note that it might be easier in the long run to change the ini file of the fanfic downloader. |
|
10-07-2014, 03:42 PM | #611 | |
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
|
Quote:
I will think about what to do and be sure, I come back when I have questions |
|
10-24-2014, 03:55 PM | #612 |
Junior Member
Posts: 5
Karma: 10
Join Date: May 2009
Location: Blito-P3
Device: KT v5.6.0.1
|
Can anyone please explain why this recipe isn't working for me?
Metadata Plugboard: format:mobi device:kindle2 source template1: {series_index:0>4.1f|| - {title}} dest field1: title source template2: {author}{#subseries_index:>2s| - {#subseries}| - } dest field2:authors OK, now the first template works just fine. Heck, even the second template works fine when incorporated into the first, (minus the {author} bit of course). My expected output for the second template is: AuthorName - SubSeriesTitle - 1 What I end up with no matter where I put the {author} tag is: AuthorFirstName - SubSeriesTitle - 1 AuthorLastName Looking at it on the KT the books get sorted by SubSeriesTitle alphabetically. Then by subseries_index, albeit correctly, then correctly by the title template. So, an example of what's displayed on the KT if the above confused you: 25.0 - A Kingdom Besieged Raymond E. - Chaoswar Saga - 1 Feist 26.0 - A Crown Imperiled Raymond E. - Chaoswar Saga - 2 Feist 27.0 - Magician's End Raymond E. - Chaoswar Saga - 3 Feist 17.0 - Talon of the Silverhawk Raymond E. - Conclave of Shadows - 1 Feist And so on and so forth... For what it's worth, any books NOT having a subseries are displayed as expected via the above templates. I mean like; Robot Dreams Isaac Asimov and 01.0 - The Early Asimov - Volume 1 Isaac Asimov Also,my Calibre library displays everything just as you would expect. I mean, Series then SubSeries in the correct order. Can someone please assist? |
10-24-2014, 04:33 PM | #613 |
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)
|
That is because the template is sending the following author name, just as you told it to:
Code:
Feist, Raymond E. - Chaoswar Saga - 1 The Kindle automatically switches LN, FN to FN LN in the display field, and uses the LN section for the sort values. (MOBI/AZW3 does not have a separate author_sort and author field.) Some people have gotten around this by using {author_sort:'re(",", "_")'} but you will sacrifice the ability to sort based on author names. |
11-20-2014, 01:59 PM | #614 | |||
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)
|
Cross-posting an interesting idea from elsewhere, putting the series into the author field on a Kindle and displaying properly:
Quote:
Quote:
Quote:
|
|||
11-20-2014, 05:03 PM | #615 |
Connoisseur
Posts: 78
Karma: 65054
Join Date: Oct 2014
Location: Germany
Device: Sony PRS-T2, Kindle PW2, Oasis 3
|
Here's what it looks like on the Paperwhite2 with FW 5.4.5.1:
(image attached) |
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 |