[Script Planning] - Whats on other XBMCs / Multiroom Viewing
#1
I have four instances of XBMC in my house. I'd like to be able to pick up a program in one room and play it on another. All of my instances use the same fileserver SMB path. So my plan was to make a script that was integrated into the main menu.

This script would display all of my xbmc instances and whats playing on each of them. You would then have the option to play the same file at the same playing time as the remote instance(and stop/pause the remote instance too). I was going to use the xbmc http api to accomplish this.

No one has done this right? This feature isn't planned either?

This would be my first xbmc script as well.
Reply
#2
i've started some thinking and some writing for it little time ago, you can do it using xbmc's webserver of your installations.
it's good idea to start Wink
for a script, the gui part will be the harder
Reply
#3
I thought the internal python http library would work for remote xbmcs, however I can't figure out how to do that. So I'm using the urllib to get the info i need.
Reply
#4
yes, http api can control xbmc Wink

i've made a script that asking for the current playing on my other xbmc, then start the same file at current time on my xbmc.
Reply
#5
Care to share that code? Though I'm almost done with my function that does that.

I meant the internal python http control ( xbmc.executehttpapi ) doesn't seem to have support to control remote xbmc instances.
Reply
#6
yes sure: http://www.mediafire.com/download.php?cymzfn0ywgy

just small writting, with http api you can use builtin (run a script so you can play with client / server side with you script Wink )
Reply
#7
My code follows a similar method as yours. I have a proof of concept working now. You get a menu of xbmc instances and then you can choose and it will play whats playing on the other at the same point in time.

We'll have to flush it out and make a nice gui and it can get released I suppose.
Reply
#8
any update on this. sounds handy. would be nice if this sort of thing could be implemented into the main xbmc code. along with multi-room audio.

PS does this script support music as well as videos? would be great if it did.

RBX
Reply
#9
it can.
Reply
#10
oh wow, didn't think anyone was interested. I have the POC working, however I'm having trouble making the gui part come out right.
Reply
#11
yes, interrested, as i've started this work Wink
Reply
#12
Im having issues getting anything going in the gui. WindowsXML doesn't look simple. I got the settings through the gui, here is the code that plays from another server:

Code:
current_url = r"/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying()"

def GetNowPlaying(instance):
   socket.setdefaulttimeout(2);
   remote_ip = __settings__.getSetting( "xbmc" + instance + "_ip" )
   remote_user = __settings__.getSetting( "xbmc" + instance + "_user" )
   remote_pass = __settings__.getSetting( "xbmc" + instance + "_pass" )
   now_url = "http://" + remote_ip + current_url
   sys.stderr.write("Getting NowPlaying from XBMC via URL: "+now_url +" username:"+ remote_user + " password:" + remote_pass + "base: " + current_url)
   req = urllib2.Request(now_url)
   if remote_pass != '':
       base64string = base64.encodestring('%s:%s' % (remote_user, remote_pass))[:-1]
       authheader =  "Basic %s" % base64string
       req.add_header("Authorization", authheader)
       sys.stderr.write("Adding Password to XBMC url")
   try: handle = urllib2.urlopen(req)
   except urllib2.URLError, e:
    sys.stderr.write("Warning: Couldn't contact XBMC HTTP server at " + remote_ip + ": " + str(e))
    return false
   output = handle.read()
   r = re.search(r"Filename:(.*?)\n",output);
   p = re.search(r"Percentage:(\d+?)\n",output);
   t = re.search(r"Thumb:(.*?)\n",output);
   if hasattr(r,'group'):
       current_file = r.group(1)
       current_pos = p.group(1)
       if hasattr(t,'group'):
              current_thumb = t.group(1)
       else:
              current_thumb = ''
       return current_file,current_pos,current_thumb
   else:
       return False

def PlayLocal(cur_file,cur_pos):
    sys.stderr.write("Attempting Local Playback")
    xbmc.executehttpapi("PlayFile(" + cur_file +")")
    xbmc.executehttpapi("SeekPercentage(" + cur_pos +")")
Reply

Logout Mark Read Team Forum Stats Members Help
[Script Planning] - Whats on other XBMCs / Multiroom Viewing0