Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-16-2019, 05:53 AM   #1
BlindBandit
Junior Member
BlindBandit began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2019
Device: iPhone SE
Guide: Removing iTunes metadata from ePub

I recently came across a problem when adding my ebook collection to my iPhone via iTunes and thought the knowledge I gained finding a solution might be useful for others.

I used a program called calibre to edit an ePub's metadata (title and author) and then added it to iTunes to copy onto my iPhone. But when I did, iTunes was still using the old metadata with the old title and author, not the new ones.

After a lot of digging (and this useful post) I managed to figure out why. ePubs are an archive with a bunch of smaller files inside of it, including one file called content.opf that contains the metadata. When an ePub is added to iTunes, it doesn't read its metadata from content.opf; it reads it from another file, iTunesMetadata.plist. If the iTunesMetadata.plist file doesn't exist, iTunes will create one based off content.opf and put it inside the original ePub.

That means when you first add an ePub to iTunes, its metadata will match properly because iTunesMetadata.plist is being created for the first time using the up-to-date metadata... but if you ever change the ePub's metadata, you'll only be changing content.opf and iTunes will continue to use the old, unchanged metadata from iTunesMetadata.plist.

The solution is to use rar or zip or some other archive program to delete the iTunesMetadata.plist file inside the .epub file before adding the ePub to iTunes. If you do that, iTunes will be forced to create a new iTunesMetadata.plist file with the latest metadata.

But if you're like me and have a huge library, doing this manually for every file would take a long time. So I wrote a Windows batch script (included below) to quicken the process. I've gotten into the habit of running this script every time before I add new ebooks to iTunes and it has saved me a lot of headaches.

To run it, you'll need to download zip.exe (I got it from here, but there's plenty of other places to get it) and save it somewhere on your computer.

Then create a .bat batch file with this text inside:

Code:
FOR /R "C:\Users\Jordan\Calibre Library" %%G IN (*.epub) DO "C:\CommandLineTools\zip.exe" -d "%%G" iTunesMetadata.plist
PAUSE
Note: If you're running this from the command line using the cmd.exe command prompt instead of running it from a .bat batch script, replace the %%G parts with %G.

"C:\Users\Jordan\Calibre Library" is the location of my ePub collection, and "C:\CommandLineTools\zip.exe" is the location of my zip.exe (as explained above). Change these path locations to match wherever your ePub collection and zip.exe are located.

Hope this helps someone
BlindBandit is offline   Reply With Quote
Old 07-16-2019, 08:13 AM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,470
Karma: 84000001
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
The Modify ePub plugin for calibre will also remove the iTunesMetadata.plist file from one or more books when the "Remove iTunes files" option is selected.
jhowell is offline   Reply With Quote
Advert
Old 07-16-2019, 12:21 PM   #3
BlindBandit
Junior Member
BlindBandit began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2019
Device: iPhone SE
> The Modify ePub plugin for calibre will also remove the iTunesMetadata.plist file from one or more books when the "Remove iTunes files" option is selected.

... Ohh my God ...

I spent a few hours trying to figure out why it was happening, and then about an hour figuring out how to automate it.

And there's a plugin that does it in under a second.

Euuurrrrrggghh.

Thank you for telling me about this though

Do you know if there's a way to automatically run the Modify ePub plugin every time you save to disk?
BlindBandit is offline   Reply With Quote
Old 07-16-2019, 03:22 PM   #4
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,583
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by BlindBandit View Post
... When an ePub is added to iTunes, it doesn't read its metadata from content.opf; it reads it from another file, iTunesMetadata.plist. If the iTunesMetadata.plist file doesn't exist, iTunes will create one based off content.opf and put it inside the original ePub. [emphasis added]
Omigod

I don't use iTunes or iBooks for reading ebooks, but I'm always curious about these things.

On iTunes 12.8.2.3, it won't accept ebooks/epubs (at least not in a way I could figure out). When I copied an epub over to iBooks 1.15, the original epub file did not appear to be altered.

Where is this iTunesMetadata.plist file? Is it an invisible/hidden file? When I unzipped the original epub after copying it over to iBooks, it was unchanged as far as I can tell.

Thanks for any enlightenment
odamizu is offline   Reply With Quote
Old 07-16-2019, 07:22 PM   #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: 20,457
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by BlindBandit View Post
Do you know if there's a way to automatically run the Modify ePub plugin every time you save to disk?
Short Answer - there is no way.

Modify EPUB can be run from the command line - instructions are in first post, and you can save to disk with the calibredb export command.

Or almost everything in calibre can be given a keyboard shortcut. I use Alt+M for Modify, and S for Save to Disk (I think that the default shortcut) - so I would press Alt+M, Enter, S. If I wanted to further automate I'd do it with AHK on Windows, on a Mac you could probably do it with Automator.

BR
BetterRed is offline   Reply With Quote
Advert
Old 07-18-2019, 10:56 AM   #6
BlindBandit
Junior Member
BlindBandit began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2019
Device: iPhone SE
Quote:
Originally Posted by odamizu View Post
Where is this iTunesMetadata.plist file?
I don't know if you call it the root directory or parent directory or whatever. But it should just be in the top-level location when you open the ePub.

Quote:
Originally Posted by odamizu View Post
Is it an invisible/hidden file?
No.

Quote:
Originally Posted by odamizu View Post
When I unzipped the original epub after copying it over to iBooks, it was unchanged as far as I can tell.
Maybe iBooks doesn't add iTunesMetadata.plist, maybe only iTunes does it. I use iTunes version 12.7.1.14 and I'm able to add eBooks to my iPhone using iTunes just fine.
BlindBandit is offline   Reply With Quote
Old 07-19-2019, 01:16 AM   #7
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,583
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Thanks BlindBandit. As far as I can tell, iTunes 12.8 does not accept epubs and iBooks doesn't add the iTunesMetadata.plist to the original epub, but it does add it to the iBooks version.
odamizu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Kindle User's Guide ben_hud Amazon Kindle 17 05-17-2019 02:51 PM
Free (nook/Kindle/iTunes/ePub) On Earth as It Is in Heaven [Xtian Prayer Guide] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 0 03-25-2015 02:00 PM
Free (nook/Kindle/iTunes/ePub) Woman's Guide to Overcoming Depression [Xtian Advice] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 1 02-25-2015 06:51 PM
Free (nook/Kindle/iTunes/ePub) Living the Lord's Prayer [Xtian Study Guide & Advice] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 1 01-31-2015 06:43 PM
Free (nook/Kindle/iTunes/ePub) Pure Eyes: A Man's Guide… [Xtian Sexual Rehab Advice] ATDrake Deals and Resources (No Self-Promotion or Affiliate Links) 0 11-07-2014 01:53 AM


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


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