mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-22 20:15:06 +01:00
Fix #1260 (Wrong file size display in 0.4.104)
This commit is contained in:
parent
fce9c87251
commit
7931a9d2bd
1 changed files with 2 additions and 8 deletions
|
|
@ -665,11 +665,7 @@ def add_format(self, index, format, stream, index_is_id=False, path=None, notify
|
|||
self.conn.execute('INSERT INTO data (book,format,uncompressed_size,name) VALUES (?,?,?,?)',
|
||||
(id, format.upper(), size, name))
|
||||
self.conn.commit()
|
||||
try:
|
||||
fmts = [f.strip().upper() for f in self.data[self.data.row(id)][FIELD_MAP['formats']].split(',')]
|
||||
except AttributeError:
|
||||
fmts = []
|
||||
self.data.set(id, FIELD_MAP['formats'], ','.join(fmts+[format.upper()]), row_is_id=True)
|
||||
self.refresh_ids([id])
|
||||
if notify:
|
||||
self.notify('metadata', [id])
|
||||
|
||||
|
|
@ -704,9 +700,7 @@ def remove_format(self, index, format, index_is_id=False, notify=True):
|
|||
pass
|
||||
self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format.upper()))
|
||||
self.conn.commit()
|
||||
fmts = [f.strip().upper() for f in self.data[self.data.row(id)][FIELD_MAP['formats']].split(',')]
|
||||
fmts.remove(format.upper())
|
||||
self.data.set(id, FIELD_MAP['formats'], ','.join(fmts), row_is_id=True)
|
||||
self.refresh_ids([id])
|
||||
if notify:
|
||||
self.notify('metadata', [id])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue