Hi Patrick,
I use the following code, that nordlicht@vdrportal send me:
time_t now = time(NULL); // thanks to nordlich@vdrportal for the following code, that char *buffer=NULL; // allows setting the channel for a timer without event int starthh,startmm,stophh,stopmm; //for getting the day of month struct tm *tm_t=localtime(&now); //we have to get away the ':' from the time string sscanf(TIMESTRING(now),"%2d:%2d",&starthh,&startmm); sscanf(TIMESTRING(now+Setup.InstantRecordTime*60),"%2d:%2d",&stophh,&stopmm); //active:channel:day_of_month:starttime:endtime:priority:durability:title: asprintf(&buffer,"1:%d:%d:%d%d:%d%d:%d:%d:%s:",item->channel->Number(),tm_t->tm_mday,starthh,startmm,stophh,stopmm,Setup.DefaultPriority,Setup.DefaultLifetime,item->channel->Name()); timer=new cTimer(false,false); if(timer->Parse(buffer)) free(buffer);
it abuses the parse function for that purpose. Of course, an extended constructur would be much better.
BR,
Christian.
Patrick Fischer schrieb:
Hello I want to create a new instant Recording from a Plugin at a specific Channel.
The normal way to create a instant Recording is to call
cRecordControls::Start ();
This will create a Recording of the current Channel.
So if I want to create a recording on an different Channel, I can create a new Timer and give this new Timer to cRecordControls::Start ().
cTimer *timer = new cTimer(true,false); cRecordControls::Start (timer);
But new cTimer(true, false) also use the current Channel.
Is it possible that Klaus change the Constructor from cTimer::cTimer(bool Instant, bool Pause) to cTimer::cTimer(bool Instant, bool Pause, int channel = 0)
And the line 30 in timers.c from channel = Channels.GetByNumber(cDevice::CurrentChannel()); to channel = Channels.GetByNumber(channel?channel:cDevice::CurrentChannel());
In this case i can create a new recording by cTimer *timer = new cTimer(true,false,MYCHANNEL); cRecordControls::Start (timer);
please!!! :-)
Yours sincerely, Patrick
vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr