12-27-2016, 12:04 AM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Dec 2016
Device: Android Phone
|
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? |
12-27-2016, 03:43 AM | #2 |
Wizard
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.
|
Advert | |
|
12-27-2016, 03:50 AM | #3 |
creator of calibre
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).
|
12-27-2016, 03:51 AM | #4 |
creator of calibre
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.
|
12-27-2016, 04:10 AM | #5 |
Wizard
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. |
Advert | |
|
12-27-2016, 07:05 AM | #6 |
creator of calibre
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.
|
01-02-2017, 09:31 AM | #7 |
Junior Member
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. |
Tags |
audio book, opf, zip |
|
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 |