commit/StationPlaylist: josephsl: 7.0-dev: 5.x config are now removed from runtime config dictionary and are no longer present in install tasks.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Tue, 26 Jan 2016 17:35:35 -0000

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/29c584905e7f/
Changeset:   29c584905e7f
Branch:      7.0/indigoGoodbye50
User:        josephsl
Date:        2016-01-26 17:35:17+00:00
Summary:     7.0-dev: 5.x config are now removed from runtime config dictionary 
and are no longer present in install tasks.

Because the only required argument for creating ConfigObj is path, just use 
that instead of using the power of configspec. This reduces install tasks file 
size considerably.
Also, at runtime, 5.x config keys will be unavailable (to reduce memory usage). 
Also, playlist remainder key is removed during caching operation to further 
disconnect from 5.x config.
This is destined for add-on 7.0 due to config format differences.

Affected #:  2 files

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index e8fb44f..d487425 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -277,10 +277,12 @@ def _cacheConfig(conf):
        if _SPLCache is None: _SPLCache = {}
        key = None if conf.filename == SPLIni else conf.name
        _SPLCache[key] = {}
-       # Optimization: For broadcast profiles, copy profile-specific keys only.
        for setting in conf.keys():
                if isinstance(conf[setting], dict): _SPLCache[key][setting] = 
dict(conf[setting])
-               else: _SPLCache[key][setting] = conf[setting]
+               else:
+                       _SPLCache[key][setting] = conf[setting]
+                       # Optimization: free 5.0-style config keys while the 
app module is running, to be removed permanently in add-on 7.2.
+                       if setting != "InstantProfile": del conf[setting]
        # Column inclusion only.
        _SPLCache[key]["ColumnAnnouncement"]["IncludedColumns"] = 
list(conf["ColumnAnnouncement"]["IncludedColumns"])
 
@@ -534,6 +536,10 @@ def shouldSave(profile):
        tree = None if profile.filename == SPLIni else profile.name
        # One downside of caching: new profiles are not recognized as such.
        if "___new___" in _SPLCache[tree]: return True
+       # Playlist Remainder, be gone!
+       if "Advanced" in profile and "PlaylistRemainder" in profile["Advanced"]:
+               del profile["Advanced"]["PlaylistRemainder"]
+               return True
        for section in profile.keys():
                if isinstance(profile[section], dict):
                        for key in profile[section]:

diff --git a/addon/installTasks.py b/addon/installTasks.py
index 14d7053..7c32a8e 100755
--- a/addon/installTasks.py
+++ b/addon/installTasks.py
@@ -14,36 +14,6 @@ import globalVars
 SPLIni = os.path.join(globalVars.appArgs.configPath, "splstudio.ini")
 SPLIni7 = os.path.join(globalVars.appArgs.configPath, "splstudio7.ini")
 
-# Old (5.0) style config.
-confspec = ConfigObj(StringIO("""
-BeepAnnounce = boolean(default=false)
-MessageVerbosity = option("beginner", "advanced", default="beginner")
-SayEndOfTrack = boolean(default=true)
-EndOfTrackTime = integer(min=1, max=59, default=5)
-SaySongRamp = boolean(default=true)
-SongRampTime = integer(min=1, max=9, default=5)
-BrailleTimer = option("off", "intro", "outro", "both", default="off")
-MicAlarm = integer(min=0, max=7200, default="0")
-MicAlarmInterval = integer(min=0, max=60, default=0)
-AlarmAnnounce = option("beep", "message", "both", default="beep")
-LibraryScanAnnounce = option("off", "ending", "progress", "numbers", 
default="off")
-TrackDial = boolean(default=false)
-TimeHourAnnounce = boolean(default=false)
-MetadataReminder = option("off", "startup", "instant", default="off")
-MetadataEnabled = bool_list(default=list(false,false,false,false,false))
-UseScreenColumnOrder = boolean(default=true)
-ColumnOrder = 
string_list(default=list("Artist","Title","Duration","Intro","Outro","Category","Year","Album","Genre","Mood","Energy","Tempo","BPM","Gender","Rating","Filename","Time
 Scheduled"))
-IncludedColumns = 
string_list(default=list("Artist","Title","Duration","Intro","Outro","Category","Year","Album","Genre","Mood","Energy","Tempo","BPM","Gender","Rating","Filename","Time
 Scheduled"))
-SayScheduledFor = boolean(default=true)
-SayListenerCount = boolean(default=true)
-SayPlayingCartName = boolean(default=true)
-SayPlayingTrackName = string(default="True")
-SPLConPassthrough = boolean(default=false)
-CompatibilityLayer = option("off", "jfw", default="off")
-AudioDuckingReminder = boolean(default=true)
-"""), encoding="UTF-8", list_values=False)
-confspec.newlines = "\r\n"
-
 # New style config (used during profile conversion).
 _conversionConfig = {
        "BeepAnnounce":"General",
@@ -78,7 +48,7 @@ def config6to7(path):
        # Sometimes, an exception could be thrown if ConfigObj says it cannot 
parse the config file, so skip offending files.
        # This means the unlock function in splconfig will handle this case.
        try:
-               profile = ConfigObj(path, configspec = confspec, 
encoding="UTF-8")
+               profile = ConfigObj(path)
        except:
                return
        # Optimization: no need to convert if sectionized.
@@ -101,7 +71,7 @@ def config6to7(path):
        # Just in case studio is running.
        # If so, when the app module exits, it'll rewrite the whole config, so 
save the converted config somewhere to be imported by the app module later.
        if path == SPLIni:
-               profile7 = ConfigObj(SPLIni7, configspec = confspec, 
encoding="UTF-8")
+               profile7 = ConfigObj(SPLIni7)
                for key in profile:
                        profile7[key] = profile[key]
                profile7.write()

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.

Other related posts:

  • » commit/StationPlaylist: josephsl: 7.0-dev: 5.x config are now removed from runtime config dictionary and are no longer present in install tasks. - commits-noreply