View Single Post
Old 09-30-2012, 05:45 PM   #1
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 9,273
Karma: 42298328
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
What's my MOBI? (a python tool)

In response to a few requests I've seen for a way to determine exactly what's under the hood of a "mobi" file, I've written a python script that might help. It allows you to select a MOBI, AZW, AZW3, AZW4, PRC file and determine what type of file—exactly—it is. Is it a:

Regular old MOBI?
Or the old, old TEXtREAd format?
Is it a Topaz book?
A Print Replica?
Or maybe it's the shiny new KF8 format?
Or is it both... a hybrid MOBI/KF8 book?

It should just "work" on Linux or OSX since Python with Tkinter comes standard. Windows will of course have to have Python installed. A default ActiveState Python installation should have everything necessary (TKinter) to run it. I haven't verified everything, but I see no reason that it shouldn't work for Python 2.6 or 2.7 (maybe even 2.5, but someone else will have to test that). It's not overly fancy because I wanted it to work "out of the box" without scads of dependencies to be met.

You can select one file, or multiple files (individually) ... or you can query all mobi-type files (MOBI, AZW, AZW3, AZW4, PRC) in a specified folder. It will even search subfolders recursively for mobi-files if you so choose (*NOTE*: it could take quite a while if you tell it to recursively search a HUGE calibre library folder—depending on your hardware ... you've been warned!).

I'm not much for "pretty" output, so someone else will have to put lipstick on it if they want, but have at it! I'm sure someone will be able break it if they try hard.

P.S. For the ultra-conservatives: it makes absolutely no modifications to the ebook files themselves. The program does, however, attempt to create/modify a tiny file on your hard drive. It uses the file to store the last directory opened so it can begin from there the next time you run the program. It's for convenience only and the program should still work if it can't (for whatever reason) create/modify/read that file. You'll just always have to start from the directory where the script lives when selecting files... each time. Full disclosure and all.
Attached Files
File Type: zip WhatsMyMobi.zip (5.2 KB, 170 views)

Last edited by DiapDealer; 10-01-2012 at 08:45 AM.
DiapDealer is offline   Reply With Quote