View Single Post
Old 07-20-2011, 04:23 PM   #1
Jesse Chisholm
Enthusiast
Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.Jesse Chisholm actually enjoys Vogon poetry.
 
Jesse Chisholm's Avatar
 
Posts: 27
Karma: 56200
Join Date: Jul 2011
Location: California
Device: none
[Metadata Reader Plugin] Read MP3 audio book metadata

Read MP3 audio book metadata:
This plugin eases the process of managing your Audio Books in Calibre.

Audio Books, if they are long enough, are typically broken up into separate files by chapter, to ease downloading pain over slow connections. Calibre considers each file a separate book in its database. The work-around I've chosen is to put all the chapters of the Audio Book into a Series by the book's actual name, ordered by chapter number.

MP3 files have some metadata internally in ID3 tags. These are extracted and used to populate the metadata for the book as it is added to Calibre. A slightly massaged version of eyeD3-0.6.17 is used to parse these files.

M3U files are playlists of MP3 files. ( Actually, .M3U8, .PLS, .KPL, .RAM all use a sufficiently similar file format, and are also parsed. YMMV ) The MP3 files should be referenced with an absolute URL or path.

M4A and M4B files have metadata internally in MPEG tags. These are extracted and used to populate the metadata for the book as it is added to Calibre. ( Actually, .MP4, .3GP, .3G2, .QT all use the exact same file format, and are also parsed. YMMV ) A slightly massaged version of mp4file-0.2 is used to parse these.

AA and AAX (Audible.com) files have some metadata internally. These are extracted and used to populate the metadata for the book as it is added to Calibre. The Google Code item pyaudibletags is used to parse these files.

Main Features of v1.0.79:
Spoiler:
  • When MP3 files are added to Calibre, the ID3 tags are read and used to fill in as many metadata fields as possible.
  • When M4B or M4A files are added to Calibre, the MPEG-4 tags are read and used to fill in as many metadata fields as possible.
  • When AA or AAX files are added to Calibre, the tags are read and used to fill in as many metadata fields as possible.
  • When M3U or M3U8 files are added to Calibre, the tags in the individual MP3 files are read and used to fill in as many metadata fields as possible.
  • These fields are filled in:
    • title - the Title of this chapter of the book
    • title_sort - set to "chapter. title"
    • series - the title of the Book as a whole
    • series_index - the Chapter number
    • authors - the primary Author(s) of the book
    • publisher - the Publisher of the book
    • tags - the Genre of the book
    • cover - the name of the embedded cover art if it is available.
    • cover_data - the embedded cover art if possible, or a small audio book image if nothing better is available.
    • pubdate - set to the earliest date found in the file; if no more than a year is located, then February 2nd (Groundhog's Day) is arbitrarily chosen.
    • comments - some books have copyright information or longer descriptions embedded. When these are found, they are copied here.

FUTURE THOUGHTS:
Spoiler:

As I read and learn more about Calibre, Python and Audio Book formats, I notice EPUB3:
  • will eventually be part of Calibre
  • will allow sound files as part of an EPUB eBook
  • as of 2011 3rd Quarter is in the final stages of nailing down the specification so implementers won't have to shoot in the dark anymore.
Therefore, I won't be coming out with a new version of the MP3 Metadata Reader until I see what is happening with EPUB3.
This plugin may become unnecessary.

I will instead be looking at the desirability of a tool to bundle a collection of MP3 files into an EPUB3 file that happens to have no text, but is otherwise manageable by Calibre.

Known Issues:
Spoiler:
  • If you add an .M3U file that references an .MP3 file on the web, ( http://some.site/somefile.mp3 ) it will copy the file locally for metadata parsing. If this URL is a streaming URL ( rtsp://some.site/somestream.mp3 ), the copy will never finish, but it will fill your local hard disk.
  • If you try to download metadata (in the Edit Metadata dialog) the search is automatically done by Chapter Title, rather than by Series, so the search fails.
    • A workaround is to temporarily change the Title field to be the Series name, do your metadata search, then change it back.
  • Many Audio Book files do not have an embedded cover art image. (In this case you get the generic audio book image that comes with this plugin.)
  • There are other potentially useful fields in the various file formats that are currently ignored.
  • Sometimes, Calibre ignores what is set to title_sort and replaces it with what it thinks should be there. I suspect this means I have something wrong with the format in those cases.

Special Notes:
  • Requires Calibre v0.7.53 or later.
  • When adding books, you need to change your File Type to look for "All Files" to see the MP3 files.

Installation Steps:
  1. Download the attached zip file and install the plugin/restart Calibre as described in the Introduction to plugins thread.
  2. You should now be able to add Audio Book Files to Calibre. Select all files for a book, or select them individually. (You will need to change File Type to All Files in the Add Books Dialog, or just drag-n-drop them.)

Version History:
Spoiler:

Version 1.0.79: Fixed bug in .mp3 parsing if no Track value.
Contact me if you want one of these older versions.
Version 1.0.77: Add .m3u file parsing.
Version 0.6.75: Removed erroneous .FLV extension inclusion.
Version 0.6.74: Added .mp4 and .aa file parsing. Fixed some .mp3 issues.
Version 0.6.62: Added .m4b and .m4a file parsing.
Version 0.5.1: Renamed to more standard "Read MP3 audio book metadata".
Version 0.5.0: Initial BETA release of AudioBookReader plugin.
Attached Files
File Type: zip AudioBookReader.zip (114.9 KB, 38492 views)

Last edited by Jesse Chisholm; 04-10-2012 at 01:55 PM. Reason: Add thoughts about the Future of this plugin.
Jesse Chisholm is offline   Reply With Quote