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 12-27-2016, 12:04 AM   #1
DMTaylor
Junior Member
DMTaylor began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2016
Device: Android Phone
Question Reading Metadata from OPF file in Zip Archive

I download Audio books from an online service in the .mp3 format. I have a script that scrapes the web page for pertinent meta data and creates a .opf file. I locate the .mp3's, cover.jpg and .opf file in the same directory and then compress them to a .zip archive. When I drop the .zip file into the calibre library, it reads the .opf file stored in the .zip and sets the meta data (title, series, series index, author, publisher, pub date, description) correctly. The problem is that it does not grab the cover.jpg referenced in the .opf and stored in the .zip.

I looked at the way that the .epub format stores the cover and references it in the .opf and tried to mimic that without any success. Does anyone have any experience doing this?
DMTaylor is offline   Reply With Quote
Old 12-27-2016, 03:43 AM   #2
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
I make something similar but not with a zip file (over directory structure). Most common issue for me was taking care on file- and folder names with included spaces and/or special characters.
Divingduck is offline   Reply With Quote
Advert
Old 12-27-2016, 03:50 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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Look at one of the OPF files int he calibre library folder to see how covers are referenced (EPUB's cover handling is much more messy).
kovidgoyal is offline   Reply With Quote
Old 12-27-2016, 03:51 AM   #4
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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Although, I should say that I am not a hundred percent certain that the code for reading metadata from zip files actually tries to read covers.
kovidgoyal is offline   Reply With Quote
Old 12-27-2016, 04:10 AM   #5
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
I just made a test with my test data. If I import a ZIP per drag&drop, normal import etc., the cover didn't import, if I import it via add multiple books via archive it did the job for me.

Maybe @DMTaylor can create a test sample for taking a look on it.

Last edited by Divingduck; 12-27-2016 at 04:12 AM.
Divingduck is offline   Reply With Quote
Advert
Old 12-27-2016, 07:05 AM   #6
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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I took a quick look at the code and as per the function zip_opf_metadata() in metadata/zip.py the cover is read provided there is a reference to it in the opf file, it and the opf file are both in the root of the zip file (not in a subfolder) and the cover is in jpeg/png format.
kovidgoyal is offline   Reply With Quote
Old 01-02-2017, 09:31 AM   #7
DMTaylor
Junior Member
DMTaylor began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2016
Device: Android Phone
Thanks for you reply's

Thank you for your quick reply's. I'm on holiday and have not tested it yet, but it's probably what Kovidgoyal pointed out, that the .jpg needs to be in the root of the .zip and all my audio book archives start at a folder with the book pieces all stored in the folder. Will test when I get back.
Thanks again.
DMTaylor is offline   Reply With Quote
Reply

Tags
audio book, opf, zip


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No metadata.opf file. Why? chaot Library Management 6 06-30-2015 05:48 AM
How to delete/suppress Calibre-specific metadata in .opf file? Doitsu Calibre 1 10-30-2012 06:31 AM
TWO OPF files or something like Media Queries in the OPF file for KF8 and MOBI? DHahn Kindle Formats 3 04-17-2012 04:06 AM
Manually trimming the metadata.opf and toc.ncx file ProDigit ePub 22 04-16-2012 10:01 AM
DR800/DR1000 Website archive browser (website in .ZIP file) luite iRex 44 08-14-2010 12:52 AM


All times are GMT -4. The time now is 12:27 AM.


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