View Full Version : audio books in calibre


Philosopher
01-04-2011, 06:15 AM
Here is a thought/idea. Although not as simple as at first it seems.

I would love it if I could use calibre to also catalog my audio books. They are part of my book library after all - not just my music library. And many ebooks I also have in audio form as well.

Now here is the catch. First - I would not want calibre to store the audio book in the directory it creates - but a link/shortcut to it would be great.

It seems that it would be best to keep audio books associated with other audio files in another directory - given the needs of the player.

Although that brings up a second issue - althought to me a secondary one - having calibre integrated with an audio program so that you could tell it to play the book from calibre. But that I think would be a bit more complicated.

On a side note there is also the issue of ebooks, particularly pdfs, that are associated with audio or video files. I have a lot of music books with the music files to go with the sheet music or lesson. Most of the time I have these embedded in the pdf - but not always (and what if its not a pdf).

It would be good to have a way to have a link to a directory where related files are stored. Maybe that is also the solution for the above - just allowing the database to store the file/directory location in a field - and so you could click on that and get to the files.

In fact I have been torn in some cases - such as with course guuides for video courses or audio courses - of putting the guide in calibre - because of losing it in the directory where the relevant files are. Sure I could know to search calibre for it - but would have to create some kind of file to tell me there was one. Or I could put a link to the file in the calibre library - but that is always changing (at least for some time). Or I could keep two copies - but taht seems wasteful.

Couldn't there be a way to browse and input a directory into a field.

Also a side side note - :offtopic: anyone know how to show the isbn in a column?

Manichean
01-04-2011, 06:36 AM
Couldn't there be a way to browse and input a directory into a field.
Use a custom text column and paste the path into it.

Also a side side note - :offtopic: anyone know how to show the isbn in a column?
Create a new custom column "from other columns" and set {ISBN} as template.

DoctorOhh
01-04-2011, 07:56 AM
The below won't solve your problem, but you might be able to put the info to good use.

In fact I have been torn in some cases - such as with course guuides for video courses or audio courses - of putting the guide in calibre - because of losing it in the directory where the relevant files are. Sure I could know to search calibre for it - but would have to create some kind of file to tell me there was one. Or I could put a link to the file in the calibre library - but that is always changing (at least for some time). Or I could keep two copies - but taht seems wasteful.

Couldn't there be a way to browse and input a directory into a field.

If you look at the book details window you will see Path: Click to open Hovering over it will tell you the path to the directory in a tooltip. Clicking this link will open the directory where that book is stored (see attached).

There is no reason you can't place the associated files for a ebook in that directory. Also using the "Open with" GUI plugin (http://www.mobileread.com/forums/showpost.php?p=1283662&postcount=119) you can set up a right click that will allow you to open that book in an external program (see attached for how my plugin is setup).

I know this seems backwards for Video courses but some books come with small linked multimedia files and the linking works easier with the associated file(s) in the same directory.

Just some thoughts. Since I haven't had the need to try this it might be rubbish. :)

chaley
01-04-2011, 08:26 AM
If there is a plugin writer out there who wants to take this on ...

The newly-added per-book custom data facility could be used by a plugin to associate a path or paths with a book. The plugin could ask for the path if one is not defined, and open an explorer on that path if it is defined. I could even see it supporting specific file types and opening those files using the system-defined program.

Another thought would be to associate specific objects instead of a path. I am imagining opening the plugin, then dragging objects onto it. The plugin would record the pathnames. Other plugin operations could open the containing folder or (as above) open the file with the system-defined program.

theducks
01-04-2011, 12:12 PM
The below won't solve your problem, but you might be able to put the info to good use.



If you look at the book details window you will see Path: Click to open Hovering over it will tell you the path to the directory in a tooltip. Clicking this link will open the directory where that book is stored (see attached).

There is no reason you can't place the associated files for a ebook in that directory. Also using the "Open with" GUI plugin (http://www.mobileread.com/forums/showpost.php?p=1283662&postcount=119) you can set up a right click that will allow you to open that book in an external program (see attached for how my plugin is setup).

I know this seems backwards for Video courses but some books come with small linked multimedia files and the linking works easier with the associated file(s) in the same directory.

Just some thoughts. Since I haven't had the need to try this it might be rubbish. :)
the Library Check functions will flag unexpected 'Problem' files :rolleyes:

DoctorOhh
01-04-2011, 10:53 PM
the Library Check functions will flag unexpected 'Problem' files :rolleyes:

The Library Check function will flag unexpected files. This is not the same as problem files. Library check doesn't know one way or another if the unexpected file is a problem or not.

What I don't know is what will happen if you run a Database Integrity check with extra files hanging around.

kovidgoyal
01-05-2011, 12:34 AM
db integrity check does not delete files, it only removes format entries from the database if the file in the corresponding format was not found in the library. Similarly it updates the has_cover column in the database if the cover was not found in the library.

The main function of db integrity check is to check the integrity of the actual metadata.db file and recover from simple errors. It does this by dumping the file to SQL and re-creating it.

Philosopher
01-05-2011, 03:27 PM
I'll take a look at that as a workaround. My question though is if I put the files in that directory - if I rename the book - what happens to those files when calibre moves the book files to a new directory?

Philosopher
01-05-2011, 03:28 PM
I'll take a look at that as a workaround. My question though is if I put the files in that directory - if I rename the book - what happens to those files when calibre moves the book files to a new directory? :chinscratch:

chaley
01-05-2011, 04:02 PM
Everything in the directory will be moved.

desk99
01-05-2011, 07:23 PM
I tried this with a couple of movies. I wanted to be able to download them to my nookcolor. The file was searchable but when i clicked on it the server went crazy and i had to restard calibre

Jesse Chisholm
07-20-2011, 01:32 AM
@Philosopher, are you still looking for an AudioBook plugin?
The idea sounded interesting to me, and so I threw together a Metadata Reader for AudioBooks in the .MP3 format. Very limited for .M4B format.

@Kovid, It is up at http://www.mobileread.com/forums/showthread.php?p=1667632

It is still version 0.5.0, so has a ways to go.
1: multiple files are still separate "books", but are put in the same series together.
2: still having issues getting the cover image out of the .MP3 file (if present at all).
3: still having issues setting the mi.pubdate and mi.title_sort.
4: no way (yet) to send a books playlist of all chapters to an audio player. ;-)
If you "open" a single book and it will probably play in your OS's normal way.
5: does not write modified metadata back to the MP3 file. it is a Reader plugin.

PS: The default book cover, if I can't find anything else, is a small PNG. I tried to use an SVG, but it didn't display properly. It looks like total or partial transparency is failing on both SVG and PNG. (in calibre 0.8.10 on Windows-7). Both files are in the zip.

-Jesse

kovidgoyal
07-20-2011, 01:37 AM
You might want to post this in the plugins sub forum, that way it will become available to calibre users to install via the get new plugins button.

Jesse Chisholm
07-20-2011, 06:03 PM
@kovid, Done! the new thread under plugins is:
http://www.mobileread.com/forums/showthread.php?p=1667632

And I sent a message to kiwidude about adding it in the sticky list.

Thanks.

-Jesse

Jesse Chisholm
07-22-2011, 11:14 AM
I am in conversation with kiwidude about steps I need to take to make it easier to add this new plugin.

I've conformed my "plugin announcement post" more toward the standard style.
http://www.mobileread.com/forums/showthread.php?p=1667632


-Jesse

shentar
07-24-2011, 10:57 AM
Oddly, I had this same idea today. So I tried it.

I used Add Books to add an mp3. It added OK (I had to use the All File filter in the add dialog to see it). The only problem was that the Author and Title fields were inverted - probably because of the directory structure it came from. I was able to add tags and a genre to it and move it between libraries. Double clicking on the entry fired up vlc to play it back.

So as far as I can see Calibre is almost there as an audiobook manager. AFAICS we would need two things (three if you don't want to copy the files into your Calibre library):

1. A filter in add-dialog to add audio file formats.
2. A way to associate multiple files as a single "book" (many audiobooks come as multiple mp3s)
3. An add-as-link option for adding files.

Item (1) should be trivial.
Item (3) would be, I think, trivial on linux but I have no idea how difficult it would be on windows (shortcuts do not really replace symbolic links).
Item (2) is the major problem. Effectively each audiobook would need to have something like a playlist associated with it. Working on the playlist - which could be autogenerated during the add-book operation or manually generated later - would apply the same operation to all files in the audiobook. This would include move/delete/tag/set genre. By default you would probably want to hide the individual part files (some of my audiobooks contain several hundred short mp3 files to cope with the problem of restarting part way through a book).

Thinking about it, rather than beat calibre into shape to do something it wasn't originally designed to do, I'd be quite happy to have another custom metadata field (like genre) which simply gave a path to an associated audio-book directory. Double clicking on the tag would open the file manager on that directory and after that I could proceed using my normal audio tools. Maybe that is something which could be added via a plug-in?

itimpi
07-24-2011, 11:06 AM
2. A way to associate multiple files as a single "book" (many audiobooks come as multiple mp3s)

You can already do this if you create a rar archive to hold all the files making up the audiobook.

However as audiobooks are so much larger than ebooks, I prefer to keep them separate to my ebook library.

shentar
07-24-2011, 11:53 AM
You can already do this if you create a rar archive to hold all the files making up the audiobook.

However as audiobooks are so much larger than ebooks, I prefer to keep them separate to my ebook library.

True - I just tried this (using a zip file) and double clicking in calibre opens the archive from whence I can play the files. However, as you say this means that I would have to put large audiofiles into calibre which is undesirable.

So I created a vlc playlist, which is basically just an xml file, and added that to calibre. Double clicking fired up vlc for me and the .xspf file is small enough that I'm not too concerned about it being duplicated. For the sake of purity I would prefer it was a link - and I could probably arrange that manually on linux - but it is not a major issue.

So for me that is job done. I can now see from calibre whether I have an audio version of my book and even fire it up, but without having to duplicate the audio files which would normally reside in my squeezebox audio libraries.

Thanks itimpi for the nudge which gave me the facility I was looking for without me having to do any significant work!

itimpi
07-24-2011, 01:06 PM
Thanks itimpi for the nudge which gave me the facility I was looking for without me having to do any significant work!
No problem!

I might steal your idea of storing the playlist in Calibre :bulb2: As I keep all my audiobooks on a Drobo FS NAS box it should also work OK for me.

Jesse Chisholm
07-25-2011, 04:26 PM
I uploaded a new version (0.6.62) of my audio book metadata reader program.
This handles M4B and M4A files pretty well. Also I restructured the code to be more modular.

see: http://www.mobileread.com/forums/sho....php?p=1667632

-Jesse

Jesse Chisholm
01-05-2012, 08:08 PM
Per various requests, I've done an upgrade of the AudioBookReader plugin (v 1.0.77) which adds these features:

* : can also read .M3U playlist files
also: .M3U8, .PLS, .KPL, .RAM
as these have a sufficiently similar file format

* : individual files referenced by the .M3U file are parsed for metadata
and these are merged for the final metadata returned to calibre.

* : referenced .M3U files are NOT copied into the calibre DB
only the .M3U file is copied into the calibre DB

CAVEATS:
* : local files referenced in the .M3U file should have absolute paths.
since the .m3u file is copied, relative paths are broken.

* : on-line files referenced in the .M3U file will be temporarily
downloaded and copied so that metadata can be parsed from the file.

* : on-line files referenced in the .M3U file should use http: protocol.
the rtsp: protocol is for streaming. trying to download a stream
will never end (until your local hard disk is full).

I have pinged kiwidude, so the automatic pages will be updated in due process.

-Jesse

Pinecone
01-08-2012, 11:18 AM
Now to add video file capability. :)

So I can store and tag and sort video files.

Jesse Chisholm
01-13-2012, 01:57 AM
@Pinecone,
Well, ... technically, ... now that you mention it, ... you can already.
If you don't mind the caveats.

1: like MP3 files the MP4 and FLV files do not show up in the Add Files list unless you set the File Type filter to All Files.

2: like MP3 files the MP4 and FLV file will be copied into the Calibre Database.

So, if you don't mind the duplicate file in the file system, then go for it.

3: like MP3 files, MP4 files can be put into an M3U file.
[ the spec doesn't say so, but Media Player doesn't mind at all ]
Then you get the management without the duplication.
But you better not move / delete / rename the file, or the M3U is broken.

3.5: M3U files for Calibre use _must_ use absolute paths or URLs.

The reason this works is that many file formats use the same tagging structure internally. Many Audio Books formats are just special cases of Audio Video Files formats. (same structure but without the video stream).

The AudioBookReader plugin can actually read metadata from file four different file formats:
* MP3
* M4B, M4A, MP4, 3GP, 3G2, QT
* AA, AAX
* F4B, F4A, FLV
and three variations of the play list file format:
* M3U, M3U8, RAM
* PLS
* KPL.

-Jesse

buster123
12-01-2012, 10:16 AM
Jesse - many thanks for all the hard work! :)

I just installed your plugin and the second book I tried to add seems to have broken the importer. The book - Atlas Shrugged - is huge consisting of 1208 mp3 files. I've attached the .m3u file (renamed .txt to meet this board's attachment criteria). Any ideas?

buster

buster123
12-06-2012, 03:08 PM
Jesse - many thanks for all the hard work! :)

I just installed your plugin and the second book I tried to add seems to have broken the importer.

buster

I was able to work around this and complete my audiobook to phone exporter. Thanks again for the plug-in

Jesse Chisholm
12-07-2012, 09:32 AM
@buster123 - Glad you found a workaround. :)

I see from your mp3tag.txt file (the renamed mp3tag.m3u file) that your files are stored on a Windows style network drive: \\machine\share\path\file.mp3

Naturally, that is a use-case I did not test. :(

I'll need to set up such a network shared directory so I can test what happens in the code with this kind of path.

-Jesse

buster123
12-14-2012, 10:47 AM
@buster123 - Glad you found a workaround. :)

I'll need to set up such a network shared directory so I can test what happens in the code with this kind of path
-Jesse

The net drive works fine for 50 abooks in calibre to date. Atlas Shrugged was the only problem and in that case I just created an m3u from a single mp3 for calibre import and then replaced it in calibre's file location with a full m3u needed for playback locally and on my phone. Works great.

thanks again :)

Jesse Chisholm
12-24-2012, 11:11 AM
@buster123: I just created an m3u from a single mp3 for calibre import and then replaced it in calibre's file location with a full m3u needed for playback locally and on my phone. Works great.

Excellent!

Likely the metadata in the plethora of files for Atlas Shrugged is redundant anyway. The bulk of the unique information is all going to be in the first file.

Hmm. Perhaps I should see about an options GUI page for the aBook import to set default behavior to either scan all files or only one file in an m3u to get metadata. Hmm.
;-D

-Jesse