Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/readactivity.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-10-09 11:33:34 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-10-09 13:30:31 (GMT)
commit21af7cc988320c8a53c946253d52fe1bb6ff9a7e (patch)
tree8f3221624253a2d63b790fe6e13f67d3200f8a29 /readactivity.py
parent1d580df1e2498e50cc908a0617dea5134616e309 (diff)
Save the file hash in the metadata to calculate it only one time
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'readactivity.py')
-rw-r--r--readactivity.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/readactivity.py b/readactivity.py
index b8eddce..519251a 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -726,6 +726,7 @@ class ReadActivity(activity.Activity):
self.metadata['Read_search'] = \
self._edit_toolbar._search_entry.props.text
self.metadata['activity'] = self.get_bundle_id()
+ self.metadata['filehash'] = self.filehash
os.link(self._tempfile, file_path)
@@ -871,8 +872,13 @@ class ReadActivity(activity.Activity):
self._view_toolbar.set_view(self._view)
self._edit_toolbar.set_view(self._view)
- filehash = get_md5(filepath)
- self._bookmarkmanager = BookmarkManager(filehash)
+
+ self.filehash = self.metadata.get('filehash', None)
+ if self.filehash is None:
+ self.filehash = get_md5(filepath)
+ logging.error('Calculate hash %s', self.filehash)
+
+ self._bookmarkmanager = BookmarkManager(self.filehash)
self._bookmarkmanager.connect('added_bookmark',
self._added_bookmark_cb)
self._bookmarkmanager.connect('removed_bookmark',