Exemplo n.º 1
0
def checkForUpdates(client):
    while True:
        try:
            myBigDict = client.get_product_info(apps=[730], timeout=15)
            currentBuild = 0

            for key, values in myBigDict.items():
                for k, val in values.items():
                    currentBuild = val['depots']['branches']['public']['buildid']

            cacheFile = file_manager.readJson('cache.json')
            bIDCache = cacheFile['build_ID']

            if currentBuild != bIDCache:
                print('New update found! Sending alerts...')
                file_manager.updateJson('cache.json', currentBuild)
                slack_alerts.sendAlert(currentBuild)
                telegram_alerts.sendAlert(currentBuild)
                discord_alerts.setup(currentBuild)

            time.sleep(10)

        except AttributeError:
            error_message = traceback.format_exc()
            now = str(datetime.now())
            print(now + ' - Error:\n' + error_message + '\n\n\n')
            client.logout()
            time.sleep(60)
            setup()
Exemplo n.º 2
0
def readJson(relative_path):
    global config_path
    return file_manager.readJson(config_path + relative_path)
Exemplo n.º 3
0
def getAccounts():
    global config_root
    return file_manager.readJson(config_root + 'accounts.json')
Exemplo n.º 4
0
#   SIDEBAR PHASE
####################

# Get the sidebar template
sidebar = config.getSidebarTemplate()

# Default values for the different sections of the sidebar
communityMetricsMd = ''
strafe_md = ''
livestreams = {'markdown': '', 'spritesheet_path': None}
upcomingEventsMd = ''
matchesMd = ''
noticesMd = ''
mm = {'status': '', 'url': ''}

strafe_settings = file_manager.readJson('strafe/settings.json')
if not strafe_settings['enabled']:
    sidebar = sidebar.replace('\n__LIVESCORETICKER__\n', '')
else:
    # Wait 10 seconds to make sure the strafe ticker has had
    # enough time to build the match list so we can grab the
    # latest version of the markdown.
    time.sleep(10)

# Get the different components of the sidebar, but only if there is something
# in the sidebar markdown for them to replace!
if '__DISCORDCOUNT__' in sidebar and settings['sidebar']['social'][
        'discord_enabled']:
    discord_count = community_metrics.getDiscordUsersMarkdown()
if '__COMMUNITY_METRICS__' in sidebar:
    # if not settings['sidebar']['social']['ts_enabled'] and not settings['sidebar']['social']['irc_enabled']: