~ubuntu-branches/debian/wheezy/calibre/wheezy

« back to all changes in this revision

Viewing changes to src/calibre/db/cache.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-02-10 07:35:00 UTC
  • mfrom: (29.4.12 precise)
  • Revision ID: package-import@ubuntu.com-20120210073500-jxakntd7c94wh7rs
Tags: 0.8.38+dfsg-1
* New upstream release.
* debian/control: Bump Standards-Version to 3.9.2. No changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
from calibre.db.locking import create_locks, RecordLock
15
15
from calibre.db.fields import create_field
16
16
from calibre.db.tables import VirtualTable
 
17
from calibre.db.lazy import FormatMetadata, FormatsList
17
18
from calibre.ebooks.metadata.book.base import Metadata
18
19
from calibre.utils.date import now
19
20
 
127
128
        if not formats:
128
129
            good_formats = None
129
130
        else:
130
 
            good_formats = []
131
 
            for f in formats:
132
 
                try:
133
 
                    mi.format_metadata[f] = self._format_metadata(book_id, f)
134
 
                except:
135
 
                    pass
136
 
                else:
137
 
                    good_formats.append(f)
 
131
            mi.format_metadata = FormatMetadata(self, id, formats)
 
132
            good_formats = FormatsList(formats, mi.format_metadata)
138
133
        mi.formats = good_formats
139
134
        mi.has_cover = _('Yes') if self._field_for('cover', book_id,
140
135
                default_value=False) else ''