void ViewScheduleDiff::showStatus(MythUIButtonListItem *item) { ProgramInfo *pi = CurrentProgram(); if (!pi) return; QString timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP"); QString message = pi->toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += RecStatus::toDescription(pi->GetRecordingStatus(), pi->GetRecordingRuleType(), pi->GetRecordingStartTime()); if (pi->GetRecordingStatus() == RecStatus::Conflict || pi->GetRecordingStatus() == RecStatus::LaterShowing) { message += " " + QObject::tr("The following programs will be recorded " "instead:") + "\n\n"; ProgramList::const_iterator it = m_recListAfter.begin(); for (; it != m_recListAfter.end(); ++it) { const ProgramInfo *pa = *it; if (pa->GetRecordingStartTime() >= pi->GetRecordingEndTime()) break; if (pa->GetRecordingEndTime() > pi->GetRecordingStartTime() && (pa->GetRecordingStatus() == RecStatus::WillRecord || pa->GetRecordingStatus() == RecStatus::Recording)) { message += QString("%1 - %2 %3\n") .arg(pa->GetRecordingStartTime() .toLocalTime().toString(timeFormat)) .arg(pa->GetRecordingEndTime() .toLocalTime().toString(timeFormat)) .arg(pa->toString(ProgramInfo::kTitleSubtitle, " - ")); } } } QString title = QObject::tr("Program Status"); MythScreenStack *mainStack = GetMythMainWindow()->GetStack("main stack"); MythDialogBox *dlg = new MythDialogBox(title, message, mainStack, "statusdialog", true); if (dlg->Create()) { dlg->AddButton(QObject::tr("OK")); mainStack->AddScreen(dlg); } else delete dlg; }
void ProgLister::ShowOldRecordedMenu(void) { ProgramInfo *pi = GetCurrent(); if (!pi) return; QString message = pi->toString(ProgramInfo::kTitleSubtitle, " - "); if (!pi->GetDescription().isEmpty()) message += "\n\n" + pi->GetDescription(); message += "\n\n\n" + tr("NOTE: removing items from this list will not " "delete any recordings."); QString title = tr("Previously Recorded"); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythDialogBox *menuPopup = new MythDialogBox( title, message, mainStack, "deletepopup", true); if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "deletemenu"); if (pi->IsDuplicate()) menuPopup->AddButton(tr("Allow this episode to re-record")); else menuPopup->AddButton(tr("Never record this episode")); menuPopup->AddButton(tr("Remove this episode from the list")); menuPopup->AddButton(tr("Remove all episodes for this title")); menuPopup->AddButton(tr("Cancel")); mainStack->AddScreen(menuPopup); } else { delete menuPopup; } }
QString PreviewGeneratorQueue::GeneratePreviewImage( ProgramInfo &pginfo, const QSize &size, const QString &outputfile, long long time, bool in_seconds, QString token) { QString key = QString("%1_%2x%3_%4%5") .arg(pginfo.GetBasename()).arg(size.width()).arg(size.height()) .arg(time).arg(in_seconds?"s":"f"); if (pginfo.GetAvailableStatus() == asPendingDelete) { SendEvent(pginfo, "PREVIEW_FAILED", key, token, "Pending Delete", QDateTime()); return QString(); } QString filename = (outputfile.isEmpty()) ? pginfo.GetPathname() + ".png" : outputfile; QString ret_file = filename; QString ret; bool is_special = !outputfile.isEmpty() || time >= 0 || size.width() || size.height(); bool needs_gen = true; if (!is_special) { QDateTime previewLastModified; bool streaming = filename.left(1) != "/"; bool locally_accessible = false; bool bookmark_updated = false; QDateTime bookmark_ts = pginfo.QueryBookmarkTimeStamp(); QDateTime cmp_ts; if (bookmark_ts.isValid()) cmp_ts = bookmark_ts; else if (MythDate::current() >= pginfo.GetRecordingEndTime()) cmp_ts = pginfo.GetLastModifiedTime(); else cmp_ts = pginfo.GetRecordingStartTime(); if (streaming) { ret_file = QString("%1/remotecache/%2") .arg(GetConfDir()).arg(filename.section('/', -1)); QFileInfo finfo(ret_file); if (finfo.isReadable() && finfo.lastModified() >= cmp_ts) { // This is just an optimization to avoid // hitting the backend if our cached copy // is newer than the bookmark, or if we have // a preview and do not update it when the // bookmark changes. previewLastModified = finfo.lastModified(); } else if (!IsGeneratingPreview(key)) { previewLastModified = RemoteGetPreviewIfModified(pginfo, ret_file); } } else { QFileInfo fi(filename); if ((locally_accessible = fi.isReadable())) previewLastModified = fi.lastModified(); } bookmark_updated = (!previewLastModified.isValid() || (previewLastModified <= cmp_ts)); if (bookmark_updated && bookmark_ts.isValid() && previewLastModified.isValid()) { ClearPreviewGeneratorAttempts(key); } bool preview_exists = previewLastModified.isValid(); if (0) { QString alttext = (bookmark_ts.isValid()) ? QString() : QString("\n\t\t\tcmp_ts: %1") .arg(cmp_ts.toString(Qt::ISODate)); LOG(VB_GENERAL, LOG_INFO, QString("previewLastModified: %1\n\t\t\t" "bookmark_ts: %2%3\n\t\t\t" "pginfo.lastmodified: %4") .arg(previewLastModified.toString(Qt::ISODate)) .arg(bookmark_ts.toString(Qt::ISODate)) .arg(alttext) .arg(pginfo.GetLastModifiedTime(MythDate::ISODate)) + QString("Title: %1\n\t\t\t") .arg(pginfo.toString(ProgramInfo::kTitleSubtitle)) + QString("File '%1' \n\t\t\tCache '%2'") .arg(filename).arg(ret_file) + QString("\n\t\t\tPreview Exists: %1, Bookmark Updated: %2, " "Need Preview: %3") .arg(preview_exists).arg(bookmark_updated) .arg((bookmark_updated || !preview_exists))); } needs_gen = bookmark_updated || !preview_exists; if (!needs_gen) { if (locally_accessible) ret = filename; else if (preview_exists && QFileInfo(ret_file).isReadable()) ret = ret_file; } } if (needs_gen && !IsGeneratingPreview(key)) { uint attempts = IncPreviewGeneratorAttempts(key); if (attempts < m_maxAttempts) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Requesting preview for '%1'") .arg(key)); PreviewGenerator *pg = new PreviewGenerator(&pginfo, token, m_mode); if (!outputfile.isEmpty() || time >= 0 || size.width() || size.height()) { pg->SetPreviewTime(time, in_seconds); pg->SetOutputFilename(outputfile); pg->SetOutputSize(size); } SetPreviewGenerator(key, pg); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Requested preview for '%1'").arg(key)); } else if (attempts >= m_maxAttempts) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Attempted to generate preview for '%1' " "%2 times; >= max(%3)") .arg(key).arg(attempts).arg(m_maxAttempts)); } } else if (needs_gen) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Not requesting preview for %1," "as it is already being generated") .arg(pginfo.toString(ProgramInfo::kTitleSubtitle))); IncPreviewGeneratorPriority(key, token); } UpdatePreviewGeneratorThreads(); if (!ret.isEmpty()) { QString msg = "On Disk"; QDateTime dt = QFileInfo(ret).lastModified(); SendEvent(pginfo, "PREVIEW_SUCCESS", ret, token, msg, dt); } else { uint queue_depth, token_cnt; GetInfo(key, queue_depth, token_cnt); QString msg = QString("Queue depth %1, our tokens %2") .arg(queue_depth).arg(token_cnt); SendEvent(pginfo, "PREVIEW_QUEUED", ret, token, msg, QDateTime()); } return ret; }
/** * \brief Creates a dialog for editing the recording status, * blocking until user leaves dialog. */ void ScheduleCommon::EditRecording(bool may_watch_now) { ProgramInfo *pginfo = GetCurrentProgram(); if (!pginfo) return; RecordingInfo recinfo(*pginfo); QString timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP"); QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += RecStatus::toDescription(recinfo.GetRecordingStatus(), recinfo.GetRecordingRuleType(), recinfo.GetRecordingStartTime()); if (recinfo.GetRecordingStatus() == RecStatus::Conflict || recinfo.GetRecordingStatus() == RecStatus::LaterShowing) { vector<ProgramInfo *> *confList = RemoteGetConflictList(&recinfo); if (!confList->empty()) { message += " "; message += tr("The following programs will be recorded instead:"); message += "\n"; } uint maxi = 0; for (; confList->begin() != confList->end() && maxi < 4; maxi++) { ProgramInfo *p = *confList->begin(); message += QString("%1 - %2 %3\n") .arg(p->GetRecordingStartTime() .toLocalTime().toString(timeFormat)) .arg(p->GetRecordingEndTime() .toLocalTime().toString(timeFormat)) .arg(p->toString(ProgramInfo::kTitleSubtitle, " - ")); delete p; confList->erase(confList->begin()); } message += "\n"; while (!confList->empty()) { delete confList->back(); confList->pop_back(); } delete confList; } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "recOptionPopup", true); if (!menuPopup->Create()) { delete menuPopup; return; } menuPopup->SetReturnEvent(this, "editrecording"); QDateTime now = MythDate::current(); if(may_watch_now) menuPopup->AddButton(tr("Watch This Channel")); if (recinfo.GetRecordingStatus() == RecStatus::Unknown) { if (recinfo.GetRecordingEndTime() > now) menuPopup->AddButton(tr("Record this showing"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record all showings"), qVariantFromValue(recinfo)); if (!recinfo.IsGeneric()) { if (recinfo.GetCategoryType() == ProgramInfo::kCategoryMovie) menuPopup->AddButton(tr("Record one showing"), qVariantFromValue(recinfo)); else menuPopup->AddButton(tr("Record one showing (this episode)"), qVariantFromValue(recinfo)); } menuPopup->AddButton(tr("Record all showings (this channel)"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Edit recording rule"), qVariantFromValue(recinfo)); } else if (recinfo.GetRecordingStatus() == RecStatus::Recording || recinfo.GetRecordingStatus() == RecStatus::Tuning || recinfo.GetRecordingStatus() == RecStatus::Failing || recinfo.GetRecordingStatus() == RecStatus::Pending) { if (recinfo.GetRecordingStatus() != RecStatus::Pending) menuPopup->AddButton(tr("Stop this recording"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Modify recording options"), qVariantFromValue(recinfo)); } else { if (recinfo.GetRecordingStartTime() < now && recinfo.GetRecordingEndTime() > now && recinfo.GetRecordingStatus() != RecStatus::DontRecord && recinfo.GetRecordingStatus() != RecStatus::NotListed) { menuPopup->AddButton(tr("Restart this recording"), qVariantFromValue(recinfo)); } if (recinfo.GetRecordingEndTime() > now && recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kOverrideRecord && (recinfo.GetRecordingStatus() == RecStatus::DontRecord || recinfo.GetRecordingStatus() == RecStatus::PreviousRecording || recinfo.GetRecordingStatus() == RecStatus::CurrentRecording || recinfo.GetRecordingStatus() == RecStatus::EarlierShowing || recinfo.GetRecordingStatus() == RecStatus::TooManyRecordings || recinfo.GetRecordingStatus() == RecStatus::LaterShowing || recinfo.GetRecordingStatus() == RecStatus::Repeat || recinfo.GetRecordingStatus() == RecStatus::Inactive || recinfo.GetRecordingStatus() == RecStatus::NeverRecord)) { menuPopup->AddButton(tr("Record this showing"), qVariantFromValue(recinfo)); if (recinfo.GetRecordingStartTime() > now && (recinfo.GetRecordingStatus() == RecStatus::PreviousRecording || recinfo.GetRecordingStatus() == RecStatus::NeverRecord)) { menuPopup->AddButton(tr("Forget previous recording"), qVariantFromValue(recinfo)); } } if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kDontRecord && (recinfo.GetRecordingStatus() == RecStatus::WillRecord || recinfo.GetRecordingStatus() == RecStatus::CurrentRecording || recinfo.GetRecordingStatus() == RecStatus::EarlierShowing || recinfo.GetRecordingStatus() == RecStatus::TooManyRecordings || recinfo.GetRecordingStatus() == RecStatus::Conflict || recinfo.GetRecordingStatus() == RecStatus::LaterShowing || recinfo.GetRecordingStatus() == RecStatus::Offline)) { if (recinfo.GetRecordingStatus() == RecStatus::WillRecord || recinfo.GetRecordingStatus() == RecStatus::Conflict) menuPopup->AddButton(tr("Don't record this showing"), qVariantFromValue(recinfo)); const RecordingDupMethodType dupmethod = recinfo.GetDuplicateCheckMethod(); if (recinfo.GetRecordingRuleType() != kOverrideRecord && !((recinfo.GetFindID() == 0 || !IsFindApplicable(recinfo)) && recinfo.GetCategoryType() == ProgramInfo::kCategorySeries && recinfo.GetProgramID().contains(QRegExp("0000$"))) && ((!(dupmethod & kDupCheckNone) && !recinfo.GetProgramID().isEmpty() && (recinfo.GetFindID() != 0 || !IsFindApplicable(recinfo))) || ((dupmethod & kDupCheckSub) && !recinfo.GetSubtitle().isEmpty()) || ((dupmethod & kDupCheckDesc) && !recinfo.GetDescription().isEmpty()) || ((dupmethod & kDupCheckSubThenDesc) && (!recinfo.GetSubtitle().isEmpty() || !recinfo.GetDescription().isEmpty())) )) { menuPopup->AddButton(tr("Never record this episode"), qVariantFromValue(recinfo)); } } if (recinfo.GetRecordingRuleType() == kOverrideRecord || recinfo.GetRecordingRuleType() == kDontRecord) { menuPopup->AddButton(tr("Edit override rule"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete override rule"), qVariantFromValue(recinfo)); } else { if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingStatus() != RecStatus::NotListed) menuPopup->AddButton(tr("Add override rule"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Edit recording rule"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete recording rule"), qVariantFromValue(recinfo)); } } popupStack->AddScreen(menuPopup); }
/** * \brief Creates a dialog displaying current recording status and options * available */ void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo) { QString timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP"); QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += toDescription(recinfo.GetRecordingStatus(), recinfo.GetRecordingRuleType(), recinfo.GetRecordingStartTime()); if (recinfo.GetRecordingStatus() == rsConflict || recinfo.GetRecordingStatus() == rsLaterShowing) { vector<ProgramInfo *> *confList = RemoteGetConflictList(&recinfo); if (!confList->empty()) { message += " "; message += tr("The following programs will be recorded instead:"); message += "\n"; } uint maxi = 0; for (; confList->begin() != confList->end() && maxi < 4; maxi++) { ProgramInfo *p = *confList->begin(); message += QString("%1 - %2 %3\n") .arg(p->GetRecordingStartTime() .toLocalTime().toString(timeFormat)) .arg(p->GetRecordingEndTime() .toLocalTime().toString(timeFormat)) .arg(p->toString(ProgramInfo::kTitleSubtitle, " - ")); delete p; confList->erase(confList->begin()); } message += "\n"; while (!confList->empty()) { delete confList->back(); confList->pop_back(); } delete confList; } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "notRecOptionPopup", true); if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "schedulenotrecording"); QDateTime now = MythDate::current(); if ((recinfo.GetRecordingStartTime() < now) && (recinfo.GetRecordingEndTime() > now) && (recinfo.GetRecordingStatus() != rsDontRecord) && (recinfo.GetRecordingStatus() != rsNotListed)) { menuPopup->AddButton(tr("Restart recording this showing"), qVariantFromValue(recinfo)); } if (recinfo.GetRecordingEndTime() > now) { if ((recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kOverrideRecord) && (recinfo.GetRecordingStatus() == rsDontRecord || recinfo.GetRecordingStatus() == rsPreviousRecording || recinfo.GetRecordingStatus() == rsCurrentRecording || recinfo.GetRecordingStatus() == rsEarlierShowing || recinfo.GetRecordingStatus() == rsNeverRecord || recinfo.GetRecordingStatus() == rsRepeat || recinfo.GetRecordingStatus() == rsInactive || recinfo.GetRecordingStatus() == rsLaterShowing)) { menuPopup->AddButton(tr("Record this showing anyway"), qVariantFromValue(recinfo)); if (recinfo.GetRecordingStatus() == rsPreviousRecording || recinfo.GetRecordingStatus() == rsNeverRecord) { menuPopup->AddButton(tr("Forget previous recording"), qVariantFromValue(recinfo)); } } if (recinfo.GetRecordingRuleType() != kOverrideRecord && recinfo.GetRecordingRuleType() != kDontRecord) { if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingStatus() != rsPreviousRecording && recinfo.GetRecordingStatus() != rsCurrentRecording && recinfo.GetRecordingStatus() != rsNeverRecord && recinfo.GetRecordingStatus() != rsNotListed) { if (recinfo.GetRecordingStartTime() > now) { menuPopup->AddButton(tr("Don't record this showing"), qVariantFromValue(recinfo)); } const RecordingDupMethodType dupmethod = recinfo.GetDuplicateCheckMethod(); if (recinfo.GetRecordingRuleType() != kOneRecord && !((recinfo.GetFindID() == 0 || !IsFindApplicable(recinfo)) && recinfo.GetCategoryType() == "series" && recinfo.GetProgramID().contains(QRegExp("0000$"))) && ((!(dupmethod & kDupCheckNone) && !recinfo.GetProgramID().isEmpty() && (recinfo.GetFindID() != 0 || !IsFindApplicable(recinfo))) || ((dupmethod & kDupCheckSub) && !recinfo.GetSubtitle().isEmpty()) || ((dupmethod & kDupCheckDesc) && !recinfo.GetDescription().isEmpty()) || ((dupmethod & kDupCheckSubThenDesc) && (!recinfo.GetSubtitle().isEmpty() || !recinfo.GetDescription().isEmpty())) )) { menuPopup->AddButton(tr("Never record this episode"), qVariantFromValue(recinfo)); } } if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kOneRecord && recinfo.GetRecordingStatus() != rsNotListed) { menuPopup->AddButton(tr("Override this showing with options"), qVariantFromValue(recinfo)); } menuPopup->AddButton(tr("Edit recording options"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete recording rule"), qVariantFromValue(recinfo)); } if (recinfo.GetRecordingRuleType() == kOverrideRecord || recinfo.GetRecordingRuleType() == kDontRecord) { menuPopup->AddButton(tr("Edit override options"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete override rule"), qVariantFromValue(recinfo)); } } popupStack->AddScreen(menuPopup); } else delete menuPopup; }
/** \fn StatusBox::doAutoExpireList() * \brief Show list of recordings which may AutoExpire */ void StatusBox::doAutoExpireList(bool updateExpList) { if (m_iconState) m_iconState->DisplayState("autoexpire"); m_logList->Reset(); QString helpmsg(tr("The AutoExpire List shows all recordings " "which may be expired and the order of " "their expiration. Recordings at the top " "of the list will be expired first.")); if (m_helpText) m_helpText->SetText(helpmsg); if (m_justHelpText) m_justHelpText->SetText(helpmsg); ProgramInfo* pginfo; QString contentLine; QString detailInfo; QString staticInfo; long long totalSize(0); long long liveTVSize(0); int liveTVCount(0); long long deletedGroupSize(0); int deletedGroupCount(0); vector<ProgramInfo *>::iterator it; if (updateExpList) { for (it = m_expList.begin(); it != m_expList.end(); ++it) delete *it; m_expList.clear(); RemoteGetAllExpiringRecordings(m_expList); } for (it = m_expList.begin(); it != m_expList.end(); ++it) { pginfo = *it; totalSize += pginfo->GetFilesize(); if (pginfo->GetRecordingGroup() == "LiveTV") { liveTVSize += pginfo->GetFilesize(); liveTVCount++; } else if (pginfo->GetRecordingGroup() == "Deleted") { deletedGroupSize += pginfo->GetFilesize(); deletedGroupCount++; } } staticInfo = tr("%n recording(s) consuming %1 (is) allowed to expire\n", "", m_expList.size()).arg(sm_str(totalSize / 1024)); if (liveTVCount) staticInfo += tr("%n (is) LiveTV and consume(s) %1\n", "", liveTVCount) .arg(sm_str(liveTVSize / 1024)); if (deletedGroupCount) staticInfo += tr("%n (is) Deleted and consume(s) %1\n", "", deletedGroupCount) .arg(sm_str(deletedGroupSize / 1024)); for (it = m_expList.begin(); it != m_expList.end(); ++it) { pginfo = *it; QDateTime starttime = pginfo->GetRecordingStartTime(); QDateTime endtime = pginfo->GetRecordingEndTime(); contentLine = MythDateTimeToString(starttime, kDateFull | kSimplify) + " - "; contentLine += "(" + ProgramInfo::i18n(pginfo->GetRecordingGroup()) + ") "; contentLine += pginfo->GetTitle() + " (" + sm_str(pginfo->GetFilesize() / 1024) + ")"; detailInfo = MythDateTimeToString(starttime, kDateTimeFull | kSimplify) + " - " + MythDateTimeToString(endtime, kDateTimeFull | kSimplify); detailInfo += " (" + sm_str(pginfo->GetFilesize() / 1024) + ")"; detailInfo += " (" + ProgramInfo::i18n(pginfo->GetRecordingGroup()) + ")"; detailInfo += "\n" + pginfo->toString(ProgramInfo::kTitleSubtitle, " - "); AddLogLine(contentLine, staticInfo, detailInfo, staticInfo + detailInfo); } }