Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 12-23-2021, 01:48 PM   #1
MerlinMama
Evangelist
MerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beauty
 
MerlinMama's Avatar
 
Posts: 487
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Libra Colour
Search & Replace with current date

I hope someone can help me or direct me to info that can help me (nothing I've found so far has made ANY sense to me).

When I have a new book, I put on the title page "Last Read: N/A" since I haven't read it before. After reading, I have up to six Saved Searches that I run to modify lines in my title page. It would make things quicker (simpler) if I could just add changing N/A to the current date when I run the saved searches, but I can't figure out how to do it. I've spent the past 2 hours (and that's just today's attempt) but I've given up and decided to ask for help.
MerlinMama is offline   Reply With Quote
Old 12-23-2021, 02:05 PM   #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: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Where are you trying to do this?
Title page implies this Q should be moved to Editor (I can do that for you. PM me)
on a per book basis

If you are using a Template: today()
theducks is offline   Reply With Quote
Advert
Old 12-23-2021, 03:15 PM   #3
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: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Check the Editor Help page for REGEX functions (it is one of the Modes on the S&R section)

One of those might help
theducks is offline   Reply With Quote
Old 12-23-2021, 03:25 PM   #4
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: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A

You might consider making a custom version of:
C:\Program Files\Calibre2\app\resources\jacket
And place it in
resources\jacket in the Configuration folder.
That location overrides the Program files version without getting replaced every update.
Then you just Embed Metadata (That updates the Jacket) and not fool around with the Editor
theducks is offline   Reply With Quote
Old 12-23-2021, 03:38 PM   #5
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
Search:
Code:
Last Read: \K(N/A)
mode regex-function
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    from datetime import datetime
    return datetime.now().strftime("%d/%m/%Y")
Change the format to another one to feet your needs, e.g. "%m/%d/%Y" if you prefer US date format, or "%d-%m-%y" if you want 2-digits year and dashes, etc.
lomkiri is offline   Reply With Quote
Advert
Old 12-24-2021, 03:37 PM   #6
MerlinMama
Evangelist
MerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beauty
 
MerlinMama's Avatar
 
Posts: 487
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Libra Colour
Thank you so much @lomkiri. Do you know I tried that exact code several times? But everything I read had:

from datetime import datetime before the def replace... part. No wonder I could not get it to work.

So annoying.

Again, thanks!
MerlinMama is offline   Reply With Quote
Old 12-24-2021, 05:00 PM   #7
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
Very strange that it didn't work for you, because this code is working all right for me
Code:
from datetime import datetime
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    return datetime.now().strftime("%d-%m-%Y")
Maybe the problem was with the search string ?
lomkiri is offline   Reply With Quote
Old 12-24-2021, 05:11 PM   #8
MerlinMama
Evangelist
MerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beauty
 
MerlinMama's Avatar
 
Posts: 487
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Libra Colour
Actually, I just figured it was because I didn't have brackets on my search string. It's the only other thing if the placement doesn't affect it. Of course I was more focussed on figuring out the replace part. It would find it fine, but instead of putting in the date, it would rewrite "%d/%m/%Y"
MerlinMama is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a search&replace ownedbycats Library Management 3 03-08-2021 04:53 PM
Search & Replace changes in 3.0 Phssthpok Editor 4 06-21-2017 04:04 AM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
Search & Replace Help paulfiera Conversion 7 08-06-2015 03:52 AM
Search & Replace :help: krussell Calibre 3 08-02-2011 04:45 PM


All times are GMT -4. The time now is 10:44 AM.


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