Technowolf Posted July 3, 2015 Share Posted July 3, 2015 I´ve managed to get an Service record message tab wich notifies about live streaming Clan Members. I would like to annouce live streaming with a little message wich is working by now. Last thing is i would like this message not to show up if the selected streamer is offline wich should be handled witch the else function. import BigWorld import os from debug_utils import * import GUI import ResMgr import json import urllib2 import urllib, socket from xml.dom.minidom import parseString from subprocess import check_output import json ap_cr_channel = '<a href="event:http://www.twitch.tv/jeff_ich_heisse_jeff_"><font color="#E2D2A2">Watch now</font></a>' try: url = 'http://cloud1.odemmortis.com/scripts/jeffapi.php' file = urllib.urlopen('http://cloud1.odemmortis.com/scripts/jeffapi.php') data = file.read() file.close() except: LOG_ERROR('Unable to access Remote File') from gui import SystemMessages sys_msg = '' def modpack(): try: if len(sys_msg) != 0: if SystemMessages.g_instance is None: BigWorld.callback(4.0, modpack) elif data == 'online': SystemMessages.pushMessage(sys_msg, type=SystemMessages.SM_TYPE.Information) else: SystemMessages.pushMessage(sys_msg, type=SystemMessages.SM_TYPE.Warning) except: LOG_CURRENT_EXCEPTION() return if data == 'online': sys_msg = '<font color="#7FCF00">Jeff ist live ON AIR ' + ap_cr_channel else: sys_msg = '<font color="#FF0000">Jeff ist OFFLINE!' from Account import Account def _First(msg): SystemMessages.pushMessage(msg, SystemMessages.SM_TYPE.Warning) def new_onBecomePlayer(self): old_onBecomePlayer(self) _First(sys_msg) old_onBecomePlayer = Account.onBecomePlayer Account.onBecomePlayer = new_onBecomePlayer could anybody help me with this ? I tried to simply remove the red marked else function but the result wasnt that great else: sys_msg = '<font color="#FF0000">Jeff ist OFFLINE!' Long story shor: Would like to have an message when streamer is online and no message if he is not. Thanks a lot guys @ Quote Link to comment Short link Share on other sites More sharing options...
goofy67 Posted July 3, 2015 Share Posted July 3, 2015 def _First(msg): global data if data == 'online': SystemMessages.pushMessage(msg, SystemMessages.SM_TYPE.Warning) 1 @ Quote Link to comment Short link Share on other sites More sharing options...
cezarica Posted July 3, 2015 Share Posted July 3, 2015 (edited) import BigWorld import os from debug_utils import * import urllib from gui import SystemMessages from Account import Account ap_cr_channel = '<a href="event:http://www.twitch.tv/jeff_ich_heisse_jeff_"><font color="#E2D2A2">Watch now</font></a>' def new_onBecomePlayer(self): try: url = 'http://cloud1.odemmortis.com/scripts/jeffapi.php' file = urllib.urlopen(url) data = file.read() file.close() if data == 'online': sys_msg = '<font color="#7FCF00">Jeff ist live ON AIR ' + ap_cr_channel else: sys_msg = '<font color="#FF0000">Jeff ist OFFLINE!' except: LOG_ERROR('Unable to access Remote File') finally: SystemMessages.pushMessage(sys_msg, SystemMessages.SM_TYPE.Warning) old_onBecomePlayer(self) old_onBecomePlayer = Account.onBecomePlayer Account.onBecomePlayer = new_onBecomePlayer Edited July 3, 2015 by cezarica @ Quote Link to comment Short link Share on other sites More sharing options...
Technowolf Posted July 3, 2015 Author Share Posted July 3, 2015 (edited) Thx a lot managed to get it the way it should be :) Is there an easy way to change the coloring and / or background of the System message ? I just had a look at the messenger.xml file wich should do the job. Are there any other types of system messages i could use for this kind of announcement ? Edit: Solved the problem by defining a new type of system message and editing the messenger.xml afterwards Edited July 4, 2015 by Technowolf @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.