I hope this is the correct forum, I'm guessing that those who could help me will be here! I have some old LUA code from the Girder website, made for Media Center 11. But obviously there has been a change somewhere along the way until the later versions, because it doesn't work. I'm pretty lousy at coding (well, to paraphrase Black Adder: I couldn't code myself out of a brown paper bag...
), so I can't really make heads or tails of this. Here's the code, which is meant to help me find out if a zone is playing or not:
local MC = false
local function GetJRMCObject()
local o = luacom.GetObject ("MediaJukebox Application")
table.print (o)
if o == nil then o = luacom.CreateObject ("MediaJukebox Application") end
if o == nil then print ("Bummer!!") return false end
return o
end
local function GetZonedPlayback(iZone)
assert(MC, 'No MC Object')
iZone = iZone or 0
local Zones = MC:GetZones()
--table.print(Zones)
local Zone = Zones:GetZone(iZone)
local Playback = Zone:GetPlayback()
assert(Playback, 'No Playback Object')
return Playback
end
local function Terminate ()
MC = nil
collectgarbage()
end
MC = GetJRMCObject()
local state = GetZonedPlayback(0)
print (state:State())
Terminate()
I can tell that it's managing to create the object, but it can't get the zones. Something tells me that it's MC:GetZones() that doesn't work since it doesn't seem to come up with a table (a table is created, but it's empty). But that can be totally wrong, of course. I tried to look at the automation stuff in the Wiki, but didn't really understand much, I'm afraid. As much as I like to call myself a power user I am far from a developer!
So could anybody please take pity in me?