View Full Version : Exit & Restart Girder
Cocophone
April 19th, 2004, 08:12 PM
Is it possible to have girder exit itself and restart itself?
I would like to restart girder using my remote when it seems to be acting up and needs a restart.
Thanks for any help.
Promixis
April 19th, 2004, 08:39 PM
You definitely should not need to do this...
What kind of problems are you having?
Cocophone
April 19th, 2004, 08:57 PM
I using girder to get lyrics out of J River Music Center.
Some times it stops working and girder says it has a parsing error in the message part of the girder window.
If I restart Girder it starts working again.
Promixis
April 20th, 2004, 06:29 AM
Are you using luacom to talk with JRMC?
If so, there is a a problem with the luacom library reloading after a script engine reset. We are working on that.
Cocophone
April 20th, 2004, 07:41 AM
I'm far from an expert, but that is what I'm doing.
I'm using Netremote to have girder pull the lyrics out of J River Media Center and then put them in a embedded web page on my pda
So sometimes it stops working. If I restart girder then it will usually start working again.
That's why I wanted to find out if I could have girder exit and restart itself. Maybe call a batch file that could do that.
Thanks
Promixis
April 20th, 2004, 08:12 AM
Why don't you post the exact error message from the script - Are you using Marcel's stuff?
Cocophone
April 20th, 2004, 10:31 AM
I'm using Marcel's stuff.
All I see is the error message "Parse Error" on the bottom of the Girder Window border.
How do I get the error message that you need to figure out what is causing the problem?
Thanks
Promixis
April 20th, 2004, 12:24 PM
Open up the Girder Script window - ie. where the lua statements are. There is an output window which will catch the error. Just leave it open while Girder is running.
Cocophone
April 20th, 2004, 07:57 PM
Ok...I got the error messages.
I had girder & J River Media Center running. I then exited J River Media Center and restarted Media Center. I then got the girder errors:
Error #1
error: attempt to call field `GetCurPlaylist' (a nil value)
stack traceback:
1: function `MCGetLyrics' [(none)]
2: main of (none)
Error #2
error: attempt to call field `GetCurPlaylist' (a nil value)
stack traceback:
1: function `MCGetBios' [(none)]
2: main of (none)
If I then exit Girder and restart Girder it will start working again.
Thanks
mhwlng
April 21st, 2004, 12:21 AM
that is normal if you use my code (Which is not really my code, it was taken from Mike c's example on this board).....
Girder opens a connection with JRMC only the first time it gets some information. then it re-uses the connection handle every other time...
if you stop/start JRMC, then the connection handle becomes invalid, but the girder code doesn't know this....
you can change the lua code to disconnect/reconnect every time that you request something from JRMC or in case of an error..
It doesn't do that now...
I always have girder and JRMC running at the same time. so it is not a problem for me...
also as a side note, there are two ways of talking to JRMC -> direct (v10 only) or via MCIO.
If you have a direct connection active and you stop JRMC, it crashes after a long time. It doesn't do this if you have the connection open via MCIO (the above problem still occurs of course).
Marcel
Promixis
April 21st, 2004, 07:27 AM
Marcel,
I have been playing with the direct connection in MC9 v.139 and the latest V10. Its seems to work much better. In my next release of LCD Master, I am planning on dropping MCIO.
What happens with the direct connect, is the user can close/open MC and the object remains valid.
Mike.
mhwlng
April 21st, 2004, 08:33 AM
Hi Mike,
these are my experiences :
MCIO
start girder,MC,NR
request artist bio ok
stop MC
start MC
request artist bio fails
DIRECT
start girder,MC,NR
request artist bio ok
stop MC -> MC doesn't exit, just hangs.
KILL TASK
start MC
request artist bio fails
this is my code (part of my external .lua file)
you should recognize a lot of the code :D
replace MCConnectComDirect with MCConnectComMCIO for an MCIO connection :
Public.LYRICSHTML =""
Public.LYRICSTITLE =""
Public.LYRICSAVL =0
Private.MCComInit = 0
Private.MCServer = nil -- COM Object for MCIOServer
Private.MCA = nil -- basic COM object for interfacing to Media Center COM
function Private.MCConnectComMCIO ()
local MCStart = 1 -- start up MC if not running
local MCDelay = 15 -- time to wait for MC to get started
if (%Private.MCComInit == 0) then
if (%Private.MCA == nil) then
%Private.MCServer = luacom_CreateObject ("MCIOServer.MediaCentreInsideOutServer.1")
if not %Private.MCServer then
print ("Unable to connect to Media Center Inside Out Server")
return nil
end
%Private.MCA = %Private.MCServer:GetMJAutomationObject (MCStart,MCDelay)
if (%Private.MCA == nil) then
print ("Unable to connect to MC COM")
return nil
end
print ("MC connected using MCIO Server")
end
collectgarbage ()
%Private.MCComInit = 1
end
return 0
end
function Private.MCConnectComDirect ()
if (%Private.MCComInit == 0) then
if (%Private.MCA == nil) then
%Private.MCA = luacom_CreateObject ("MediaJukebox Application")
if (%Private.MCA == nil) then
print ("Unable to connect to MC COM")
return nil
end
print ("MC connected")
end
collectgarbage ()
%Private.MCComInit = 1
end
return 0
end
function Public.MCGetLyrics ()
%Public.LYRICSAVL = 0
%Public.LYRICSHTML = ""
%Private.MCConnectComDirect()
if (%Private.MCA ~= nil) then
local mjCurPlaylist = %Private.MCA:GetCurPlaylist()
if mjCurPlaylist then
local lCurrentlyPlaying = mjCurPlaylist:Position()
if ((lCurrentlyPlaying >= 0) and (lCurrentlyPlaying < mjCurPlaylist:GetNumberFiles())) then
-- Get the file
mjTrack = mjCurPlaylist:GetFile(lCurrentlyPlaying)
%Public.LYRICSTITLE = mjTrack:Name()
--CurrentFile = mjTrack:Filename()
%Public.LYRICSHTML =mjTrack:Lyrics()
%Public.LYRICSHTML = gsub(%Public.LYRICSHTML, "\r", "
") -- \r
if (strlen (%Public.LYRICSHTML) > 100) then
%Public.LYRICSAVL = 1
end
end
lCurrentlyPlaying = nil
end
mjCurPlaylist = nil
end
collectgarbage ()
end
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.