Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 07-24-2011, 06:52 AM   #1
dilo_sec
Member
dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.
 
Posts: 21
Karma: 244219
Join Date: Jul 2011
Device: K3
new exthupdt.py to update title in EXTH header to the filename

I've had need for such a tool for a while now - rather than using a few existing tools to achieve the same thing, but sometimes with unexpected side effects. I wrote this in the last few days...

exthupdt.py is unashamedly based on the code in mobiunpack.py 0.26 - thanks guys, you know who you are!

exthupdt.py simply and quickly updates the title in the EXTH header to the filename (less the extension) so it displays correctly (as I want it to appear) in the Kindle. The title at the end of the EXTH header (referenced in the MOBI header) is also updated. It can also optionally remove the ASIN record in the EXTH record so collection generators, to organise books in Author folders, now work as expected.

Usage: exthupdt.py [options] mobifile

Options:
-h, --help show this help message and exit
-d, --debug to print debug information
-r, --raw to create additional raw data files
-a, --asin to remove the ASIN record from the EXTH section
-t, --title to update the title to the filename (default=True)

the output is a .mobi file, so change the input file extension (e.g. to .m)
example: exthupdt.py --asin inputfile.m

Please report any problems here.

Have fun!
Dilo.
Attached Files
File Type: zip exthupdt.zip (3.2 KB, 420 views)

Last edited by dilo_sec; 07-24-2011 at 08:29 AM. Reason: zip file update
dilo_sec is offline   Reply With Quote
Old 07-24-2011, 03:39 PM   #2
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: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Don't get me wrong... I snag up any free code that helps me gain insight into the manipulation of MOBI files, but why would you want to change the title in the EXTH header to the file name? I'm not quite following.
DiapDealer is offline   Reply With Quote
Advert
Old 07-24-2011, 04:43 PM   #3
dilo_sec
Member
dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.
 
Posts: 21
Karma: 244219
Join Date: Jul 2011
Device: K3
Quote:
Originally Posted by DiapDealer View Post
Don't get me wrong... I snag up any free code that helps me gain insight into the manipulation of MOBI files, but why would you want to change the title in the EXTH header to the file name? I'm not quite following.
I've found it useful to list books ordered by filename, in the order they are read - E.g. In the Isaac Asimov series of Foundation books (listed below by title), which do I read 1st, 2nd, 3rd, etc?

documents\
+ Asimov, Isaac\
. + Forward the Foundation.mobi
. + Foundation & Chaos.mobi
. + Foundation and Earth.mobi
. + Foundation and Empire.mobi
. + Foundation's Edge.mobi
. + Foundation's Fear.mobi
. + Foundation's Friends.mobi
. + Foundation's Triumph.mobi
. + Foundation.mobi
. + Prelude to Foundation.mobi
. + Second Foundation.mobi


So, I rename the books to contain a number prefix to denote the reading order - change the titles in the EXTH header, and my problem is solved.

documents\
+ Asimov, Isaac - Foundation\
. + 01 - Foundation.mobi
. + 02 - Foundation and Empire.mobi
. + 03 - Second Foundation.mobi
. + 04 - Foundation's Edge.mobi
. + 05 - Foundation and Earth.mobi
. + 06 - Prelude to Foundation.mobi
. + 07 - Foundation's Fear.mobi
. + 08 - Forward the Foundation.mobi
. + 09 - Foundation & Chaos.mobi
. + 10 - Foundation's Triumph.mobi
. + 11 - Foundation's Friends.mobi


It's a matter of personal preference - I organise mobi files into folders this way...

Dilo.

Last edited by dilo_sec; 07-24-2011 at 04:45 PM. Reason: extra text removed
dilo_sec is offline   Reply With Quote
Old 07-24-2011, 05:14 PM   #4
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: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks for explaining. I think I understand... you want the order they're listed on the Kindle's home page to match the order the files are listed in when browsing the folder (at the OS level)? Otherwise, you could just put whatever you want in the EXTH header and ignore the filename.

Either way, thanks for sharing the code.
DiapDealer is offline   Reply With Quote
Reply

Tags
mobi, title, update


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EXTH Header Question RecQuery Kindle Formats 1 06-07-2011 02:28 PM
using filename for title pj123 Calibre 1 05-22-2011 06:18 PM
Metadata in Title/filename mezme Calibre 0 08-18-2010 03:08 AM
No Title Header in 0.4.91? nellow Calibre 14 12-15-2008 04:35 PM
exth type, exth data AlexBell Reading and Management 4 07-06-2008 11:51 PM


All times are GMT -4. The time now is 02:20 AM.


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