Example #1
0
def run():
    status['text'] = '当前状态:正在启动代理'
    # 配置文件内路径包含.exe文件部分
    if not UserConfig.read_config(
            'NeteaseCloudMusicPath') or not os.path.exists(
                UserConfig.read_config('NeteaseCloudMusicPath')):
        showinfo('提示', '检测到您是第一次使用本程序,请先选择网易云音乐安装目录!')
        while True:
            exe_path = askdirectory()
            if os.path.exists(str(exe_path) + r'/cloudmusic.exe'):
                UserConfig.add_config('NeteaseCloudMusicPath',
                                      str(exe_path) + r'/cloudmusic.exe')
                break
            else:
                if askokcancel(
                        '提示',
                        '未在选择的目录下找到cloudmusic.exe文件,您依然可以使用本软件,但代理启动成功后不会自动打开网易云!\n是否重新选择路径?'
                ):
                    continue
                else:
                    break
    if check_cloudmusic_process():
        if askokcancel('提示', '网易云音乐开启时无法启动代理,是否立即关闭网易云?'):
            terminate_cloudmusic()
        else:
            return False
    update()
    if os.path.exists('clash-windows-amd64.exe') and os.path.exists(
            'config.yaml') and os.path.exists(
                'Country.mmdb') and os.path.exists(
                    './RuleSet/NeteaseMusic.yaml') and os.path.exists(
                        './Proxy/NeteaseMusic.yaml'):
        change_proxy_settings(True)
        run_proxy_process()
        showinfo('提示', '代理启动成功!现在可以畅听网易云音乐了!')
        subprocess.Popen(UserConfig.read_config('NeteaseCloudMusicPath'))
        status['text'] = '当前状态:代理启动成功'
        root.iconify()
    else:
        showerror('警告', '程序关键文件丢失,请修复程序!')
        return False
Example #2
0
Launch.workDir = workDir
Launch.webwareDir = webwareDir
Launch.libraryDirs = libraryDirs
Launch.runProfile = runProfile
Launch.logFile = logFile
Launch.pidFile = pidFile
Launch.user = user
Launch.group = group

import RbtUtils

if not RbtUtils.isProduction():
    Logging.log(Logging.LOG_INFO, 'webasd is not production')

try:
    try:
        import wsm
        wsm.wsm().start()
    except Exception:
        Logging.log(Logging.LOG_ERR,
            'Global web connection to mgmtd failed.')
    else:
        # clean up temporary nodes that userconfig may leave behind
        import UserConfig
        from wsm import mgmt as globalMgmt
        UserConfig.cleanUp(globalMgmt)

        Launch.main(['ThreadedAppServer'])
finally:
    Logging.log(Logging.LOG_NOTICE, 'Appserver closing')
Example #3
0
 def internal(**kwargs):
     UserConfig.set(self.session(), *kwargs.items())
Example #4
0
 def internal(path, value):
     UserConfig.set(self.session(), path, value)
Example #5
0
            perField = self.fields.get('per', '')
            lbField = self.fields.get('lb', '')
            ubField = self.fields.get('ub', '')
            tField = self.fields.get('viaemail', 'false')
            eField = self.fields.get('email', '')

            # Update the user config nodes.
            userconfigSetParams = [
                ('web/reports/export/report', rField),
                ('web/reports/export/email', tField)
            ]

            if tField == 'true':
                userconfigSetParams.append(('web/reports/export/email_address', eField))

            UserConfig.set(self.session(), *userconfigSetParams)

            if tField == 'false':
                filename = '/var/opt/tms/stats/reports/webreport.%s' % fField
                recv_type = 'file'
                recv_id = 'webreport'
            else:
                recv_type = 'email'
                recv_id = eField

            params = [('id', 'string', rField),
                      ('format', 'string', fField),
                      ('recipient_type', 'string', recv_type),
                      ('recipient_id', 'string', recv_id)]

            # Determine the proper lb and ub values based on the user's