08-15-2012, 08:35 AM | #1 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
Sort library by length of title (or author, etc) ?
Some titles are ridiculously long. Does anyone have an approach, such as using a custom column, to sort the library based on the length of the title (or length of authors, etc)? I would then manually edit the largest ones.
One partial tool seems to be the Quality Check plugin (check metadata / check titles with series), which seems to list a lot of the problem titles (I think because it includes a check for ":" which is often used in extended titles ... I don't know how to do a direct check for ":" in the title because something like search:: doesn't work in the search field). An alternative is to generate an excel-type catalog of the library and then sort within excel using len(...), but I was wondering if the sort can be done within Calibre to make it easier to group the items to be edited? |
08-15-2012, 09:34 AM | #2 | |
Well trained by Cats
Posts: 29,802
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Select a small group of books first You should be able to find anything your REGEX foo can code You can even set a value in a destination (custom) column (like string length if you can figure out if using chaleys advanced template expressions will work here) |
|
Advert | |
|
08-15-2012, 10:57 AM | #3 | |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
Quote:
But it only produced error messages in the column that was created. I obtained the strlen(a) function from http://manual.calibre-ebook.com/template_lang.html . Any thoughts on how the template should be tweaked, if that sort of approach is okay? |
|
08-15-2012, 12:27 PM | #4 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Try "program: strlen(field('title'))" no quotes. I am using my phone so it might not be right.
|
08-15-2012, 12:54 PM | #5 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
Interestingly, that will produce a correct count in the custom column for the number of characters in the title of the first book in the library, but displays an error for all the other books. I then tried enclosing in {} but that didn't work at all.
|
Advert | |
|
08-15-2012, 01:01 PM | #6 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
What is the error?
|
08-15-2012, 01:14 PM | #7 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
The error message displayed in each row of the custom column is "TEMPLATE ERROR expecting string or buffer".
The following is what I have as the template in the definition of the custom column, which has a column type of "column built from other columns": program: strlen(field('title'))
|
08-15-2012, 01:37 PM | #8 |
Grand Sorcerer
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use "program:format_number(strlen(field('title')), '{0:d}')"
|
08-15-2012, 01:50 PM | #9 |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
Perfect ...
The column now shows the length of the title name for each of the books. Thanks chaley ... that worked perfectly !
:Aug 18 INSERT: Later in this thread an issue arises regarding the sorting of the new custom column. I should have noted in more detail that in setting up the custom column (by right-clicking on the existing row of column descriptors and selecting "add your own columns", then clicking on the "+" icon (or the "i" icon after the column is set up)), after inputting a name of your choice and choosing the column type "column built from other columns", and inputting the template description that chaley provided "program:format_number(strlen(field('title')), '{0:d}')" it is important (as chaley identifies later in this thread) to also select the accompanying option to sort/search column by "number".
Last edited by Rob557; 08-18-2012 at 09:15 PM. Reason: belatedly adding INSERT to provide more detail in advance of the sort issue that comes up later in this thread |
08-15-2012, 09:17 PM | #10 |
Well trained by Cats
Posts: 29,802
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
08-16-2012, 06:34 AM | #11 | |
Zealot
Posts: 108
Karma: 810
Join Date: Jul 2012
Device: Kobo
|
Quote:
The shortened fields help to flush out more duplicate files by helping to first remove extraneous add-ons to those two fields (particularly when merging libraries), and then using the Find Duplicates plug-in. The names of files when using "save to disk" are also shortened to a more practical length. Thanks again to chaley, and thank you theducks ... you were right regarding chaley's toolkit and the basic approach to take. |
|
08-17-2012, 10:36 PM | #12 |
Wizard
Posts: 1,814
Karma: 4985051
Join Date: Sep 2010
Location: Maryland
Device: ...lots! ;) mostly reading on a Kindle Voyage
|
This works great!
Once this custom column is set up, how does one search for books with titles, say, greater than 30 characters? |
08-17-2012, 11:51 PM | #13 | |
Well trained by Cats
Posts: 29,802
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
or #columnname:>=30 see the fine manual section here http://manual.calibre-ebook.com/gui.html#id21 |
|
08-18-2012, 09:25 AM | #14 |
Wizard
Posts: 1,814
Karma: 4985051
Join Date: Sep 2010
Location: Maryland
Device: ...lots! ;) mostly reading on a Kindle Voyage
|
Sorting by the header sort of works, but it gives me wonky results. Here's a mere sampling of my library to show you what I mean:
Spoiler:
That was the exact phrase I attempted to search for, yes, from the page you indicated, but it didn't work, maybe because the RegEx needs to allow for two numeric place holder values? |
08-18-2012, 10:35 AM | #15 | |
Well trained by Cats
Posts: 29,802
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
That screen shows 'Digits' (text), not Numbers, which is why the Search term (for a numeric field) does not work. The column needs to be Floating Point for that to work or you need to pad enough leading 0's (blanks are just too hard to see ) to match the highest digit count |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-650 [calibre] How do I set it up so I can sort by author - Series - Title?? | BelgarionNL | Sony Reader | 49 | 06-22-2012 10:04 PM |
Caibre - Fails to sort by Author, Title, etc | LesWilk | Devices | 1 | 03-17-2012 06:41 AM |
Sort by author then title | richardwarriner | Library Management | 3 | 11-16-2011 01:00 PM |
Author then title sort | Gary Young | Calibre | 4 | 08-30-2010 10:03 PM |
Sort by author AND title | bookends | Calibre | 2 | 05-09-2010 01:55 PM |