Ticket #2930: tuner_busy.diff

File tuner_busy.diff, 4.9 KB (added by skamithi, 17 years ago)

final patch.

  • libs/libmythtv/remoteutil.h

     
    6363MPUBLIC int RemoteCheckForRecording(ProgramInfo *pginfo);
    6464MPUBLIC int RemoteGetRecordingStatus(ProgramInfo *pginfo, int overrecsecs,
    6565                                     int underrecsecs);
    66 
     66MPUBLIC vector<ProgramInfo *> *RemoteGetCurrentlyRecordingList(void);
    6767#endif
    6868
    6969/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • libs/libmythtv/tv_play.cpp

     
    103103
    104104    while (!quitAll)
    105105    {
     106        int freeRecorders = RemoteGetFreeRecorderCount();
    106107        if (curProgram)
    107108        {
    108109            if (!tv->Playback(curProgram))
    109110                quitAll = true;
    110111        }
     112        else if (!freeRecorders)
     113        {
     114            vector<ProgramInfo *> *reclist;
     115            reclist = RemoteGetCurrentlyRecordingList();
     116            if (reclist->empty())
     117            {
     118                VERBOSE(VB_PLAYBACK, LOC_ERR +
     119                        "Failed to get recording show list");
     120                quitAll = true;
     121            }
     122
     123            int numrecordings = reclist->size();
     124            if (numrecordings > 0)
     125            {
     126                if (numrecordings == 1)
     127                {
     128                    curProgram = new ProgramInfo(*reclist->at(0));
     129                }
     130                else
     131                {
     132                    ProgramInfo *p = NULL;
     133                    QStringList recTitles;
     134                    QString buttonTitle;
     135                    vector<ProgramInfo *>::iterator it = reclist->begin();
     136                    while (it != reclist->end())
     137                    {
     138                        p = *it;
     139                        buttonTitle = tr("Chan %1: %2")
     140                            .arg(p->chanstr).arg(p->title);
     141                        recTitles.append(buttonTitle);
     142                        it++;
     143                    }
     144                    int ret = MythPopupBox::showButtonPopup(
     145                                    gContext->GetMainWindow(),
     146                                    "",
     147                                    tr("All Tuners are Busy.\n"
     148                                       "Select a Current Recording"),
     149                                    recTitles, 1);
     150                    if (ret == -1)
     151                    {
     152                        quitAll = true;
     153                    }
     154                    else
     155                    {
     156                        p = reclist->at(ret);
     157                        curProgram = new ProgramInfo(*p);
     158                    }
     159                }
     160            }
     161
     162            if (reclist)
     163                delete reclist;
     164            continue;
     165        }
    111166        else
    112167        {
    113168            if (!tv->LiveTV(showDialogs, startInGuide))
  • libs/libmythtv/remoteutil.cpp

     
    426426    return retval;
    427427}
    428428
     429/*
     430 * \brief return list of currently recording shows
     431 */
     432vector<ProgramInfo *> *RemoteGetCurrentlyRecordingList(void)
     433{
     434    QString str = "QUERY_RECORDINGS ";
     435    str += "Recording";
     436    QStringList strlist = str;
     437
     438    vector<ProgramInfo *> *reclist = new vector<ProgramInfo *>;
     439    vector<ProgramInfo *> *info = new vector<ProgramInfo *>;
     440    if (!RemoteGetRecordingList(info, strlist))
     441    {
     442        if (info)
     443            delete info;
     444        return reclist;
     445    }
     446
     447    ProgramInfo *p = NULL;
     448    vector<ProgramInfo *>::iterator it = info->begin();
     449    // make sure whatever remotegetrecordinglist returned
     450    // only has rsRecording shows
     451    for ( ; it != info->end(); it++)
     452    {
     453        p = *it;
     454        if (p->recstatus == rsRecording)
     455            reclist->push_back(new ProgramInfo(*p));
     456    }
     457   
     458    if (info)
     459        delete info;
     460
     461    return reclist;
     462}
    429463/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • programs/mythbackend/mainserver.cpp

     
    10991099        "  recorded.starttime = recordedprogram.starttime ) "
    11001100        "WHERE ( recorded.deletepending = 0 OR "
    11011101        "        DATE_ADD(recorded.lastmodified, INTERVAL 5 MINUTE) <= NOW() "
    1102         "      ) "
    1103         "ORDER BY recorded.starttime";
     1102        "      ) ";
    11041103
     1104    if (type == "Recording")
     1105        thequery += "AND recorded.endtime >= NOW() AND "
     1106            "recorded.starttime <= NOW()";
     1107
     1108    thequery += "ORDER BY recorded.starttime";
     1109
    11051110    if (type == "Delete")
    11061111        thequery += " DESC";
    11071112