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 06-08-2024, 04:43 AM   #1
Bozana
Bozana
Bozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beauty
 
Bozana's Avatar
 
Posts: 23
Karma: 32224
Join Date: Jan 2013
Device: PC
Question Proper Case Titles

I would love to have a feature that is Propercase, which is every single first letter, is Uppercase, such as a to A or the to The. Titlecase only goes so far, however, I would strongly prefer Propercase. Is there a way I could do this with Regular Expression for titles of books, please?
Bozana is offline   Reply With Quote
Old 06-08-2024, 05:23 AM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Bozana View Post
I would love to have a feature that is Propercase, which is Every Single a First Letter, is Uppercase, such as a to A or the to The. Titlecase only goes so far, however, I would strongly prefer Propercase. Is there a way I could do this with Regular Expression for titles of books, please?
If you are using Windows have a look at AnyCase - Multi-Program Direct In-place Case Converter For Windows

The free version is adequate for most things. For me the big advantage is that can be used just about anywhere - calibre metadata and book editing, file manager, word processors, spread sheets, text editors, etc, etc. Avoids having to remember a dozen different ways to do essentially the same thing in a dozen different programs.

BR
BetterRed is offline   Reply With Quote
Advert
Old 06-08-2024, 09:54 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,559
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Sure use function mode and write a simple function to do that. You can use the builtin case functions as a guide for how to write the function. https://manual.calibre-ebook.com/function_mode.html
kovidgoyal is offline   Reply With Quote
Old 06-08-2024, 11:13 PM   #4
Bozana
Bozana
Bozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beauty
 
Bozana's Avatar
 
Posts: 23
Karma: 32224
Join Date: Jan 2013
Device: PC
Quote:
Originally Posted by BetterRed View Post
If you are using Windows have a look at AnyCase - Multi-Program Direct In-place Case Converter For Windows

The free version is adequate for most things. For me the big advantage is that can be used just about anywhere - calibre metadata and book editing, file manager, word processors, spread sheets, text editors, etc, etc. Avoids having to remember a dozen different ways to do essentially the same thing in a dozen different programs.

BR
Hi!

However, it doesn't do on mass, with over 45k worth of titles in Calibre. I need a regex script that works with Calibre to do it on mass. Anyone has ideas please?

I have Magic File Renamer By Fine Bytes, that is useful but only renames files and nothing to do with Calibre.

Thank you BetterRed for trying xoxoxo
Bozana is offline   Reply With Quote
Old 06-09-2024, 05:15 AM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
The calibre book editor doesn't edit metadata - the way to do what you want is select multiple books in the book list, then Metadata edit->Edit metadata in bulk, viz:

Click image for larger version

Name:	Screenshot 2024-06-09 180304.jpg
Views:	321
Size:	134.8 KB
ID:	208762

BR
BetterRed is offline   Reply With Quote
Advert
Old 06-10-2024, 10:12 AM   #6
Bozana
Bozana
Bozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beauty
 
Bozana's Avatar
 
Posts: 23
Karma: 32224
Join Date: Jan 2013
Device: PC
Quote:
Originally Posted by BetterRed View Post
The calibre book editor doesn't edit metadata - the way to do what you want is select multiple books in the book list, then Metadata edit->Edit metadata in bulk, viz:

Attachment 208762

BR
I'm not looking for title case. I'm looking for Proper Case. Title case leaves the "a" and "the" as lower case etc.., when converted. Whilst, Proper Case makes ALL first letters to Upper case, including "A" and "The" etc..

Title case:

He Lives in Edmonton, but Services all Over the Region, as a Electrican

Proper Case:

He Lives In Edmonton, But Services All Over The Region, As A Electrican


I already know that trick with Title Case that you've showed... I'm chasing Proper Case...

Thank you anyway.
Bozana is offline   Reply With Quote
Old 06-10-2024, 12:41 PM   #7
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Bozana View Post
I'm not looking for title case. I'm looking for Proper Case. Title case leaves the "a" and "the" as lower case etc.., when converted. Whilst, Proper Case makes ALL first letters to Upper case, including "A" and "The" etc..

Title case:

He Lives in Edmonton, but Services all Over the Region, as a Electrican

Proper Case:

He Lives In Edmonton, But Services All Over The Region, As A Electrican


I already know that trick with Title Case that you've showed... I'm chasing Proper Case...

Thank you anyway.
You can do this with Bulk metadata edit / Search & replace using "template" as the source.
  1. Backup your library in case things go pear shaped.
  2. Select all the books you want to change.
  3. Go to Bulk metadata edit, search & replace tab. Make it look like the following:
    Click image for larger version

Name:	Clipboard02.jpg
Views:	350
Size:	134.4 KB
ID:	208788

    The template code is:
    Code:
    python:
    def evaluate(book, context):
    	import re
    	nt = []
    	for w in re.split(r'([ _.()])', book.get('title')):
    		nt.append(w.capitalize())
    	return ''.join(nt)
    The r'([ _.()])' is the list of letters that separate words to be capitalized. This choice may not be the best for your library. You might want to add more letters. You could use r'(\W)', all non-alphabetic letters, but this might do the wrong thing with words like "_aaa" (aaa would not be capitalized) or "a.b" (b would not be capitalized). The choice depends on how much cleanup is required. Personally, I would use r'(\W)' and clean up the odd wrong title.

    If you change the template you can test it on some books using the template editor before running it in Search & replace.
  4. Press OK. Wait. Changing titles requires writing the disk, which can take some time.
  5. Check the results. If they aren't what you want then restore the backup.

EDIT: This template uses the python title() function to "Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase." It does a better job in some cases but suffers from changing words like "isn't" to "Isn'T".
Code:
python:
def evaluate(book, context):
	return book.get('title').title()

Last edited by chaley; 06-10-2024 at 01:12 PM.
chaley is offline   Reply With Quote
Old 06-10-2024, 09:12 PM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Bozana View Post
I'm not looking for title case. I'm looking for Proper Case.
I mistakenly assumed that's what Capitalize case did, but I see it does what is commonly called Sentence case - I normally check these things

Moderator Notice
Moved to Library Management

BR
BetterRed is offline   Reply With Quote
Old 06-10-2024, 11:48 PM   #9
Bozana
Bozana
Bozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beautyBozana does all things with Zen-like beauty
 
Bozana's Avatar
 
Posts: 23
Karma: 32224
Join Date: Jan 2013
Device: PC
Thumbs up

Quote:
Originally Posted by chaley View Post
You can do this with Bulk metadata edit / Search & replace using "template" as the source.
  1. Backup your library in case things go pear shaped.
  2. Select all the books you want to change.
  3. Go to Bulk metadata edit, search & replace tab. Make it look like the following:
    Attachment 208788

    The template code is:
    Code:
    python:
    def evaluate(book, context):
    	import re
    	nt = []
    	for w in re.split(r'([ _.()])', book.get('title')):
    		nt.append(w.capitalize())
    	return ''.join(nt)
    The r'([ _.()])' is the list of letters that separate words to be capitalized. This choice may not be the best for your library. You might want to add more letters. You could use r'(\W)', all non-alphabetic letters, but this might do the wrong thing with words like "_aaa" (aaa would not be capitalized) or "a.b" (b would not be capitalized). The choice depends on how much cleanup is required. Personally, I would use r'(\W)' and clean up the odd wrong title.

    If you change the template you can test it on some books using the template editor before running it in Search & replace.
  4. Press OK. Wait. Changing titles requires writing the disk, which can take some time.
  5. Check the results. If they aren't what you want then restore the backup.

O

EDIT: This template uses the python title() function to "Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase." It does a better job in some cases but suffers from changing words like "isn't" to "Isn'T".
Code:
python:
def evaluate(book, context):
	return book.get('title').title()
Oh my goodness! Thank you so very, very much! This has been bothering me for years! I'm lvl 2 autistic and and old fashioned. I grew up with books that had Proper Case on book covers, in the 70's. So much appricated and I'm beyond grateful! xoxoxo

And yes it works and I'm so happy! You've made my day!
Bozana is offline   Reply With Quote
Old 06-11-2024, 12:45 AM   #10
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,579
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Bozana View Post
I grew up with books that had Proper Case on book covers, in the 70's. So much appricated and I'm beyond grateful! xoxoxo
I just dug back into some of my older books from the 60s and 70s. 6 out of 10 used Title Case though many seemed fonder of Caps and small caps. Very few use Proper Caps. Now to avoid getting sucked into re-reading that box of Ace Doubles.

OTOH, your books and your choice for the titles.
Attached Thumbnails
Click image for larger version

Name:	stranger_in_a_strange_land.jpg
Views:	174
Size:	52.2 KB
ID:	208794  
DNSB is offline   Reply With Quote
Old 08-12-2024, 03:21 PM   #11
E-Book lezer
Member
E-Book lezer began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Aug 2024
Location: Netherlands
Device: Samsung Tablet Galaxy Tab A7 (Cantook)
Quote:
Originally Posted by chaley View Post

The template code is:
Code:
python:
def evaluate(book, context):
	import re
	nt = []
	for w in re.split(r'([ _.()])', book.get('title')):
		nt.append(w.capitalize())
	return ''.join(nt)
The r'([ _.()])' is the list of letters that separate words to be capitalized. This choice may not be the best for your library. You might want to add more letters. You could use r'(\W)', all non-alphabetic letters, but this might do the wrong thing with words like "_aaa" (aaa would not be capitalized) or "a.b" (b would not be capitalized). The choice depends on how much cleanup is required. Personally, I would use r'(\W)' and clean up the odd wrong title.

If you change the template you can test it on some books using the template editor before running it in Search & replace.[*]Press OK. Wait. Changing titles requires writing the disk, which can take some time.[*]Check the results. If they aren't what you want then restore the backup.[/LIST]
EDIT: This template uses the python title() function to "Return a titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase." It does a better job in some cases but suffers from changing words like "isn't" to "Isn'T".
Code:
python:
def evaluate(book, context):
	return book.get('title').title()
Hello, maybe you want to help me too.
I do (I think) exactly what it says and still it gives me the wrong result. What am I doing wrong?
Attached Thumbnails
Click image for larger version

Name:	Hoofdletters hoe het is.jpg
Views:	65
Size:	309.3 KB
ID:	210139   Click image for larger version

Name:	Hoofdletters hoe ik het invul.jpg
Views:	73
Size:	237.6 KB
ID:	210140   Click image for larger version

Name:	Hoofdletters resultaat.jpg
Views:	66
Size:	58.3 KB
ID:	210141  
E-Book lezer is offline   Reply With Quote
Old 08-14-2024, 01:28 PM   #12
E-Book lezer
Member
E-Book lezer began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Aug 2024
Location: Netherlands
Device: Samsung Tablet Galaxy Tab A7 (Cantook)
Anybody else that can help me ?
E-Book lezer is offline   Reply With Quote
Old 08-14-2024, 02:44 PM   #13
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by E-Book lezer View Post
Anybody else that can help me ?
You didn't correctly follow the example. See the attachment.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	70
Size:	64.7 KB
ID:	210179  
chaley is offline   Reply With Quote
Old 08-14-2024, 02:54 PM   #14
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,579
Karma: 157444380
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
One item I noticed when I was looking at this was in that the section under Test text which I was expecting to see the original title shows the modified title. I had renamed the 3 books I was testing with to all lower case. OTOH, if I put text in the test box, it does not appear to be be affected. 'this is a test title' remains all in lower case though that may be expected.
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2024-08-14 105356.png
Views:	62
Size:	67.2 KB
ID:	210182  

Last edited by DNSB; 08-14-2024 at 02:59 PM.
DNSB is offline   Reply With Quote
Old 08-14-2024, 02:58 PM   #15
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,032
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by DNSB View Post
One item I noticed when I was looking at this was in that the results, the section under Test text which I was expecting to see the original title shows the modified title. I had renamed the 3 books I was testing with to all lower case.
It is showing you the text indicated by the "Search field". If the search field is "template" it shows you that, the result of the template. The "Test result" column shows the text after transforms are applied to the search field. When using templates usually there aren't any, but there can be.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
10% Credit Towards Great on Kindle Titles When Purchasing One of Those Titles Manabi Deals and Resources (No Self-Promotion or Affiliate Links) 0 11-01-2019 02:07 AM
my kindle doesn't show proper file name in case of pdfs barteq Devices 1 03-06-2017 11:09 PM
kindle origami voyage case or the leather origami case? want a simple case wakkaday Amazon Kindle 14 10-19-2016 01:56 PM
Sigil Proper Case Setting Themus Sigil 14 04-26-2013 04:47 AM
change book file name from capital letters to proper case tsolignani Library Management 12 03-28-2013 05:16 AM


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


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