View Full Version : Time Server is unreliable !?!
mhund
July 28th, 2004, 10:25 AM
Hi,
for firing a command, I use two time events from time server; one in the morning and one in the evening. But the time server does not shoot the events in most cases (confirmed by logger). Only when I start the timer server manually by sending events by hand, then the server seems to recover and works automatically from this moment on and falls asleep over night again.
Question: Is there any known bug with a workarround?
Question: Ending girder by hand, sometimes one error message occurs "cannot unload plugin" or so. Any relation to my issue?
Question: Are there any conflicting Plugins, I have in use? (latest versions)
CM11-Plugin
GenericX10 Plugin
HTML OSD
Internet Client/Server
Keyboard
Logging
Question OSD
Speech
TimeServer
USB-UIRT
Question: I configured the event starting at 20:00:00 ending at 20:00:03 every day. Are these 3 seconds timeframe too small for the event server to awake?
Thanks for help,
mhund
quixote
July 28th, 2004, 10:41 AM
You're not alone on this matter. I have a similar setup in which I have the volume mute at 11:00pm and unmute at 8:00. It does not seem reliable either.
Treetop
July 28th, 2004, 10:49 AM
hmmm
I havent noticed any problems with this, but then again I dont use it for everyday tasks.... weekly chores (trash night) and b-days reminders.
Now you got me curious... time to setup some daily events and see how they go.
Mark F
July 28th, 2004, 10:59 AM
Do these machines go "green" (sleep/hibernate/etc.) when not in use?
mhund
July 28th, 2004, 11:09 AM
Do these machines go "green" (sleep/hibernate/etc.) when not in use?
Hi Mark,
No, the machine is always running and in use; 24h a day. Its only the time server, which is not working after a while. I tried to change the frequence to every minute and every 10 seconds. It worked for at least an hour.
mhund
quixote
July 28th, 2004, 11:17 AM
I use the "I'm busy" plugin, and only turn off the monitor (with the Girder command) and mute the sound. Hibernation mode is off.
Promixis
July 28th, 2004, 11:37 AM
Marcel,
Can you reliably produce the plugin cannot exit message?
Are you using luacom?
mhund
July 28th, 2004, 11:45 AM
Marcel,
Can you reliably produce the plugin cannot exit message?
Are you using luacom?
Hi Mike,
are you calling me? My name is not Marcel, but nevertheless... No I cannot produce this error message. I had it after reducing the time server frequence to every n second and I assume the message comes from closing girder while an plugin is busy.
mhund
Promixis
July 28th, 2004, 11:48 AM
Ok, sorry about the mistake... :oops:
I have used the timeserver in the past without problem...
I don't have any immediate ideas..?
mhund
July 28th, 2004, 11:57 AM
Hi Mike,
no problem. If no one in this board can help, I will take fallback WinXP Task Planer to fire an event by event.exe. Should work too, although its sad.
mhund
danward79
July 29th, 2004, 09:52 AM
I use it to trigger an event every couple of days seems fine for me.
Dan
VaioUserChris
July 29th, 2004, 06:02 PM
Mhund,
If you want to operate this through Girder, another approach would be Lua. The winluaex plugin allows Lua to get the current time. So you could create a schedule of events with applicable times in a text file, have lua read the text file, and trigger the appropriate event when the time is reached.
Based on samples posted by others on this forum, I've been using Lua in this manner to operate as the timer for recording tv shows on my computer.
If you're interested I'll post my script. With a little modification it should be able to do whatever you want.
Chris
Treetop
July 29th, 2004, 06:11 PM
If you're interested I'll post my script. With a little modification it should be able to do whatever you want.
I know this offer was made to mhund, but I was wondering if I could also take a look at it or if you wouldn't mind posting it for all to see. I'm still struggling with LUA (in the middle of Chapter 3 in the LUA5 book), and any and every example helps.
(well, it also confuses me...but the book alone is doing that)
Treetop
VaioUserChris
July 29th, 2004, 07:07 PM
Hi Treetop,
My script follows. Sorry its so long.
I've tried to describe what each section does but if you don't understand anything just let me know and I'll explain.
-- the first section of this program defines all the necessary functions
-- TimerKill function is used to obliterate timers. With this, when you cancel
-- a timer, Timer variable will no longer exist. Useful to make sure you don't
-- try to cancel a timer that does not exist such as in the RecordStart function.
function TimerKill ()
Timer.Cancel ()
Timer = nil
end
-- CurrentDate function returns today's date and time
-- "%A" = Day of week, full text format
-- "%w" = Day of week as numeric (Sunday = 0)
-- "%m" = Month (numeric)
-- "%d" = Day of Month
-- "%y" = Year
function CurrentDate ()
local err
Timer = TIMER_CreateObject ()
err = Timer.Create ("","TimerDate ()","",1)
curday = date("%A")
curdaynum = date ("%w")
curdaynum = tonumber(curdaynum)
curmonth = date ("%m")
curdate = date ("%d")
curhour = date("%H")
curmin = date("%M")
curyear = date("%y")
todaydate = curmonth .. "/" .. curdate .. "/" .. curyear
TimerKill ()
timerday=curday
end
-- Function Datareader reads the timer file, looks for date matches and if finds a match,
-- adds to watch list for today. Also looks for daily matches (i.e. every Monday)
-- or weekday match (M-F). If any of these match, the progam is added to the
-- watch list.
--
-- The timer file is just a text file that looks like this:
--
-- <program start>
-- station: 340
-- date: 07/30/04
-- start: 08:58
-- end: 10:02
-- program_title: The Screen Savers
-- program_subtitle: '' - (Computers/Technology)
-- frequency: Weekday
--
-- The first line tells Girder to load the following seven lines as one event.
-- You can repeat as many events as you want in the file by repeating this format.
-- The time is in military time. And you can schedule events to repeat by using
-- "Weekday", "Daily", "Sunday" (or another day of the week) in the last line.
-- If the event is only once, use "Once"
function Datareader ()
CurrentDate () -- this gets the current date
header = {"station: ","date: ","start: ","end: ","program_title: ","program_subtitle: ","frequency: "}
startmarker = "<program start>"
readline = {}
progstation = {}
progdate = {}
progstart = {}
progend = {}
progtitle = {}
progdescription = {}
tempf = readfrom(openfilename)
progtotal = 0
while 1 do
templine = read(tempf)
if not templine then break end
if strfind(templine, startmarker) then -- if line contains program start marker,
set = 0
for tempi = 1, 7 do
templine = read(tempf) -- read next line
readline[tempi] = gsub(templine, header[tempi],"")
end
starthour = tonumber(strsub(readline[3],1,2))
startmin = tonumber(strsub(readline[3],4,5))
if readline[2] == todaydate or readline[7] == "Daily" or readline[7] == curday then set = 1 end
if readline[7] == "Weekday" and curdaynum>0 and curdaynum<6 then set = 1 end
if starthour<tonumber(curhour) then set = 0 end
if starthour==tonumber(curhour) and startmin<tonumber(curmin)then set = 0 end
if set == 1 then
progtotal=progtotal+1
progstation[progtotal] = readline[1]
progdate[progtotal] = readline[2]
progstart[progtotal] = readline[3]
progend[progtotal] = readline[4]
progtitle[progtotal] = readline[5]
progdescription[progtotal] = readline[6]
if tonumber(readline[1])>= DIGITAL_START then needcablebox = 1 end
end
end
end
readfrom()
if needcablebox and firstpass then
messagetype = "A scheduled recording requires use of the cable box.".."\n\n"
messagetype = messagetype.."Will the cable box be left on for the recording?".."\n\n"
messagetype = messagetype.."(If the box will be off, please click NO)"
RETVAL = WINDOWS_MessageBox(messagetype,"GTimer Recording Manager",292)
if RETVAL == 6 then -- if the person said yes, note that the box will be on
cableboxon = 1
end
end
firstpass = nil
TimerMonitor (wait)
end
-- TimerMonitor function checks the time against timers and repeats until finds match
function TimerMonitor (interval)
local err
Timer = TIMER_CreateObject ()
err = Timer.Create ("","TimerHandler ()","",1)
err = Timer.Arm (interval)
end
-- TimerHandler function is the second part of the TimerMonitor function
-- This does the actual time check versus timers. When finds timer match, it returns
-- the table position of the match as "prog" and moves to recorder function.
function TimerHandler ()
hour = date ("%H")
minute = date ("%M")
second = date("%S")
curday = date("%A")
luanum = progtotal
luaosd = "Waiting "..progtotal.." Programs - "..hour..":"..minute..":"..second -- displays timers waiting and current time
TriggerEvent ("LUAOSD",18)
time = hour ..":".. minute
if timerday~=curday then -- if the day has changed (in other words if it's midnight) get new data
RestartReader ()
timerday=curday
end
for tempi = 1, progtotal do
if time == progstart[tempi] then
luaosd3 = "Recording "..tempi.." starting."
TriggerEvent ("LUAOSD",18)
prog = tempi
RecordStart (wait)
end
end
end
-- RecordStart function starts the record timer and checks current time against
-- recorder stop for this program.
function RecordStart (interval)
TimerKill ()
TriggerEvent("GP_START",18) -- Start my PVR program, Gigapocket
TriggerEvent("WAIT_3_SEC",18)
TriggerEvent("WAIT_2_SEC",18)
CHANNEL = progstation[prog]
TriggerEvent("GP_START",18) -- Call Gigapocket again to make sure have focus
if tonumber(CHANNEL)< DIGITAL_START then
-- if the channel it will record is an analog channel (which my PVR can
-- record on its own) then it tunes my PVR to the right channel
for tempi = 1,strlen(CHANNEL)do
TriggerEvent("GPC" .. strsub(CHANNEL,tempi,tempi),18)
end
TriggerEvent("GPENTER",18)
else
-- if the channel needs to be tuned through the cable box, it will set
-- my PVR to record Video 1, and tune the cable box through USB-UIRT
if not cableboxon then -- if user said the cable box is off
TriggerEvent("CABLE_POWER",18) -- turn on the cable box
TriggerEvent("WAIT_2_SEC",18)
end
for tempi = 1,strlen(CHANNEL)do
TriggerEvent("CABLE_NUM" .. strsub(CHANNEL,tempi,tempi),18)
end
TriggerEvent("GP_START",18) -- Start Gigapocket
TriggerEvent("GPV1",18) -- trigger Video 1 source
end
TriggerEvent("WAIT_2_SEC",18)
TriggerEvent("WAIT_2_SEC",18)
TriggerEvent("GPRECSTART",18) -- trigger record command
TriggerEvent("WAIT_3_SEC",18)
TriggerEvent("GP_MINIMIZE",18) -- Hide Gigapocket
local err
Timer = TIMER_CreateObject ()
err = Timer.Create ("","RecorderHandler ()","",1)
err = Timer.Arm (interval)
end
-- RecorderHandler function is the second part of the RecordStart function. This
-- checks the time against the program end time and calls function to end recording
-- when it finds a match.
function RecorderHandler ()
hour = date ("%H")
minute = date ("%M")
second = date("%S")
luanum = prog
luaosd = "Recording "..prog.." "..hour..":"..minute..":"..second.." - "..progtitle[prog]..progdescription[prog]
TriggerEvent ("LUAOSD_REC",18)
time = hour ..":".. minute
if time == progend[prog] then
RecorderStop ()
end
end
-- RecorderStop function ends the recording timer, stops the recording, and
-- calls the TimerMonitor function to wait for the next timer.
function RecorderStop ()
TimerKill ()
TriggerEvent("GP_START",18)
TriggerEvent("GPRECSTOP",18) -- Stop Recorder
TriggerEvent("GPRECSTOP",18) -- Stop Recorder 2nd time to make sure
TriggerEvent("WAIT_3_SEC",18)
TriggerEvent("GP_CLOSE",18) -- Close Gigapocket
print ("Recorder Stopped")
recorderon = nil
if tonumber(CHANNEL) >= DIGITAL_START then
if not cableboxon then -- if user said the cable box was off
TriggerEvent("CABLE_POWER",18) -- turn off the cable box
else
TriggerEvent("CABLE_LASTCH",18)
end
end
Datareader () -- re-read schedule file
end
-- RestartReader is used at midnight to check for new schedule data
function RestartReader ()
TimerKill ()
luaosd = "Checking for new data"
TriggerEvent ("LUAOSD",18)
Datareader () -- re-read schedule file
end
-- required variables - DO NOT DELETE
opendirectory = "C:\\Program Files\\girder\\Schedule\\" -- directory where the timer file data resides
openfilename2 = "programs.txt" -- timer file name
openfilename = opendirectory .. openfilename2
DIGITAL_START = 75 -- First digital channel -beyond this will use cable box and set Gigapocket to Video1
wait = 5000 -- this is how frequently the timer will check the current time, in miliseconds (5 seconds here)
-- need the following for the cable box notification and triggering
firstpass = 1
needcablebox = nil
cableboxon = nil
-- The following code starts the timer functions if the recorder is not running
if not recorderon then
if Timer then
TimerKill () -- cancels timer, if running
end
Datareader () -- this calls the function to read the data file & start timer
end
for tempi = 1,progtotal do -- for debugging
print (progstation[tempi])
print (progdate[tempi])
print (progstart[tempi])
print (progend[tempi])
print (progtitle[tempi])
print (progdescription[tempi])
end
print ("Date is ",curmonth,"/",curdate,"/",curyear)
Chris
quixote
July 29th, 2004, 07:15 PM
My brain hurts. :(
Promixis
July 29th, 2004, 07:22 PM
Mine too!
:D
Chris, have a look at both the lua windows and lua system functions plugins. They may save you some coding time....
VaioUserChris
July 29th, 2004, 07:25 PM
Yeah, I suppose it's complicated.
As you can probably tell I'm not a programmer so it's not as neat as it should be. But if you drop it into a Lua window it does make sense (at least to me...)
Chris
Promixis
July 29th, 2004, 07:37 PM
Actually, it looks really good.
quixote
July 29th, 2004, 07:39 PM
Thanks for the example Chris. It'll help. One day I'll be a LUA wizard too. :) unless I have a stroke first. :-?
mhund
July 29th, 2004, 11:37 PM
Hi,
thanks for your help. Before I analyse this LUA Skript; obe question regarding the charakter of this skript: Is it running all the time and firing an event when an predefined timestamp is reached? What does this mean to CPU usage, memory? Generally I would prefer to have something which saves performance to allow the machine to do something else. It is a HTPC which sometimes record TV or recompresses videos. Sofar CPU time is expensive.
Thanks,
Mhund
Promixis
July 30th, 2004, 05:16 AM
I wouldn't worry about performance unless you are using a sub 1G machine.
LCD Master loops every second, processing a much larger chunk of lua code. It uses < 1% system resources. Girder can easily handle > 100 of events a second.
VaioUserChris
July 30th, 2004, 08:35 AM
Hi mhund,
I was a little worried about CPU usage when I wrote the script but that seems to be unfounded. When I run the script CPU usage for girder remains extremely low - far lower than most other processes running on my system.
But I actually don't leave it running all the time. I wrote two bat files and dropped them on my desktop. One is called "Timer Start" which calls the script as a girder event through event.exe. The second is called "Timer Stop", which calls another lua script that kills the timer.
Then I can turn on and off the timer at will, without opening girder.
To help you understand my script, here is the flowchart that it follows:
Datareader
------------------ reads the timer file and loads the timers for that day into memory
------------------ Datareader then calls the next function TimerMonitor
TimerMonitor
------------------ creates the actual timer (TimerHandler) and calls it every 5 seconds
TimerHandler
------------------ checks the time and compares to all the events loaded into memory
------------------ if it can't find a match it loops with TimerMonitor every 5 seconds
------------------ when it finds a match it then calls the record function - RecordStart
------------------ also looks for midnight since the timers would need to be reloaded for the new day
------------------ if it is midnight, it calls RestartReader which reloads the timers
RecordStart
------------------ destroys the previous timer so we don't get a confilct
------------------ triggers all the necessary girder events to start a recording
------------------ then creats another timer (RecorderHandler) to watch for the end of the recording
------------------ calls RecorderHandler every 5 seconds
RecorderHandler
------------------ watches for end time match
------------------ if it doesn't find a match, it loops with the timer control at the end of RecordStart
------------------ if it finds a match it calls RecorderStop
RecorderStop
------------------ destroys the recording timer
------------------ sends girder events to stop the recording function
------------------ calls Datareader to reload the timers into memory
------------------ then the entire cycle repeats
Treetop
July 30th, 2004, 08:48 AM
THANK YOU!
Printed this out last night... 4 pages at 9pt font. So its gonna take me a long time to work through it... still stumble over syntax alone, but the documentation is excellent. I actually understand some of it! I don't know if you documented it as you wrote it, or just for us...either way, it is the one thing that I have needed... someone to tell me what the code is doing. Thank you for the Flow-chart as well... again, totally helpful.
THANK YOU once again!
So whats the word on a LUA scripting forum? Seems we have a small band of people interested in this. I doubt that it will be flooded with new messages everyday, but it may help get some others involved if information is consolidated in one area. Just an idea.
Treetop
Promixis
July 30th, 2004, 11:39 AM
We will have a lua scripting section. We are going to merging the netremote and girder web sites first...
Treetop
July 30th, 2004, 11:29 PM
Even Better
http://talk.thebabycorner.com/images/smilies/clap.gif
mhund
July 31st, 2004, 06:04 AM
Hi,
first thank you people for help. To learn about the time server problem, I installed the timer server now on a win2k server (all-purpose server) carrying a second instance of girder and communicating with the first machine (htpc). When I have new experiences with that, I will post it here...
mhund
mhund
August 2nd, 2004, 01:54 AM
Hello,
The end of the story: As I said, I installed girder with time server plugin on a different machine to observe, if the unreliability comes from the environment of my htpc. But no luck. The reliability on the other machine is as bad as on my first pc. That means, time server events come over some hours and after a day or so it falls asleep.
Sofar: I uninstalled TimeServer and now I use windows task skeduler for firing events with event.exe. Till now it works reliable. Lets see ...
mhund
Promixis
August 2nd, 2004, 03:22 AM
Thanks for looking at this so carefully.
So does it work for awhile and then go to sleep? If so how long? How are you determining this (can you send me your GML)?
What OS? Girder version?
mhund
August 5th, 2004, 12:32 AM
Thanks for looking at this so carefully.
So does it work for awhile and then go to sleep? If so how long? How are you determining this (can you send me your GML)?
What OS? Girder version?
Hi Mike,
I have an update to this problem and maybe a solution/explanation; for those who are interested. I got the timer server running now, after I changed my usage of the parameters for a tine event.
My requirement: I want to fire a time event every day at a specific time. To reach it, I added a time event with
begin/end day disabled
begin/end time enabled. begin was: 06:00am; end was 06:00am plus 3 seconds.
"repeat daily" activated.
This lead to firing this event exactly one time, because the end time set to three seconds later seems to disable the whole event for the future days.
Now I changed the configuration to:
begin/end day disabled
begin time enabled and end time disabled. begin was: 06:00am
"repeat daily" activated.
And now it seems to work. My problem is the interpretation of the parameters in the time server dialogbox. unfortunately, they are not documented sofar.
mhund
Promixis
August 5th, 2004, 03:41 AM
Unfortunately , Slavo did not do any docs for it.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.