mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #1260 (Wrong file size display in 0.4.104)
This commit is contained in:
parent
fce9c87251
commit
7931a9d2bd
@ -665,11 +665,7 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
self.conn.execute('INSERT INTO data (book,format,uncompressed_size,name) VALUES (?,?,?,?)',
|
self.conn.execute('INSERT INTO data (book,format,uncompressed_size,name) VALUES (?,?,?,?)',
|
||||||
(id, format.upper(), size, name))
|
(id, format.upper(), size, name))
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
try:
|
self.refresh_ids([id])
|
||||||
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)
|
|
||||||
if notify:
|
if notify:
|
||||||
self.notify('metadata', [id])
|
self.notify('metadata', [id])
|
||||||
|
|
||||||
@ -704,9 +700,7 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
pass
|
pass
|
||||||
self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format.upper()))
|
self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format.upper()))
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
fmts = [f.strip().upper() for f in self.data[self.data.row(id)][FIELD_MAP['formats']].split(',')]
|
self.refresh_ids([id])
|
||||||
fmts.remove(format.upper())
|
|
||||||
self.data.set(id, FIELD_MAP['formats'], ','.join(fmts), row_is_id=True)
|
|
||||||
if notify:
|
if notify:
|
||||||
self.notify('metadata', [id])
|
self.notify('metadata', [id])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user