[mythtv-users] How to shedule recordings from command line?

Mario Bernard Mario.Bernhard at gmx.net
Wed Jul 12 19:10:10 UTC 2006


----- Original Message ----- 
From: "Brad Templeton" <brad+myth at templetons.com>
To: "Discussion about mythtv" <mythtv-users at mythtv.org>
Sent: Wednesday, 12. July 2006 20:37
Subject: Re: [mythtv-users] How to shedule recordings from command line?


>On Wed, Jul 12, 2006 at 07:35:43PM +0200, Mario Bernard wrote:
>> I have made a Scheduling Interface for use with TVGenial, a Windows oriented TV Schedule Applikation. It allows to record programs and calls an DOS Command line. I used this interface to create sql scripts which manupulate the database. 
>> Backdraws are, that I should have knowledge about the DB and changing the DB does not always reschedule the new recordings immediately.
>> 
>> It would be great if I could call a PHP program from Mythweb, specifying the recording arguments and the job gets done.
>> One year ago, before a lot of reworking was projected for Mythweb, I had a look, but could not easily identify if one PHP Program could do the job.
>> 
>> Mario
>> 


>Well, in that sense, mysql is a command line interface for mythtv.  One can
>schedule programs in mythtv just with simple sql queries, often doable from
>the command line interface of the mysql command.

>Or of course it's easy to do SQL in PHP, Perl and other programming languages.

>Invoking a PHP program from mythweb is trivial.  Mythweb IS a PHP program.

>The only missing element, after you do an SQL command to schedule a show,
>is if you want to schedule a show _immediately_ you need to tell the backend
>to do a schedule run.   This is a pretty simple command which you can
>even do by hand in a pinch, but you will find a very simple library routine
>to do it in the mythlib.pl library with tvwish, and I heard a report that
>SVN now has contributed to it a similar library simply called the perl bindings.

>I don't know how long it takes for mythtv to do a reschedule_recordings on its
>own spontaneously, but I believe it does happen, in which case for recordings
>in the future you can just do SQL commands and that would be enough.

These are the sql commands I used. It looks for a schedule on a specific channel and a specific starttime:

insert into record (type, chanid, starttime, startdate, endtime, enddate, title, subtitle, description, category, profile, autoexpire, recgroup, dupmethod, dupin, station, seriesid, autocommflag, endoffset) select 1, p.chanid, time(starttime), date(starttime), time(endtime), date(endtime), title, subtitle, description, category, 'Default', 1, 'Default', 6, 15, c.callsign, seriesid, 1, ( time_to_sec(timediff('%4 %5', '%2 %3')) - time_to_sec(timediff(endtime, starttime)) )/60 from program p, channel c where c.chanid=%1 and starttime='%2 %3' and c.chanid = p.chanid; 

insert into recordmatch (recordid, chanid, starttime, manualid) select recordid, r.chanid, addtime(startdate, starttime), 0 from  record r, channel c where c.chanid=%1 and c.chanid = r.chanid and r.startdate='%2' and r.starttime = '%3'; 

Generating the first row into 'record' was easy. That it also required a row in 'recordmatch' didn't came up my mind for a long time.
I had a quick glance at mythweb again, but do not see any updates or insert into record/recordmatch.
Are the recordingschedules transfer via a socket in "./includes/mythbackend.php" ?

>> It would be great if I could call a PHP program from Mythweb, specifying the recording arguments and the job gets done.
>Invoking a PHP program from mythweb is trivial.  Mythweb IS a PHP program.

With 'arguments' I meant a provided API (documented) which calls the Mythweb module doing the actual job.
At the moment Mythweb scans a http post and does furhter processing before it calls a job which updates the recording schedules.
It would be great not to do a lot of re-enginering. This can only be solved by a well-designed API. To design this API a person is needed who knows all specifics.
Mythweb could use this API for its own purposes.

Mario






More information about the mythtv-users mailing list