IGN:Add LCC, LCCN and DDC fields to MetaInformation

This commit is contained in:
Kovid Goyal 2009-04-07 19:58:18 -07:00
parent ceb3378d8c
commit ee8592dd0f
2 changed files with 20 additions and 8 deletions

View File

@ -192,7 +192,7 @@ class MetaInformation(object):
'publisher', 'series', 'series_index', 'rating', 'publisher', 'series', 'series_index', 'rating',
'isbn', 'tags', 'cover_data', 'application_id', 'guide', 'isbn', 'tags', 'cover_data', 'application_id', 'guide',
'manifest', 'spine', 'toc', 'cover', 'language', 'manifest', 'spine', 'toc', 'cover', 'language',
'book_producer', 'timestamp'): 'book_producer', 'timestamp', 'lccn', 'lcc', 'ddc'):
if hasattr(mi, attr): if hasattr(mi, attr):
setattr(ans, attr, getattr(mi, attr)) setattr(ans, attr, getattr(mi, attr))
@ -217,7 +217,7 @@ class MetaInformation(object):
for x in ('author_sort', 'title_sort', 'comments', 'category', 'publisher', for x in ('author_sort', 'title_sort', 'comments', 'category', 'publisher',
'series', 'series_index', 'rating', 'isbn', 'language', 'series', 'series_index', 'rating', 'isbn', 'language',
'application_id', 'manifest', 'toc', 'spine', 'guide', 'cover', 'application_id', 'manifest', 'toc', 'spine', 'guide', 'cover',
'book_producer', 'timestamp' 'book_producer', 'timestamp', 'lccn', 'lcc', 'ddc'
): ):
setattr(self, x, getattr(mi, x, None)) setattr(self, x, getattr(mi, x, None))
@ -236,7 +236,7 @@ class MetaInformation(object):
'publisher', 'series', 'series_index', 'rating', 'publisher', 'series', 'series_index', 'rating',
'isbn', 'application_id', 'manifest', 'spine', 'toc', 'isbn', 'application_id', 'manifest', 'spine', 'toc',
'cover', 'language', 'guide', 'book_producer', 'cover', 'language', 'guide', 'book_producer',
'timestamp'): 'timestamp', 'lccn', 'lcc', 'ddc'):
if hasattr(mi, attr): if hasattr(mi, attr):
val = getattr(mi, attr) val = getattr(mi, attr)
if val is not None: if val is not None:
@ -287,7 +287,13 @@ class MetaInformation(object):
if self.language: if self.language:
ans += u'Language : ' + unicode(self.language) + u'\n' ans += u'Language : ' + unicode(self.language) + u'\n'
if self.timestamp is not None: if self.timestamp is not None:
ans += u'Timestamp : ' + self.timestamp.isoformat(' ') ans += u'Timestamp : ' + self.timestamp.isoformat(' ') + u'\n'
if self.lccn:
ans += u'LCCN : ' + unicode(self.lccn) + u'\n'
if self.lcc:
ans += u'LCC : ' + unicode(self.lcc) + u'\n'
if self.ddc:
ans += u'DDC : ' + unicode(self.ddc) + u'\n'
return ans.strip() return ans.strip()
def to_html(self): def to_html(self):
@ -297,6 +303,12 @@ class MetaInformation(object):
ans += [(_('Producer'), unicode(self.book_producer))] ans += [(_('Producer'), unicode(self.book_producer))]
ans += [(_('Comments'), unicode(self.comments))] ans += [(_('Comments'), unicode(self.comments))]
ans += [('ISBN', unicode(self.isbn))] ans += [('ISBN', unicode(self.isbn))]
if self.lccn:
ans += [('LCCN', unicode(self.lccn))]
if self.lcc:
ans += [('LCC', unicode(self.lcc))]
if self.ddc:
ans += [('DDC', unicode(self.ddc))]
ans += [(_('Tags'), u', '.join([unicode(t) for t in self.tags]))] ans += [(_('Tags'), u', '.join([unicode(t) for t in self.tags]))]
if self.series: if self.series:
ans += [(_('Series'), unicode(self.series)+ ' #%s'%self.format_series_index())] ans += [(_('Series'), unicode(self.series)+ ' #%s'%self.format_series_index())]

View File

@ -59,8 +59,8 @@ class EXTHHeader(object):
pass pass
elif id == 503 and (not title or title == _('Unknown')): elif id == 503 and (not title or title == _('Unknown')):
title = content title = content
#else: else:
# print 'unknown record', id, repr(content) print 'unknown record', id, repr(content)
if title: if title:
self.mi.title = title self.mi.title = title
@ -85,8 +85,8 @@ class EXTHHeader(object):
content, '%Y-%m-%d',).date() content, '%Y-%m-%d',).date()
except: except:
pass pass
#else: else:
# print 'unhandled metadata record', id, repr(content) print 'unhandled metadata record', id, repr(content)
class BookHeader(object): class BookHeader(object):