2 new commits in StationPlaylist:
https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/27b82f7aa751/
Changeset: 27b82f7aa751
Branch: None
User: josephsl
Date: 2016-01-12 07:36:23+00:00
Summary: Config cache (7.0-dev): Time-based profile switching and update
check dictionaries are now cached to reduce unnecessary disk writes.
For profile triggers, a separate cache dictionary will be employed (same
strategy as normal profile). For update checks, module-level variables will be
compared against values stored in update check state dictionary (same idea as
config cache).
Affected #: 2 files
diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index 5d456cc..a194ca9 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -327,6 +327,7 @@ def _cacheConfig(conf):
# Each record (profile name) consists of seven fields organized as a list:
# A bit vector specifying which days should this profile be active, the first
five fields needed for constructing a datetime.datetime object used to look up
when to trigger this profile, and an integer specifying the duration in minutes.
profileTriggers = {} # Using a pickle is quite elegant.
+profileTriggers2 = {} # For caching purposes.
# Profile triggers pickle.
SPLTriggersFile = os.path.join(globalVars.appArgs.configPath,
"spltriggers.pickle")
# Trigger timer.
@@ -334,11 +335,13 @@ triggerTimer = None
# Prepare the triggers dictionary and other runtime support.
def initProfileTriggers():
- global profileTriggers, SPLTriggerProfile, triggerTimer
+ global profileTriggers, profileTriggers2, SPLTriggerProfile,
triggerTimer
try:
profileTriggers = cPickle.load(file(SPLTriggersFile, "r"))
except IOError:
pass
+ # Cache profile triggers, used to compare the runtime dictionary
against the cache.
+ profileTriggers2 = profileTriggers
triggerStart()
# Locate time-based profiles if any.
@@ -447,12 +450,16 @@ def triggerStart(restart=False):
# Dump profile triggers pickle away.
def saveProfileTriggers():
- global triggerTimer, profileTriggers
+ global triggerTimer, profileTriggers, profileTriggers2
if triggerTimer is not None and triggerTimer.IsRunning():
triggerTimer.Stop()
triggerTimer = None
- cPickle.dump(profileTriggers, file(SPLTriggersFile, "wb"))
+ # Unless it is a daily show, profile triggers would not have been
modified.
+ # This trick is employed in order to reduce unnecessary disk writes.
+ if profileTriggers != profileTriggers2:
+ cPickle.dump(profileTriggers, file(SPLTriggersFile, "wb"))
profileTriggers = None
+ profileTriggers2 = None
# Instant profile switch helpers.
# A number of helper functions assisting instant switch profile routine and
others, including sorting and locating the needed profile upon request.
diff --git a/addon/appModules/splstudio/splupdate.py
b/addon/appModules/splstudio/splupdate.py
index 28718da..83cdf9e 100755
--- a/addon/appModules/splstudio/splupdate.py
+++ b/addon/appModules/splstudio/splupdate.py
@@ -45,13 +45,17 @@ def initialize():
SPLAddonCheck = SPLAddonState["PDT"]
SPLAddonSize = SPLAddonState["PSZ"]
except IOError:
- pass
+ SPLAddonState["PDT"] = 0
+ SPLAddonState["PSZ"] = 0x0
def terminate():
global SPLAddonState
- SPLAddonState["PSZ"] = SPLAddonSize
- SPLAddonState["PDT"] = SPLAddonCheck
- cPickle.dump(SPLAddonState, file(_updatePickle, "wb"))
+ # Store new values if it is absolutely required.
+ stateChanged = SPLAddonState["PSZ"] != SPLAddonSize or
SPLAddonState["PDT"] != SPLAddonCheck
+ if stateChanged:
+ SPLAddonState["PSZ"] = SPLAddonSize
+ SPLAddonState["PDT"] = SPLAddonCheck
+ cPickle.dump(SPLAddonState, file(_updatePickle, "wb"))
SPLAddonState = None
https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/7d5e158dcc3c/
Changeset: 7d5e158dcc3c
Branch: master
User: josephsl
Date: 2016-01-12 08:44:25+00:00
Summary: Officially deprecate playlist remainder option in add-on 7.0 (to
be removed completely in add-on 7.2 in summer 2016).
Affected #: 2 files
diff --git a/addon/appModules/splstudio/splconfig.py
b/addon/appModules/splstudio/splconfig.py
index a194ca9..76ac9ad 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -53,7 +53,6 @@ SayPlayingCartName = boolean(default=true)
SayPlayingTrackName = string(default="True")
SPLConPassthrough = boolean(default=false)
CompatibilityLayer = option("off", "jfw", "wineyes", default="off")
-PlaylistRemainder = option("hour", "playlist", default="hour")
AutoUpdateCheck = boolean(default=true)
"""), encoding="UTF-8", list_values=False)
confspec.newlines = "\r\n"
@@ -90,7 +89,6 @@ SayPlayingTrackName = string(default="True")
[Advanced]
SPLConPassthrough = boolean(default=false)
CompatibilityLayer = option("off", "jfw", "wineyes", default="off")
-PlaylistRemainder = option("hour", "playlist", default="hour")
[Update]
AutoUpdateCheck = boolean(default=true)
"""), encoding="UTF-8", list_values=False)
@@ -539,6 +537,8 @@ def _preSave(conf):
del conf["InstantProfile"]
except KeyError:
pass
+ # Todo for 7.2: Remove obsolete keys from normal profile (not
runtime config yet).
+ # Del PlaylistRemainder.
# For other profiles, remove global settings before writing to disk.
else:
# 6.1: Make sure column order and inclusion aren't same as
default values.
@@ -1066,7 +1066,6 @@ class SPLConfigDialog(gui.SettingsDialog):
item.Bind(wx.EVT_BUTTON, self.onAdvancedOptions)
self.splConPassthrough =
SPLConfig["Advanced"]["SPLConPassthrough"]
self.compLayer = SPLConfig["Advanced"]["CompatibilityLayer"]
- self.playlistRemainder =
SPLConfig["Advanced"]["PlaylistRemainder"]
self.autoUpdateCheck = SPLConfig["Update"]["AutoUpdateCheck"]
settingsSizer.Add(item)
diff --git a/addon/installTasks.py b/addon/installTasks.py
index 59a6eaf..a6775ca 100755
--- a/addon/installTasks.py
+++ b/addon/installTasks.py
@@ -1,5 +1,5 @@
# StationPlaylist Studio add-on installation tasks
-# Copyright 2015 Joseph Lee and others, released under GPL.
+# Copyright 2015-2016 Joseph Lee and others, released under GPL.
# Provides needed routines during add-on installation and removal.
# Routines are partly based on other add-ons, particularly Place Markers by
Noelia Martinez (thanks add-on authors).
@@ -40,7 +40,6 @@ SayPlayingCartName = boolean(default=true)
SayPlayingTrackName = string(default="True")
SPLConPassthrough = boolean(default=false)
CompatibilityLayer = option("off", "jfw", "wineyes", default="off")
-PlaylistRemainder = option("hour", "playlist", default="hour")
AutoUpdateCheck = boolean(default=true)
"""), encoding="UTF-8", list_values=False)
confspec.newlines = "\r\n"
@@ -71,7 +70,6 @@ _conversionConfig = {
"SayPlayingTrackName":"SayStatus",
"SPLConPassthrough":"Advanced",
"CompatibilityLayer":"Advanced",
- "PlaylistRemainder":"Advanced",
"AutoUpdateCheck":"Update",
}
Repository URL: https://bitbucket.org/nvdaaddonteam/stationplaylist/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.