コード例 #1
0
ファイル: __init__.py プロジェクト: mikeder/cherrymusic
    def setup_config(self, createNewConfig, browsersetup, cfg_override):
        """start the in-browser configuration server, create a config if
        no configuration is found or provide migration help for old CM
        versions

        initialize the configuration if no config setup is needed/requested
        """
        if browsersetup:
            port = cfg_override.pop('server.port', False)
            cherrymusicserver.browsersetup.configureAndStartCherryPy(port)
        if createNewConfig:
            newconfigpath = pathprovider.configurationFile() + '.new'
            cfg.write_to_file(cfg.from_defaults(), newconfigpath)
            log.i(_('New configuration file was written to:{br}{path}').format(
                path=newconfigpath,
                br=os.linesep
            ))
            sys.exit(0)
        if not pathprovider.configurationFileExists():
            if pathprovider.fallbackPathInUse():   # temp. remove @ v0.30 or so
                self.printMigrationNoticeAndExit()
            else:
                cfg.write_to_file(cfg.from_defaults(), pathprovider.configurationFile())
                self.printWelcomeAndExit()
        self._init_config(cfg_override)
コード例 #2
0
def migrate():
    """If config file is still in old location, print a message and exit(1)"""
    if pathprovider.configurationFileExists(
    ) or not pathprovider.fallbackPathInUse():
        return
    _printMigrationNotice()
    sys.exit(1)
コード例 #3
0
 def setup_config(self, createNewConfig, browsersetup, cfg_override):
     if browsersetup:
         port = cfg_override.pop('server.port', False)
         cherrymusicserver.browsersetup.configureAndStartCherryPy(port)
     if createNewConfig:
         newconfigpath = pathprovider.configurationFile() + '.new'
         cfg.write_to_file(cfg.from_defaults(), newconfigpath)
         log.i('New configuration file was written to:{br}{path}'.format(
             path=newconfigpath, br=os.linesep))
         sys.exit(0)
     if not pathprovider.configurationFileExists():
         if pathprovider.fallbackPathInUse():  # temp. remove @ v0.30 or so
             self.printMigrationNoticeAndExit()
         else:
             cfg.write_to_file(cfg.from_defaults(),
                               pathprovider.configurationFile())
             self.printWelcomeAndExit()
     self._init_config(cfg_override)
コード例 #4
0
ファイル: __init__.py プロジェクト: cshimmin/cherrymusic
 def setup_config(self, createNewConfig, browsersetup, cfg_override):
     if browsersetup:
         port = cfg_override.pop('server.port', False)
         cherrymusicserver.browsersetup.configureAndStartCherryPy(port)
     if createNewConfig:
         newconfigpath = pathprovider.configurationFile() + '.new'
         cfg.write_to_file(cfg.from_defaults(), newconfigpath)
         log.i('New configuration file was written to:{br}{path}'.format(
             path=newconfigpath,
             br=os.linesep
         ))
         sys.exit(0)
     if not pathprovider.configurationFileExists():
         if pathprovider.fallbackPathInUse():   # temp. remove @ v0.30 or so
             self.printMigrationNoticeAndExit()
         else:
             cfg.write_to_file(cfg.from_defaults(), pathprovider.configurationFile())
             self.printWelcomeAndExit()
     self._init_config(cfg_override)
コード例 #5
0
def migrate():
    """If config file is still in old location, print a message and exit(1)"""
    if pathprovider.configurationFileExists() or not pathprovider.fallbackPathInUse():
        return
    _printMigrationNotice()
    sys.exit(1)