XBMC Control

From WiiLi

Jump to: navigation, search

Xbox Media center Control will control XBMC through the network using XBMC's Web server. Your Browser has to be the top window on the pc running glovePIE. This script also has "Script switch" if you want to enable that feature you will need to download the Script switch script and set it up. I hope you enjoy this. Any issues let me know mydarxide (at) g mail (dot) com



// XBMC (Xbox Media Center) Control
// By DarXidE with script contributions from Rhys Legault
// Feel Free to Use, Modify and distribute

//Uses XBMC Web Server to control XBMC
//Web Server must be enabled on XBMC under network settings
//Set Xbox Ip Address to Var.xboxip and set your Internet browsers .exe
//location  to var.browser

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//                              Controls
//                         (Navigation "Mode")
// Navigate                                        Dpad
// Select                                          A
// Fullscreen Toggle                               Home
// B (Parent Dir)                                  +
// Back (Prev Menu)                                -
// Add To Playlist                                 1
// View Playlist                                   2
//
//                             With B Held
//                          (Player "Mode")
// Play/Pause                                      B & A
// Volume Down                                     B & -
// Volume Up                                       B & +
// Mute                                            B & Home
// Fast Forward                                    B & 1
// Rewind                                          B & 2
//                         Hold Button 3 sec
//                      (Start/Shutdown "Mode")
// Left Click Menu                                 Hold -
// Right Click (shutdown Menu)                     Hold +
// Launch Browser (on PC)                          Hold A
// Change to Different GlovePIE Script             Hold Home
//                            Flick Controls
//
// Next Track                                      Flick Right
// Previous Track                                  Flick Left
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

//Edit These To Suit Your Setup

//Ip Address For Your Xbox
var.xboxip = "Http://192.168.9.80"
// for file locations use DOS names GolvePIE doesn't like spaces
var.browser = "C:\Progra~1\mozill~1\Firefox.exe"





 if !var.Initialize
    //File Path to GlovePIE (use DOS names)
    var.GlovePIEPath = "C:\GlovePIE030\GlovePIE.exe"
   //Make sure script path begins with a dash "-" so script opens running
   var.ScriptSwitchPath = "-C:\GlovePIE030\MyScripts\Switch\SS2.PIE"
   var.Initialize = true
   endif


//hold variables
if !var.init
   var.HeldTime = 3s //this is how long to hold buttons to change function
   var.init = true
endif
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//Command Prefix
var.cmd = "/xbmcCmds/xbmcHttp?command="

//Player Commands
var.Play ="Action&parameter=79"     //Play
Var.Paus ="Action&parameter=12"     //Pause
Var.FF = "Action&parameter=77"      //Fast Forward
Var.RW = "Action&parameter=78"      //Rewind
Var.Next = "Action&parameter=14"    //Next
Var.Prev = "Action&parameter=15"    //Previous

var.mute = "Action&parameter=91"    //Mute
Var.Volup = "Action&parameter=88"   //Volume Up
Var.Voldo = "Action&parameter=89"   //Volume Down

//Navigation Commands
Var.sel = "Action&parameter=7"      //select item
Var.Pmnu = "Action&parameter=10"    //Prev Menu
var.ParD = "Action&parameter=9"     //Parent Dir
Var.Disp = "Action&parameter=18"    //toggle fullscreen
Var.VPlyl ="Action&parameter=33"    //view Playlist
Var.Addpl = "Action&parameter=34"   //add to playtlist

//Button Variables
Var.up = "SendKey&parameter=270"
Var.down = "SendKey&parameter=271"
Var.Left = "SendKey&parameter=272"
Var.Right = "SendKey&parameter=273"

var.A = "SendKey&parameter=256"
Var.B = "SendKey&parameter=257"
Var.Y = "SendKey&parameter=259"
Var.X = "SendKey&parameter=258"

Var.start = "SendKey&parameter=274"
Var.Back = "SendKey&parameter=275"

Var.Lclick = "SendKey&parameter=276"
Var.Rclick = "SendKey&parameter=277"

Var.Black = "SendKey&parameter=260"
Var.White = "SendKey&parameter=261"


///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

/////////////////
//Button Mappings
/////////////////

//up
if (wiimote.up)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.up)
key.Enter = true
key.enter = false
wait 500ms
endif

//down
if (wiimote.down)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.down)
key.Enter = true
key.enter = false
wait 500ms
endif

//Left
if (wiimote.left)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.left)
key.Enter = true
key.enter = false
wait 500ms
endif

//Right
if (wiimote.right)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.right)
key.Enter = true
key.enter = false
wait 500ms
endif

//Add to Playlist
if (wiimote.one)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.addpl)
key.Enter = true
key.enter = false
wait 500ms
endif

//View Playlist
if (wiimote.two)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.Vplyl)
key.Enter = true
key.enter = false
wait 500ms
endif

///////////
//A Button
///////////

//Select
if Released(Wiimote.A)
   if !var.Held
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.sel)
key.Enter = true
key.enter = false
wait 500ms
else
      var.Held = false
   endif
else
//Launch Browser (on PC) (hold 3 sec)
if Pressed(HeldDown(Wiimote.A, var.HeldTime))
Execute(var.Browser)
var.Held = true
Endif
endif

////////
//Minus
////////

//Previous Menu
if Released(Wiimote.minus)
   if !var.Held
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.pmnu)
key.Enter = true
key.enter = false
wait 500ms
else
      var.Held = false
   endif
else
//Left Click Menu  (hold 3 sec)
if Pressed(HeldDown(Wiimote.Minus, var.HeldTime))
   Key.ctrl = true
   key.L = true
   key.L = false
   Key.Ctrl = false
   type(Var.xboxip)
   type(Var.cmd)
   type(Var.lclick)
   key.Enter = true
   key.enter = false
   wait 1000ms
   var.Held = true
endif
endif

///////
//Plus
///////

//Parent Dir
if Released(Wiimote.plus)
   if !var.Held
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.pard)
key.Enter = true
key.enter = false
wait 500ms
else
      var.Held = false
   endif
else

//Right Click Menu
if Pressed(HeldDown(Wiimote.Plus, var.HeldTime))
   Key.ctrl = true
   key.L = true
   key.L = false
   Key.Ctrl = false
   type(Var.xboxip)
   type(Var.cmd)
   type(Var.rclick)
   key.Enter = true
   key.enter = false
   wait 500ms
   var.Held = true
endif
endif

///////
//Home
///////


//Display
if Released(Wiimote.home)
   if !var.Held
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.Disp)
key.Enter = true
key.enter = false
wait 500ms
else
      var.Held = false
   endif
else
//Switch Script


   if Pressed(HeldDown(Wiimote.home, var.HeldTime))
   Execute(var.GlovePIEPath, var.ScriptSwitchPath)
   ExitPIE
   endif
   endif
//////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

///////////////
//Button Combos
///////////////
var.Playpau = 0

//Play
if (wiimote.a and Wiimote.B)then
   if (var.playpau = 0) then
   Key.ctrl = true
   key.L = true
   key.L = false
   Key.Ctrl = false
   type(Var.xboxip)
   type(Var.cmd)
   type(Var.Play)
   key.Enter = true
   key.enter = false
   var.playpau = 1
   wait 500ms
   else
   Key.ctrl = true
   key.L = true
   key.L = false
   Key.Ctrl = false
   type(Var.xboxip)
   type(Var.cmd)
   type(Var.paus)
   key.Enter = true
   key.enter = false
   var.playpau = 0
   wait 500ms
endif
endif

//Volume Up
if (wiimote.Plus and Wiimote.B)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.volup)
key.Enter = true
key.enter = false
wait 500ms
endif

//Volume Down
if (wiimote.Minus and Wiimote.B)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.voldo)
key.Enter = true
key.enter = false
wait 500ms
endif

//Mute
if (wiimote.home and Wiimote.B)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.mute)
key.Enter = true
key.enter = false
wait 500ms
endif

//Fast Forward
if (wiimote.one and Wiimote.B)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.FF)
key.Enter = true
key.enter = false
wait 500ms
endif

//Rewind
if (wiimote.two and Wiimote.B)then
Key.ctrl = true
key.L = true
key.L = false
Key.Ctrl = false
type(Var.xboxip)
type(Var.cmd)
type(Var.RW)
key.Enter = true
key.enter = false
wait 500ms
endif

////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

//Ultimate Flick Script
//Created by Rhys Legault



PIE.SeqReadGap = 50ms
var.AccelerationThreshold = 1.5
var.ActionGap = 150ms


if var.WiimoteFlick = false

   //Flick Wiimote up
   if (Wiimote.gy > var.AccelerationThreshold, Wiimote.gy < -var.AccelerationThreshold)
      var.WiimoteFlick = true

      //
      Press(Up)
      wait var.HoldKey
      Release(Up)
      //

      wait var.ActionGap
      var.WiimoteFlick = false

   //Flick Wiimote down
   elseif (Wiimote.gy < -var.AccelerationThreshold, Wiimote.gy > var.AccelerationThreshold)
      var.WiimoteFlick = true

      //
      Press(Down)
      wait var.HoldKey
      Release(Down)
      //

      wait var.ActionGap
      var.WiimoteFlick = false

   //Flick Wiimote left
   //Previous Track
   elseif (Wiimote.gx < -var.AccelerationThreshold, Wiimote.gx > var.AccelerationThreshold)
      var.WiimoteFlick = true

      //
      Key.ctrl = true
      key.L = true
      key.L = false
      Key.Ctrl = false
      type(Var.xboxip)
      type(Var.cmd)
      type(Var.Prev)
      key.Enter = true
      key.enter = false
      wait 500ms
      //

      wait var.ActionGap
      var.WiimoteFlick = false

   //Flick Wiimote right
   //Next Track
   elseif (Wiimote.gx > var.AccelerationThreshold, Wiimote.gx < -var.AccelerationThreshold)
      var.WiimoteFlick = true


       //
       Key.ctrl = true
       key.L = true
       key.L = false
       Key.Ctrl = false
       type(Var.xboxip)
       type(Var.cmd)
       type(Var.Next)
       key.Enter = true
       key.enter = false
       wait 500ms
       //

      wait var.ActionGap
      var.WiimoteFlick = false
   endif
endif

///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////






Personal tools
Online Casino - best online casino reviews.
Facebook Developers - facebook applications, facebook developers, facebook development, social network application development and viral widget social media strategy