2010-04-18, 23:20
From my fuzzy recollection I think it worked nice with this skin but other skins certain sections were missing?
nojstevens Wrote:Is this script still working - if so, could someone link me to it as the original link is down....
Thanks
Jon
snogard20 Wrote:philw132 glad to see that you are updating the script. As I was excited to come across this post and was disappointed when the first page I realize was posted so long ago. However as I clicked the last page and saw a much more recent date I was very excited.
I am running version XBMC 9.11 R26017 and would love to try out the script when you get a chance to get it posted. Hope to see something soon.
And thanks again for updating this, like you said in your previous post I am no fan of the "Triple Play" and this would be the final touch needed for my own setup not owned by the man!
Alan
Quote:import socketHere is working script for 9.11 I have fixed the non displaying phone number problem!
import xbmc, xbmcgui, threading, thread, os, urllib
from time import *
from string import *
try:
EMULATING = xbmcgui.Emulating
SCRIPTFOLDER = "c:\\win32app\\Python24\\CallerId"
except:
EMULATING = False
SCRIPTFOLDER = os.getcwd()
MYAREACODE = "250" # SPECIFY YOUR AREA CODE
DOPAUSE = 1 # PAUSE PLAYBACK ON INCOMING CALL?
DOINITMSG = 1 # SHOW AN INITIALISATION MESSAGE WHEN SCRIPT STARTS
DOIMAGE = 1 # SPECIFY WHETHER OR NOT TO DISPLAY PICTURE WITH DIALOG
DOSOUND = 1 # SPECIFY WHETHER TO PLAY A SOUND
DELAY = 2 # SPECIFY DELAY BEFORE CLOSE IN SECONDS
SERVERTYPE = "YAC" # SPECIFY EITHER "YAC", "SWITCHBOARD", "CIDSENTRY" OR "IMPULSE"
OSDTITLE = "Phone Call" # TITLE TO SHOW ON INCOMING CALL DIALOG
SOUNDFILE = "incoming-a.wav" # WAV FILE TO PLAY IF DOSOUND IS ENABLED
YACPORT = 10629
BIGENDIAN = 1 # 0 OR 1, IF ONE DOESN'T WORK, TRY THE OTHER
HOST = '' # Symbolic name meaning the local host
xOffset = 3 # These are used to give a black shadow effect to text
yOffset = 3 # MattC.
class packet:
def __init__(self, type, param1, param2 = "", param3 = ""):
self.type = type
self.param1 = param1
self.param2 = param2
self.param3 = param3
def decodepacket(the_string):
if not(BIGENDIAN):
type = ord(the_string[3])
param1 = (ord(the_string[6]) * 256) + ord(the_string[7])
else:
type = ord(the_string[0])
param1 = (ord(the_string[5]) * 256) + ord(the_string[4])
param2 = the_string[8:72]
param3 = the_string[72:]
for i in range(-63, 0):
if ord(param2[-i]) == 0: param2 = param2[:-i]
if ord(param3[-i]) == 0: param3 = param3[:-i]
return packet(type, param1, param2, param3)
def encodepacket(the_packet):
r = " "
if not(BIGENDIAN):
r = r + chr(0)
else:
r = r + chr(the_packet.type)
r = r[1:]
r = r + chr(0)
r = r + chr(0)
if BIGENDIAN:
r = r + chr(0)
else:
r = r + chr(the_packet.type)
if not(BIGENDIAN):
r = r + chr(the_packet.param1 - ((the_packet.param1 / 256) * 256))
else:
r = r + chr(the_packet.param1 - ((the_packet.param1 / 256) * 256))
r = r + chr(the_packet.param1 / 256)
r = r + chr(0)
r = r + chr(0)
r = r + the_packet.param2
for i in range(len®, 72):
r = r + chr(0)
r = r + the_packet.param3
for i in range(len®, 136):
r = r + chr(0)
return r
def formatnumber( n ):
if len( n ) == 7:
return "(" + MYAREACODE + ") " + n[:3] + "-" + n[3:]
if len( n ) == 10:
return "(" + n[:3] + ") " + n[3:6] + "-" + n[6:]
if len( n ) == 11:
return n[0] + " (" + n[1:4] + ") " + n[4:7] + "-" + n[7:]
return n
def fileExists(f):
try:
file = open(f)
except IOError:
exists = 0
else:
exists = 1
return exists
class initialise(xbmcgui.WindowDialog):
def __init__(self):
if EMULATING: xbmcgui.Window.__init__(self)
w = self.getWidth()
h = self.getHeight()
self.a = -1
self.shown = 1
self.titleBlack = xbmcgui.ControlLabel(w - (275+xOffset), h - (133+yOffset), 150, 10, 'Caller ID Active', 'font13', '0xff000000')
self.titleWhite = xbmcgui.ControlLabel(w - 275, h - 133, 150, 10, 'Caller ID Active', 'font13', '0xffffffff')
self.addControl(self.titleBlack)
self.addControl(self.titleWhite)
subThread = threading.Thread(target=self.SubthreadProc, args=())
subThread.start()
def SubthreadProc(self):
sleep(1)
if self.shown:
self.shown = 0
self.close()
def onAction(self, action):
if self.a == action:
self.shown = 0
self.close()
self.a = action
class caller(xbmcgui.WindowDialog):
def __init__(self):
if EMULATING:
xbmcgui.Window.__init__(self)
w = self.getWidth()
h = self.getHeight()
if name != "": nametodisplay = name
if name == "NO NAME" or name == "": nametodisplay = number
if name == "" and number == "": nametodisplay = data
if location != "": nametodisplay = nametodisplay + "\n" + location
if number != "": numbertodisplay = number
if number == "NO number" or number == "": numbertodisplay = name
if number == "" and number == "": numbertodisplay = data
if location != "": numbertodisplay = numbertodisplay + "\n" + location
self.bg = xbmcgui.ControlImage(w - 282, h - 838, 222, 103, SCRIPTFOLDER + "\\Dialog\\dialog.png")
self.addControl(self.bg)
self.callerid = xbmcgui.ControlLabel(w - 275, h - 795, 151, 64, nametodisplay, 'font13', '0xFFFFFFFF')
self.addControl(self.callerid)
self.callerid = xbmcgui.ControlLabel(w - 275, h - 775, 151, 64, numbertodisplay, 'font13', '0xFFFFFFFF')
self.addControl(self.callerid)
if not DOIMAGE:
self.title = xbmcgui.ControlLabel(w - 277, h - 133, 222, 10, boxtitle, 'font13', '0xffffffff')
self.addControl(self.title)
else:
self.frame = xbmcgui.ControlImage(w - 359, h - 838, 77, 103, SCRIPTFOLDER + "\\Dialog\\frame.png")
self.addControl(self.frame)
self.title = xbmcgui.ControlLabel(w - 354, h - 833, 222, 10, boxtitle, 'font13', '0xffffffff')
self.addControl(self.title)
filename = replace(number, '(', '')
filename = replace(filename, ')', '')
filename = replace(filename, ' ', '')
filename = replace(filename, '-', '')
filename = SCRIPTFOLDER + "\\Pictures\\" + filename + '.png'
if not fileExists(filename): filename = SCRIPTFOLDER + "\\Pictures\\default.png"
self.tn = xbmcgui.ControlImage(w - 359, h - 812, 77, 77, filename)
self.addControl(self.tn)
self.a = -1
self.shown = 1
if (EMULATING):
sleep(1)
else:
if (DOPAUSE and xbmc.Player().isPlaying()):
value1 = xbmc.Player().getTime()
sleep(1)
value2 = xbmc.Player().getTime()
if value1 != value2:
xbmc.Player().pause()
if DOSOUND: xbmc.playSFX(SCRIPTFOLDER + "\\Sounds\\" + SOUNDFILE)
subThread = threading.Thread(target=self.SubthreadProc, args=())
subThread.start()
def SubthreadProc(self):
sleep(DELAY)
if self.shown:
self.shown = 0
self.close()
def onAction(self, action):
if self.a == action:
self.shown = 0
self.close()
self.a = action
if SERVERTYPE == "YAC":
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, YACPORT))
data = ""
name = ""
number = ""
boxtitle = OSDTITLE
picurl = ""
location = ""
if not EMULATING and DOINITMSG:
w = initialise()
w.doModal()
del w
while 1:
if SERVERTYPE == "YAC":
s.listen(1)
conn, addr = s.accept()
a = conn.recv(1024)
alist = split(a[5:], "~")
if len(alist) > 1:
name = alist[0]
number = alist[1]
data = name + "\n" + number
if picurl != "":
tmppicurl = replace(number, '(', '')
tmppicurl = replace(tmppicurl , ')', '')
tmppicurl = replace(tmppicurl , ' ', '')
tmppicurl = replace(tmppicurl , '-', '')
urllib.urlretrieve(picurl, SCRIPTFOLDER + "\\Pictures\\" + tmppicurl + ".png")
if data != "":
print(data)
w = caller()
w.doModal()
del w
if SERVERTYPE == "YAC": conn.close()
data = ""
name = ""
number = ""
boxtitle = OSDTITLE
picurl = ""
location = ""
exit151 Wrote:Been searching high and low for a CID plugin/addon for XBMC.. Nothing at all in the official addons, but I saw this post, and others which reference/are from the same author, and wondering/hoping someone might be able to get it working with the newest version of XBMC..
I tried copy/pasting what the author said will work with the 9.1.x series, and it's not working (it actually causes an error when I try to run it from programs, whereas the original download script said it was started, but did nothing).
I have YAC installed properly and can verify it works, it just doesn't seem to be linking up to XBMC by this callerid script. Help? Thanks in advance,
exit151