11-26-2012, 06:49 AM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Nov 2012
Device: Nook Color
|
help making a plugboard for sorting series?
I've been using calibre for a while now, and i've been using this plugboard i found online to keep my series under control:
{series}{series_index:0>2s| #| - }{title} this mostly does what i want, making all the books in my library show up in nice ordered series. It was good at the start, but now that i have a lot of different books on my nook, i've noticed a new problem: i like making a separate shelf for each series, and whenever i go to add books to it, around half of the series i have are all stuck under T because they have "the" in the beginning of their name. so my list looks something like this: The Black company # - The Chronicles of Narnia # - The Earthsea Cycle # - etc. However, my own preference for making shelves is having the "The" at the end of the name, so its easier to find the books. so my question is: is it possible to make a plugboard that reads something like this: Black Company, The # - Chronicles of Narnia, The # - Earthsea Cycle, the # - I'm sure its possible, but i have no idea how to write plugboards, and i didn't find anything about it by searching around google or the forum. I know i could just delete the "the" from the beginning of the series, but i prefer to have accurate names so i leave them in most of the time, but it makes sorting a pain. |
11-26-2012, 07:01 AM | #2 | |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Last edited by DoctorOhh; 11-26-2012 at 07:04 AM. |
|
11-26-2012, 07:04 AM | #3 |
Junior Member
Posts: 5
Karma: 10
Join Date: Nov 2012
Device: Nook Color
|
|
11-26-2012, 07:21 AM | #4 |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Instead of the template segment
Code:
{series} Code:
{:'series_sort()'} @DoctorOhh: plugboards, like composite custom columns, don't use that tweak. The only templates that respect the tweak are send & save. |
11-26-2012, 07:25 AM | #5 |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
|
11-26-2012, 07:37 AM | #6 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Nov 2012
Device: Nook Color
|
Quote:
i'm afraid i have no idea what any of that means am i just supposed to replace the {series} with {:'series_sort()'} ? i tried that and got an error: calibre, version 0.9.7 ERROR: Invalid template: <p>The template {:'series_sort()'}{series_index:0>2s| #| - }{title} is invalid:<br>'NoneType' object has no attribute 'series' i really dont know anything at all about coding or templates, and the template language link made no sense to me |
|
11-26-2012, 08:32 AM | #7 | |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Your assumption was correct. The exception is a bug. I have fixed that problem for the next calibre release. In the meantime, you can use the following template (in general program mode) that does the same thing but doesn't toss that error. Code:
program: strcat(series_sort(), template('{series_index:0>2s| #| - }{title}')) |
|
11-26-2012, 08:54 AM | #8 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Nov 2012
Device: Nook Color
|
Quote:
my only complaint is that it's removed the space from between the series name and the #, why is that? its minor, but i couldnt help but notice after resorting all my books that needed to be fixed |
|
11-26-2012, 09:03 AM | #9 | |
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You can add it back in easily. Use Code:
program: strcat(series_sort(), ' ', template('{series_index:0>2s| #| - }{title}')) |
|
11-26-2012, 09:20 AM | #10 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Nov 2012
Device: Nook Color
|
Quote:
either way, my problem has been nicely solved, and my library management has been simplified tenfold. thank you for all the help! |
|
11-26-2012, 09:40 AM | #11 | ||
Grand Sorcerer
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
That template returns the value generated by the strcat function, where "strcat" is programmer-shorthand for "string concatenate". A "string" is a possibly-empty sequence of characters. A function like strcat takes "arguments", which are "things" that it is supposed to use when it does its job. The "things" are found between the open and close parentheses. A "thing" can be the result of another function, or a constant. Constant strings are characters surrounded by quotes. "Things" must be separated by a comma. Applying both of these definitions, we see that in the template that works, strcat is to create a single string (its result) from 3 "things": the result from the series_sort() function, the constant ' ' (a single space in quotes), and the result of the template() function (the rest of what you want). The resulting string has all leading and trailing spaces removed, then is passed back to the "user", in this case the plugboard. So, if there is no series (series_sort() returns nothing), strcat creates a string from the second argument (the constant string) and the third argument (template()). The extra leading space (the second argument) is then removed. If series_sort() returns something then that constant space is in the middle of the result (between the series name and the result of template()), and is not stripped away. My guess is that this is more information than you wanted. That said, the ex-professor in me is happy to try to satisfy someone's curiosity about how this stuff really works. Quote:
|
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugboard "Metadata: Show series [series index] - title as title (Kindle)" | Deep Cover | Library Management | 6 | 11-30-2012 05:17 PM |
Series sorting in plugboard | ac4lt | Devices | 6 | 01-13-2012 12:53 PM |
Plugboard: Series Contains Star Wars formatting | uli | Library Management | 2 | 10-22-2011 01:03 PM |
@chaley – Sony PRS505 vs PRS650 - Book sorting & Metadata Plugboard | jackie_w | Calibre | 32 | 12-26-2010 11:45 AM |
Metadata Plugboard - First Char of each word in Series | MikeP1212 | Calibre | 2 | 10-14-2010 06:14 PM |