[mythtv-users] Re: Query for the scheduled recording

Paul mythtv at dsl.pipex.com
Sat Jul 23 06:38:07 EDT 2005

>Hi, I am trying to write a small app that will serve as a replacement
>for the system's shutdown/reboot/halt but with one major difference
> - it will query >the mythtv database to get the time of the next
>scheduled recording and set the BIOS wakeup time.

>The purpose of this app is to enable the user to manually
>shutdown the box and still have it automatically wakeup when
>the time comes.

>I have made some pretty good progress but now I need to find
>out the time of the next recording from the database. I looked at
>the code for an >example of the SQL query and found out that
>the backend just keeps a list of all the scheduled recordings and
>does not query the DB at time of >shutdown.

>Can someone help me out and let me know the query that will
>allow me to get information on the next recording(s). It can be
>a query that will return >all scheduled recordings. I can change it to fit.

>Thanks for your help!

>-- Mitko

I'm actually working on a welcome/status app that is a myth style
themed dialog that among other things shows what the next scheduled
recording is. It's a lot simpler than you think to get the schedule. See
code below.

It could be my new app will do what you want it to. Its really designed
for people like you and me who don't want to leave the myth computer
running 24hrs a day but do want it to still record scheduled recordings.
It compliments the existing shutdown/wakeup stuff which can be made
to work as you want if it is setup properly.

I still have a few issues to fix. I'll send the patch to the tracker when

code snippet to get next scheduled recording
    m_nextRecordingStart = QDateTime();

    ProgramList *progList = new ProgramList(true);
    ProgramInfo *progInfo;
    QString status = "";

    if (progList->FromScheduler(m_hasConflicts))
        if (progList->count() > 0)
            for (progInfo = progList->first(); progInfo; progInfo =
                if (progInfo->recstatus == rsWillRecord)
                    // save the details of the earliest scheduled recording
                    if (m_nextRecordingStart.isNull() ||
                            m_nextRecordingStart > progInfo->recstartts)
                        m_nextRecordingStart = progInfo->recstartts;

                        status = progInfo->title;
                        if (progInfo->subtitle != "")
                            status += " (" + progInfo->subtitle + ")";

                        status += "\n" + progInfo->recstartts.
                                toString("ddd dd MMM yyyy (hh:mm") + " to "

Hope it helps.


More information about the mythtv-users mailing list