Re: Saving data after each action



2011-02-14 22:42:15 SanskritFritz <sanskritfritz gmail com>:
>I often favorite actions, I use the clipboards plugin, and set
>triggers. The problem is, that Kupfer only saves the session when
>exiting gracefully. Now my logoff method is sadly brutal (working on
>it), so it kills Kupfer on logoff if I forget to exit Kupfer first,
>thus I lose new data that Kupfer has not saved yet. Could it be
>possible to save more often, say, after each action perfomed?

Hello,
IMO saving data after each action is unnecessary. 
You can try attached patch - configuration (learned data and plugin
configuration) is saved when periodic update task is finished. 

Regards,
Karol
From 7f167a1a2bcad920a36b701e9c0db0ecf031f8f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Karol=20B=C4=99dkowski?= <karol bedkowski gmail com>
Date: Sat, 19 Feb 2011 20:39:20 +0100
Subject: [PATCH] core: saving learned data and plugin settings after update campaign finish

---
 kupfer/core/sources.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kupfer/core/sources.py b/kupfer/core/sources.py
index 8471e91..86a861d 100644
--- a/kupfer/core/sources.py
+++ b/kupfer/core/sources.py
@@ -14,6 +14,7 @@ from kupfer import config, pretty, scheduler
 from kupfer import conspickle
 from kupfer.obj import base, sources
 from kupfer.core import pluginload
+from kupfer.core import learn
 
 class PeriodicRescanner (pretty.OutputMixin):
 	"""
@@ -54,6 +55,11 @@ class PeriodicRescanner (pretty.OutputMixin):
 				self._start_source_rescan(next)
 				return
 		# No source to scan found
+		self.output_info("Campaign finished, saving data...")
+		learn.finish()
+		scontr = GetSourceController()
+		scontr.save_data()
+		scontr.finish()
 		self.output_info("Campaign finished, pausing %d s" % self.campaign)
 		self.timer.set(self.campaign, self._new_campaign)
 
-- 
1.7.4.1

Attachment: signature.asc
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]