Index: remoteutil.cpp =================================================================== RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteutil.cpp,v retrieving revision 1.26 diff -u -d -r1.26 remoteutil.cpp --- remoteutil.cpp 14 Mar 2004 05:59:47 -0000 1.26 +++ remoteutil.cpp 29 Mar 2004 05:58:10 -0000 @@ -372,3 +372,21 @@ return retval; } +ProgramInfo *RemoteGetCurrentRecording(void) +{ // returns proginfo for an active recording on the first encoder (assuming cardid is 1) + int recnum = RemoteIsRecording(); + if (recnum <= 0) + return NULL; + + RemoteEncoder *recenc = RemoteGetExistingRecorder(1); + if (recenc == NULL) + return NULL; + + recenc->Setup(); + if (!recenc->IsRecording()) + return NULL; + + ProgramInfo *program = recenc->GetRecording(); + delete recenc; + return program; +} Index: remoteutil.h =================================================================== RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteutil.h,v retrieving revision 1.20 diff -u -d -r1.20 remoteutil.h --- remoteutil.h 14 Mar 2004 05:59:47 -0000 1.20 +++ remoteutil.h 29 Mar 2004 05:58:10 -0000 @@ -30,5 +30,6 @@ int RemoteCheckForRecording(ProgramInfo *pginfo); int RemoteGetRecordingStatus(ProgramInfo *pginfo, int overrecsecs, int underrecsecs); +ProgramInfo *RemoteGetCurrentRecording(void); #endif Index: tv_play.cpp =================================================================== RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v retrieving revision 1.171 diff -u -d -r1.171 tv_play.cpp --- tv_play.cpp 27 Mar 2004 08:17:40 -0000 1.171 +++ tv_play.cpp 29 Mar 2004 05:58:18 -0000 @@ -351,24 +351,101 @@ if (!testrec->IsValidRecorder()) { + bool retryok = false; if (showDialogs) { - QString title = tr("MythTV is already using all available " - "inputs for recording. If you want to " - "watch an in-progress recording, select one " - "from the playback menu. If you want to " - "watch live TV, cancel one of the " - "in-progress recordings from the delete " - "menu."); + ProgramInfo *currentrecording = RemoteGetCurrentRecording(); + if (currentrecording) + { + QString title = "A recording is currently in progress:\n\n"; + title += "Title: " + currentrecording->title; + if (!currentrecording->subtitle.isNull() && !currentrecording->subtitle.isEmpty()) + title += " - \"" + currentrecording->subtitle + " \""; + title += "\n\n"; + + QString dateformat = gContext->GetSetting("DateFormat", "ddd MMMM d"); + QString timeformat = gContext->GetSetting("TimeFormat", "h:mm AP"); + QDateTime startts = currentrecording->startts; + QDateTime endts = currentrecording->endts; + QString timedate = startts.date().toString(dateformat) + ", " + + startts.time().toString(timeformat) + " - " + + endts.time().toString(timeformat); + title += "Air Date: " + timedate + "\n"; + + QString timediff = ""; + QDateTime now = QDateTime::currentDateTime(); + endts = currentrecording->endts; + int posttime = endts.secsTo(currentrecording->recendts); + if (now.secsTo(endts) <= 0) + { + // in post-roll + timediff = QString("Recording %1 minute%2 after end of program") + .arg(posttime/60).arg((posttime<=60)?"":"s"); + } + else + { + // in normal record + if (now.secsTo(endts) > 120) + timediff = QString("%1 minutes remaining (plus %2 minute%3 after)") + .arg(now.secsTo(endts.addSecs(60))/60).arg(posttime/60).arg((posttime<=60)?"":"s"); + else + timediff = QString("%1 seconds remaining (plus %2 minute%3 after)") + .arg(now.secsTo(endts)).arg(posttime/60).arg((posttime<=60)?"":"s"); + } + title += timediff + "\n"; + title += "Current time is " + now.toString(dateformat) + ", " + now.toString(timeformat) + "\n\n"; + + title += "Select an action to take:"; - DialogBox diag(gContext->GetMainWindow(), title); - diag.AddButton(tr("Cancel and go back to the TV menu")); - diag.exec(); - } + DialogBox diag(gContext->GetMainWindow(), title); + diag.AddButton(tr("Return to Menu")); + diag.AddButton(tr("Watch Recording")); + diag.AddButton(tr("Stop Recording and Watch Live TV")); + int result = diag.exec(); + switch (result) + { + case 2: // watch the recording + if (PlayFromRecorder(RemoteIsRecording()) == 1) + { + delete currentrecording; + delete testrec; + return 1; + } + break; - delete testrec; - - return 0; + case 3: // cancel the recording/go to live TV + RemoteStopRecording(currentrecording); + delete testrec; + testrec = RemoteRequestRecorder(); + if (!testrec) + return 0; + if (testrec->IsValidRecorder()) + retryok = true; + break; + } + + delete currentrecording; + } + else + { + QString title = tr("MythTV is already using all available " + "inputs for recording. If you want to " + "watch an in-progress recording, select one " + "from the playback menu. If you want to " + "watch live TV, cancel one of the " + "in-progress recordings from the delete " + "menu."); + DialogBox diag(gContext->GetMainWindow(), title); + diag.AddButton(tr("Cancel and go back to the TV menu")); + diag.exec(); + } + } + + if (!retryok) + { + delete testrec; + return 0; + } } activerecorder = recorder = testrec;