2012-05-09, 19:41
Hi
I hope anybody can open my eyes. I will add a notifier to my fork of GAMEZ and i have a problem.
i have added following code.
But it seems not work, i get no message in XBMC. In the xbmclog there are no entrys.
In my log all is okay and when i post the 'Executed ULR' direct in to the Browser there are no problems.
Here is a sample of my log.
What i make wrong?
Thanks
I hope anybody can open my eyes. I will add a notifier to my fork of GAMEZ and i have a problem.
i have added following code.
Code:
import base64
import urllib
import urllib2
import sys
import re
import ConfigParser
from gamez.Logger import *
def XbmcSend(message,appPath):
#First we have a look into Configfile
config = ConfigParser.RawConfigParser()
configFilePath = os.path.join(appPath,'Gamez.ini')
config.read(configFilePath)
xbmcPassword = config.get('Notifications','xbmc_password').replace('"','')
xbmcUsername = config.get('Notifications','xbmc_username').replace('"','')
xbmcHosts = config.get('Notifications','xbmc_hosts').replace('"','')
if(xbmcUsername == ''):
xbmcUsername = None
if(xbmcPassword == ''):
xbmcPassword = None
hosts = re.split(';|,',xbmcHosts)
for host in hosts:
url = 'http://' + host + '/xbmcCmds/xbmcHttp/?command=ExecBuiltIn(Notification(' + message.replace(':',',',1).replace(':','',1) + '))'
enc_url = urllib.quote(url)
DebugLogEvent("Executed URL: " + url)
response = ''
try:
req = urllib2.Request(url)
if xbmcPassword == None:
DebugLogEvent("No password for XBMC given")
else:
base64string = base64.encodestring('%s:%s' % (xbmcUsername, xbmcPassword)).replace('\n', '')
req.add_header("Authorization", "Basic %s" % base64string)
handle = urllib2.urlopen(req)
response = handle.read()
except Exception, e:
LogEvent("Couldn't send command to XBMC. %s\n" % e)
LogEvent('XBMC notification to ' + host + ' successful.\n')
return response
But it seems not work, i get no message in XBMC. In the xbmclog there are no entrys.
In my log all is okay and when i post the 'Executed ULR' direct in to the Browser there are no problems.
Here is a sample of my log.
Code:
Checking to see if a new version is available
DEBUG : Sending Notification Message to 192.168.1.110:8082
XBMC notification to 192.168.1.110:8082 successful.
DEBUG : No password for XBMC given
DEBUG : Executed URL: http://192.168.1.110:8082/xbmcCmds/xbmcHttp/?command=ExecBuiltIn(Notification(Gamez Notification, Xbox360 Game xxxx has been Snatched))
DEBUG : Gamez Notification: Xbox360 Game: xxxx has been Snatched
Update status of game to Snatched
DEBUG : TheGamesDB ID [None]
What i make wrong?
Thanks