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-11-2020, 01:36 AM   #1
Tazling
Member
Tazling began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2020
Device: iPad, Marvin
CLI: can I swap author and title in metadata?

I can do this the hard way, by embedding invocations of ebook-meta in a higher level scripting language like Tcl or whatever. But it would be nice if I could do it with the syntax for ebook-meta command.

I have a whole whack of epubs, obviously formatted by amateurs, in which the author name is in the title metadata field and vice versa. Maybe 60 or more. Really messes up my author-based library index in Marvin . I don't feel like fooling around with a GUI (Calibre) for hours to deal with this problem... by loading all the books and manually editing the fields (gosh, carpal tunnel here we come).

I checked the manpage and have to admit I don't see anything obviously encouraging... But given how incredibly common (and vexing!) this type of problem is, wouldn't it be nice if the command honoured a syntax like

ebook-meta -a -m title -t -m author

(set field Author (-a flag) to Metadata (-m) "Title" field value)

or even

ebook-meta -switch -a -t

I'm probably dreaming here and so am about to go off and write Yet Another Tedious Script to parse the output of ebook-meta, find the relevant fields, and then reissue the command to swap the values. Or maybe parse the filenames and then brute-force the metadata... But it really is quite un-fun, boring coding either way (yaaaawn), and it seems to me (from googling) that this problem is very common indeed, so wouldn't it be nice to be able to juggle the metadata directly using one invocation of ebook-meta, instead of having to extract and then re-set?
Tazling is offline   Reply With Quote
Old 06-11-2020, 01:58 AM   #2
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: 45,260
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Load them all into calibre, select all books with ctrl+a, click edit metadata, select swap title and author, click OK. done.
kovidgoyal is offline   Reply With Quote
Advert
Old 06-11-2020, 04:36 PM   #3
Tazling
Member
Tazling began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2020
Device: iPad, Marvin
thanks for the info

Quote:
Originally Posted by kovidgoyal View Post
Load them all into calibre, select all books with ctrl+a, click edit metadata, select swap title and author, click OK. done.
Wow, bulk editing in Calibre! OK, that's a nice feature that I don't remember from previous use (recently added?).

Still, I really prefer CLI :-). I used Calibre the app just about one time years ago, then discovered the CLI tools and never fired it up again. No offence to the devs, I'm sure it's a cool app and works great, I'm just CLI-oriented. And I do all my e-reading with Marvin on an iPad.

I absolutely love ebook-convert which lets me bulk-convert any number of mobis or pdfs with one command :-). For those who haven't discovered how easy this is:

find . -name '*.mobi' -exec /Applications/calibre.app/Contents/console.app/Contents/MacOS/ebook-convert {} .epub \;

And I wish the metadata swap-2-fields function were available similarly through ebook-meta. In the meantime, just another script. ... even bulk edit in the app won't tempt me to go through all that dragging and clicking :-)
Tazling is offline   Reply With Quote
Old 06-11-2020, 08:08 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: 30,957
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
AFAIK those Bulk edit has been there since at least 1.x
theducks is online now   Reply With Quote
Old 06-14-2020, 04:12 PM   #5
kunkel321
Enthusiast
kunkel321 began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Apr 2016
Location: Near Seattle
Device: Amazon Fire 10
I had a similar question here:
https://www.mobileread.com/forums/sh...=330037&page=2

My "solution"
Quote:
I was going to put together a little AutoHotkey automation script that would quickly run through the series of actions for a swap, but it turns out that it's already so easy I didn't bother... Neither the Individual, nor bulk, MDE have hot keys by default. So I assigned Alt+E to the bulk one.
Now I
1. Manually select one or more books that need Author <-> Title swapped.
2. Hold down Alt and press e, then w.
3. Release Alt and press Enter.

Still it would be slick to have this done programmatically so that the MDE gui didn't have to open.
kunkel321 is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Idea: Swap Title/Author hotkey. kunkel321 Library Management 20 06-05-2020 03:34 PM
cannot figure out, please help: bulk metadata swap numeric mo/yr in title w/ regex anoukaimee Library Management 5 11-07-2019 02:36 AM
Swap Title and Author rorschach Calibre 1 12-21-2013 08:23 AM
Keyboard shortcut - Swap Author and Title pepperleaf Library Management 6 10-21-2012 08:06 AM
Problem with Swap Author & Title. scotmad Calibre 4 02-10-2011 02:24 PM


All times are GMT -4. The time now is 07:47 PM.


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