commit/StationPlaylist: josephsl: Merge branch '7.0/indigoGoodbye50' into staging

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

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/80bf6265b3c2/
Changeset:   80bf6265b3c2
Branch:      staging
User:        josephsl
Date:        2016-01-26 17:41:10+00:00
Summary:     Merge branch '7.0/indigoGoodbye50' into staging

Affected #:  2 files

diff --git a/addon/appModules/splstudio/splconfig.py 
b/addon/appModules/splstudio/splconfig.py
index ed21542..02e5548 100755
--- a/addon/appModules/splstudio/splconfig.py
+++ b/addon/appModules/splstudio/splconfig.py
@@ -27,36 +27,6 @@ from splmisc import SPLCountdownTimer
 # Configuration management
 SPLIni = os.path.join(globalVars.appArgs.configPath, "splstudio.ini")
 SPLProfiles = os.path.join(globalVars.appArgs.configPath, "addons", 
"stationPlaylist", "profiles")
-# Old (5.0) style config.
-# To be superseeded by confspec7 in 8.0.
-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", "wineyes", default="off")
-AudioDuckingReminder = boolean(default=true)
-"""), encoding="UTF-8", list_values=False)
-confspec.newlines = "\r\n"
 # New (7.0) style config.
 confspec7 = ConfigObj(StringIO("""
 [General]
@@ -103,19 +73,15 @@ SPLConfig = None
 # A pool of broadcast profiles.
 SPLConfigPool = []
 # The following settings can be changed in profiles:
-_mutatableSettings=("SayEndOfTrack","EndOfTrackTime","SaySongRamp","SongRampTime","MicAlarm","MicAlarmInterval","MetadataEnabled","UseScreenColumnOrder","ColumnOrder","IncludedColumns")
 _mutatableSettings7=("IntroOutroAlarms", "MicrophoneAlarm", 
"MetadataStreaming", "ColumnAnnouncement")
 # 7.0: Profile-specific confspec (might be removed once a more optimal way to 
validate sections is found).
 # Dictionary comprehension is better here.
 confspecprofiles = {sect:key for sect, key in confspec7.iteritems() if sect in 
_mutatableSettings7}
 
 # Default config spec container.
-# To be removed in add-on 8.0.
-_SPLDefaults = ConfigObj(None, configspec = confspec, encoding="UTF-8")
-# And version 7 equivalent.
+# To be moved to a different place in 8.0.
 _SPLDefaults7 = ConfigObj(None, configspec = confspec7, encoding="UTF-8")
 _val = Validator()
-_SPLDefaults.validate(_val, copy=True)
 _SPLDefaults7.validate(_val, copy=True)
 
 # Display an error dialog when configuration validation fails.
@@ -170,7 +136,7 @@ def initConfig():
        if os.path.isfile(os.path.join(globalVars.appArgs.configPath, 
"splstudio7.ini")):
                # Save add-on update related keys and instant profile signature 
from death.
                # Necessary since the old-style config file contains newer 
information about update package size, last installed date and records instant 
profile name.
-               tempConfig = ConfigObj(SPLIni, configspec = confspec, 
encoding="UTF-8")
+               tempConfig = ConfigObj(SPLIni)
                if "InstantProfile" in tempConfig: curInstantProfile = 
tempConfig["InstantProfile"]
                os.remove(SPLIni)
                os.rename(os.path.join(globalVars.appArgs.configPath, 
"splstudio7.ini"), SPLIni)
@@ -311,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"])
 
@@ -568,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]:
@@ -771,7 +743,7 @@ def updateInit():
 # To be renamed and used in other places in 7.0.
 def _shouldBuildDescriptionPieces():
        return (not SPLConfig["ColumnAnnouncement"]["UseScreenColumnOrder"]
-       and (SPLConfig["ColumnAnnouncement"]["ColumnOrder"] != 
_SPLDefaults["ColumnOrder"]
+       and (SPLConfig["ColumnAnnouncement"]["ColumnOrder"] != 
_SPLDefaults7["ColumnAnnouncement"]["ColumnOrder"]
        or len(SPLConfig["ColumnAnnouncement"]["IncludedColumns"]) != 17))
 
 

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: Merge branch '7.0/indigoGoodbye50' into staging - commits-noreply