From 17b1cb5115103540136c035c089a967dc6a1095c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 21 Jul 2013 17:31:14 +0530 Subject: [PATCH] Fix remove_formats() not actually removing the files --- src/calibre/db/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index e6174015c5..a669b7017b 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -1146,8 +1146,6 @@ class Cache(object): def remove_formats(self, formats_map, db_only=False): table = self.fields['formats'].table formats_map = {book_id:frozenset((f or '').upper() for f in fmts) for book_id, fmts in formats_map.iteritems()} - size_map = table.remove_formats(formats_map, self.backend) - self.fields['size'].table.update_sizes(size_map) for book_id, fmts in formats_map.iteritems(): for fmt in fmts: @@ -1167,6 +1165,8 @@ class Cache(object): if name and path: self.backend.remove_format(book_id, fmt, name, path) + size_map = table.remove_formats(formats_map, self.backend) + self.fields['size'].table.update_sizes(size_map) self._update_last_modified(tuple(formats_map.iterkeys())) @read_api