View Single Post
Old 04-28-2012, 01:21 PM   #1
sdm7g
Junior Member
sdm7g began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2012
Device: kindle,iPhone,iPad
publication_type and dcetype

[ OK: Now that I can get hello_world to work, onto the real problems...]

I'm still learning my way around the calibre code, so I'm not yet sure
where the best place to change things is, or whether some task is best
done in a plugin or in changes to the main code.

I would like to grab the mobi EXTH dcetype field -- specifically to identify
Amazon Kindle samples from actual books. I also see that besides the three
values documented on the wiki ( https://wiki.mobileread.com/wiki/MOBI ):

cdetype: PDOC - Personal Doc; EBOK - ebook; EBSP - ebook sample;

calibre uses another 'MAGZ' for magazines. ( This code may also be used
by Amazon -- I see it in my NewYorker subscriptions, which I get from amazon, as well as others that I download from calibre.)

My first step was just to stick in some lines in ebooks/mobi/reader/headers.py to print the value.

I suppose that I could add a keyword like 'KindleSample' to the tags for that case, but it seems that this kind of classification info would be more generally useful. ( I've seen a thread in one of the other sub-forums asking how to identify Kindle samples, but without a clear answer. )

Since the dcetype code is specific to mobi format, I was wondering if there was a more generic field in the metadata that could hold this info.

In ebooks/metadata/book/__init__.py I see:

# So far only known publication type is periodical:calibre
# If None, means book
'publication_type',

I'm guessing that periodical:calibre maps into the 'MAGZ' code.

Would this be a good place to add additional values to map PDOC & EBSP ?

( Other tips on how to understand and navigate the calibre code & classes is appreciated. I've been following the thread on custom columns, as I suppose the next part is figuring out how to make this value viewable and sortable. )

-- sdm
sdm7g is offline   Reply With Quote