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 01-26-2020, 10:31 AM   #1
khonshu
Member
khonshu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jan 2010
Device: Hanlin v3
How to modify calibre text sort algorithm

Hello all.

Most of my books are in spanish and so I have titles with beginning exclamation and question marks (¿ and ¡). I would like to add that symbols to the list of articles to be ignored when sorting text but I'm getting an error.

The items I'm adding are:

u'¿\\s+'),
u'¡\\s+'),

The error is:

calibre, version 4.9.1

Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\tweaks.py", line 535, in apply_tweak
File "<string>", line 93
u'¿\\s+'),
^
SyntaxError: invalid syntax

The arrow points the + symbol after the s.

Of course someone would think of removing such caracters from the title but we are talking about a few thousand books. Any help would be welcome. Thanks.

Last edited by khonshu; 01-26-2020 at 10:35 AM.
khonshu is offline   Reply With Quote
Old 01-26-2020, 10:45 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,031
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
did you add that single ' at the end because it is part of the article? (English only speaker here ) ?
You might need to escape it (removes special meanings):
\'
As to removing anything from any field
Metadata edit Bulk mode (2 or more items selected before entering the MDE), Search and replace tab
backup your metadata.db, you goof, and a lot of data could go south.
Create a practice library of a few COPIES, you can even SAVE the S&R while practicing. It will be available when you switch back to the main Library (assumes both have the same columns involved)
theducks is offline   Reply With Quote
Advert
Old 01-26-2020, 07:50 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by khonshu View Post
Hello all.

Most of my books are in spanish and so I have titles with beginning exclamation and question marks (¿ and ¡). I would like to add that symbols to the list of articles to be ignored when sorting text but I'm getting an error.

The items I'm adding are:

u'¿\\s+'),
u'¡\\s+'),

The error is:

Code:
calibre, version 4.9.1

Traceback (most recent call last):
  File "site-packages\calibre\gui2\preferences\tweaks.py", line 535, in apply_tweak
  File "<string>", line 93
    u'¿\\s+'),
             ^
SyntaxError: invalid syntax
The arrow points the + symbol after the s.

Of course someone would think of removing such caracters from the title but we are talking about a few thousand books. Any help would be welcome. Thanks.
The problem is actually the right parenthesis. The error dialog uses a proportional font, and the characters in the line do not line up properly. I have wrapped the error in code tags to show this.

You should be using just:

Code:
 u'¿\\s+',
 u'¡\\s+',
The last comma is should be OK.
davidfor is offline   Reply With Quote
Old 01-27-2020, 04:13 PM   #4
khonshu
Member
khonshu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jan 2010
Device: Hanlin v3
Solved, thank you! The problem was the closing parenthesis.
khonshu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Author Sort Name Algorithm Tweak phossler Calibre 3 07-05-2018 12:02 PM
Author sort algorithm and accented characters rpspringuel Calibre 8 05-09-2014 04:11 PM
Author Sort Name Algorithm and multiple libraries texasnightowl Calibre 11 06-14-2012 10:34 PM
How can i modify calibre so that it would have a new functionality Naderstouhy Development 2 07-08-2011 02:03 AM


All times are GMT -4. The time now is 05:39 PM.


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