Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-19-2011, 07:28 PM   #1
Rie142
Member
Rie142 began at the beginning.
 
Posts: 17
Karma: 24
Join Date: Dec 2009
Location: Just outside of Seattle, WA
Device: Kindle2
Exclamation Need help with this custom Column.

I am trying to put this into Calibre. I am not sure what all the leading spaces are? I think I deleted them all.

Custom column:
Name: #special_title
Template: (the following with all leading spaces removed) program:
#compute the equivalent of the composite fields and store them in local variables

stripped = re(field('series'), '^(A|The|An)\s+', '');
shortened = shorten(stripped, 4, '-' ,4);
initials = re(stripped, '[^\w]*(\w?)[^\s]+(\s|$)', '\1');

# Format the series index. Ends up as empty if there is no series index.
# Note that leading and trailing spaces will be removed by the formatter,
# so we cannot add them here. We will do that in the strcat below.
# Also note that because we are in 'program' mode, we can freely use
# curly brackets in strings, something we cannot do in template mode.

s_index = template('{series_index:0>2.0f}');

# print(stripped, shortened, initials, s_index);
# Now concatenate all the bits together. The switch picks between
# initials and shortened, depending on whether there is a space
# in stripped. We then add the brackets around s_index if it is
# not empty. Finally, add the title. As this is the last function in
# the program, its value will be returned.

strcat( switch( stripped, '.\s', initials, '.', shortened, field('series')), test(s_index, strcat(' [', s_index, '] '), ''), field('title'));

When I enter all this into the correct places I get this error.

calibre, version 0.7.46
Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\create_custom_co lumn.py", line 161, in accept
AttributeError: 'QString' object has no attribute 'strip'


Can you tell me what I am doing wrong? No matter what type of custom column I try to make using any of the recipes from the Calibre User Manual or the Calibre Forum I get the same Attribute Error.

I am not a programmer, I am an old dog who is trying to learn a new trick. This trick would be so nice for me and easier to keep the kindles organized.

Thanks for all the help you can give me.
Rie142 is offline   Reply With Quote
Old 02-19-2011, 08:37 PM   #2
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
There is another thread which I saw that error message reported on and Kovid indicating it is a bug that will be fixed in the next release. So either use an earlier version of Calibre or wait until Friday for the next version.

Edit: Here is the other thread.

Last edited by kiwidude; 02-19-2011 at 08:40 PM. Reason: Added link to other thread
kiwidude is offline   Reply With Quote
Advert
Old 02-20-2011, 09:51 AM   #3
Rie142
Member
Rie142 began at the beginning.
 
Posts: 17
Karma: 24
Join Date: Dec 2009
Location: Just outside of Seattle, WA
Device: Kindle2
Quote:
Originally Posted by kiwidude View Post
There is another thread which I saw that error message reported on and Kovid indicating it is a bug that will be fixed in the next release. So either use an earlier version of Calibre or wait until Friday for the next version. Edit: Here is the other thread.
Thanks, In all my searching I missed this thread. I will patiently wait.
Rie142 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Composite Column silentguy Calibre 4 11-24-2010 10:28 AM
Custom column read ? pchrist7 Calibre 2 10-04-2010 02:52 AM
custom column i need a little help shinken Calibre 3 09-15-2010 03:41 AM
Custom Column Problem MSJim Calibre 7 09-08-2010 05:07 PM
custom column not searchable SkyDream Calibre 5 07-26-2010 05:38 AM


All times are GMT -4. The time now is 02:57 AM.


MobileRead.com is a privately owned, operated and funded community.