Jump to content
Korean Random
Sign in to follow this  
Technowolf

Service Record Message

Recommended Posts

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

post-32807-0-71125500-1435917614.jpg

Share this post


Link to post

Short link
Share on other sites
def _First(msg):
global data
if data == 'online':
SystemMessages.pushMessage(msg, SystemMessages.SM_TYPE.Warning)
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

 

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 by cezarica

Share this post


Link to post

Short link
Share on other sites

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 by Technowolf

Share this post


Link to post

Short link
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...