long Dvr::GetSavedBookmark( int RecordedId, int chanid, const QDateTime &recstarttsRaw, const QString &offsettype ) { if ((RecordedId <= 0) && (chanid <= 0 || !recstarttsRaw.isValid())) throw QString("Recorded ID or Channel ID and StartTime appears invalid."); RecordingInfo ri; if (RecordedId > 0) ri = RecordingInfo(RecordedId); else ri = RecordingInfo(chanid, recstarttsRaw.toUTC()); uint64_t offset; bool isend=true; uint64_t position = ri.QueryBookmark(); if (offsettype.toLower() == "position"){ ri.QueryKeyFramePosition(&offset, position, isend); return offset; } else if (offsettype.toLower() == "duration"){ ri.QueryKeyFrameDuration(&offset, position, isend); return offset; } else return position; }
bool Dvr::SetSavedBookmark( int RecordedId, int chanid, const QDateTime &recstarttsRaw, const QString &offsettype, long Offset ) { if ((RecordedId <= 0) && (chanid <= 0 || !recstarttsRaw.isValid())) throw QString("Recorded ID or Channel ID and StartTime appears invalid."); if (Offset < 0) throw QString("Offset must be >= 0."); RecordingInfo ri; if (RecordedId > 0) ri = RecordingInfo(RecordedId); else ri = RecordingInfo(chanid, recstarttsRaw.toUTC()); uint64_t position; bool isend=true; if (offsettype.toLower() == "position"){ if (!ri.QueryPositionKeyFrame(&position, Offset, isend)) return false; } else if (offsettype.toLower() == "duration"){ if (!ri.QueryDurationKeyFrame(&position, Offset, isend)) return false; } else position = Offset; ri.SaveBookmark(position); return true; }
/// \brief Copies important fields from other RecordingInfo. void RecordingInfo::clone(const RecordingInfo &other, bool ignore_non_serialized_data) { bool is_same = (chanid && recstartts.isValid() && startts.isValid() && chanid == other.GetChanID() && recstartts == other.GetRecordingStartTime() && startts == other.GetScheduledStartTime()); ProgramInfo::clone(other, ignore_non_serialized_data); if (!is_same) { delete record; record = NULL; } if (!ignore_non_serialized_data) { oldrecstatus = other.oldrecstatus; savedrecstatus = other.savedrecstatus; future = other.future; schedorder = other.schedorder; mplexid = other.mplexid; desiredrecstartts = other.desiredrecstartts; desiredrecendts = other.desiredrecendts; } }
bool Dvr::AddDontRecordSchedule(int nChanId, const QDateTime &dStartTime, bool bNeverRecord) { bool bResult = true; if (nChanId <= 0 || !dStartTime.isValid()) throw QString("Program does not exist."); ProgramInfo *pi = LoadProgramFromProgram(nChanId, dStartTime.toUTC()); if (!pi) throw QString("Program does not exist."); // Why RecordingInfo instead of ProgramInfo? Good question ... RecordingInfo recInfo = RecordingInfo(*pi); delete pi; if (bNeverRecord) { recInfo.ApplyNeverRecord(); } else recInfo.ApplyRecordStateChange(kDontRecord); return bResult; }
bool Dvr::UnDeleteRecording(int RecordedId, int chanid, const QDateTime &recstarttsRaw) { if ((RecordedId <= 0) && (chanid <= 0 || !recstarttsRaw.isValid())) throw QString("Recorded ID or Channel ID and StartTime appears invalid."); RecordingInfo ri; if (RecordedId > 0) ri = RecordingInfo(RecordedId); else ri = RecordingInfo(chanid, recstarttsRaw.toUTC()); if (ri.GetChanID() && ri.HasPathname()) { QString cmd = QString("UNDELETE_RECORDING %1 %2") .arg(ri.GetChanID()) .arg(ri.GetRecordingStartTime(MythDate::ISODate)); MythEvent me(cmd); gCoreContext->dispatch(me); return true; } return false; }
DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex, int nCount, const QString &Sort, bool Descending ) { Scheduler::SchedSortColumn sortingColumn; if (Sort.toLower() == "lastrecorded") sortingColumn = Scheduler::kSortLastRecorded; else if (Sort.toLower() == "title") sortingColumn = Scheduler::kSortTitle; else if (Sort.toLower() == "priority") sortingColumn = Scheduler::kSortPriority; else if (Sort.toLower() == "type") sortingColumn = Scheduler::kSortType; RecList recList; Scheduler::GetAllScheduled(recList, sortingColumn, !Descending); // ---------------------------------------------------------------------- // Build Response // ---------------------------------------------------------------------- DTC::RecRuleList *pRecRules = new DTC::RecRuleList(); nStartIndex = min( nStartIndex, (int)recList.size() ); nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size(); int nEndIndex = min((nStartIndex + nCount), (int)recList.size() ); for( int n = nStartIndex; n < nEndIndex; n++) { RecordingInfo *info = recList[n]; if (info != NULL) { DTC::RecRule *pRecRule = pRecRules->AddNewRecRule(); FillRecRuleInfo( pRecRule, info->GetRecordingRule() ); } } // ---------------------------------------------------------------------- pRecRules->setStartIndex ( nStartIndex ); pRecRules->setCount ( nCount ); pRecRules->setTotalAvailable( recList.size() ); pRecRules->setAsOf ( MythDate::current() ); pRecRules->setVersion ( MYTH_BINARY_VERSION ); pRecRules->setProtoVer ( MYTH_PROTO_VERSION ); while (!recList.empty()) { delete recList.back(); recList.pop_back(); } return pRecRules; }
bool Dvr::ReactivateRecording(int RecordedId) { if (RecordedId <= 0) throw QString("Recorded ID is invalid."); RecordingInfo ri = RecordingInfo(RecordedId); ri.ReactivateRecording(); return true; }
DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex, int nCount ) { RecList recList; Scheduler::GetAllScheduled(recList); // ---------------------------------------------------------------------- // Build Response // ---------------------------------------------------------------------- DTC::RecRuleList *pRecRules = new DTC::RecRuleList(); nStartIndex = min( nStartIndex, (int)recList.size() ); nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size(); int nEndIndex = min((nStartIndex + nCount), (int)recList.size() ); for( int n = nStartIndex; n < nEndIndex; n++) { RecordingInfo *info = recList[n]; if (info != NULL) { DTC::RecRule *pRecRule = pRecRules->AddNewRecRule(); FillRecRuleInfo( pRecRule, info->GetRecordingRule() ); } } // ---------------------------------------------------------------------- pRecRules->setStartIndex ( nStartIndex ); pRecRules->setCount ( nCount ); pRecRules->setTotalAvailable( recList.size() ); pRecRules->setAsOf ( MythDate::current() ); pRecRules->setVersion ( MYTH_BINARY_VERSION ); pRecRules->setProtoVer ( MYTH_PROTO_VERSION ); while (!recList.empty()) { delete recList.back(); recList.pop_back(); } return pRecRules; }
bool Dvr::StopRecording(int RecordedId) { if (RecordedId <= 0) throw QString("Recorded ID is invalid."); RecordingInfo ri = RecordingInfo(RecordedId); if (ri.GetChanID()) { QString cmd = QString("STOP_RECORDING %1 %2") .arg(ri.GetChanID()) .arg(ri.GetRecordingStartTime(MythDate::ISODate)); MythEvent me(cmd); gCoreContext->dispatch(me); return true; } else throw QString("RecordID %1 not found").arg(RecordedId); return false; }
static QDateTime get_end(const RecordingInfo &ri) { if (ri.GetDesiredEndTime().isValid()) { return (ri.GetScheduledEndTime() < ri.GetDesiredEndTime()) ? ri.GetScheduledEndTime() : ri.GetDesiredEndTime(); } else { return ri.GetScheduledEndTime(); } }
static QDateTime get_start(const RecordingInfo &ri) { if (ri.GetDesiredStartTime().isValid()) { return (ri.GetScheduledStartTime() > ri.GetDesiredStartTime()) ? ri.GetScheduledStartTime() : ri.GetDesiredStartTime(); } else { return ri.GetScheduledStartTime(); } }
/** * \brief Creates a dialog displaying current recording status and options * available */ void ScheduleCommon::ShowNotScheduledDialog(const RecordingInfo& recinfo) { QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += toDescription(recinfo.GetRecordingStatus(), recinfo.GetRecordingRuleType(), recinfo.GetRecordingStartTime()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "notSchedOptionPopup", true); if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "schedulenotscheduled"); QDateTime now = MythDate::current(); if (recinfo.GetRecordingEndTime() > now) menuPopup->AddButton(tr("Record only this showing"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record all showings"), qVariantFromValue(recinfo)); if (!recinfo.IsGeneric()) menuPopup->AddButton(tr("Record one showing of this episode"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record all showings on this channel"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Record with more options"), qVariantFromValue(recinfo)); popupStack->AddScreen(menuPopup); } else delete menuPopup; }
void ScheduleCommon::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "schedulenotrecording") { if (!qVariantCanConvert<RecordingInfo>(dce->GetData())) return; RecordingInfo recInfo = qVariantValue<RecordingInfo> (dce->GetData()); if (resulttext == tr("Reactivate")) recInfo.ReactivateRecording(); else if (resulttext == tr("Record anyway")) { recInfo.ApplyRecordStateChange(kOverrideRecord); if (recInfo.GetRecordingStartTime() < QDateTime::currentDateTime()) recInfo.ReactivateRecording(); } else if (resulttext == tr("Forget Previous")) recInfo.ForgetHistory(); else if (resulttext == tr("Don't record")) recInfo.ApplyRecordStateChange(kDontRecord); else if (resulttext == tr("Never record")) { recInfo.SetRecordingStatus(rsNeverRecord); recInfo.SetScheduledStartTime(QDateTime::currentDateTime()); recInfo.SetScheduledEndTime(recInfo.GetRecordingStartTime()); recInfo.AddHistory(true, true); } else if (resulttext == tr("Clear Override")) recInfo.ApplyRecordStateChange(kNotRecording); else if (resulttext == tr("Edit Override") || resulttext == tr("Edit Options")) { EditScheduled(&recInfo); } else if (resulttext == tr("Add Override")) { MakeOverride(&recInfo); } } else if (resultid == "schedulerecording") { if (!qVariantCanConvert<RecordingInfo>(dce->GetData())) return; RecordingInfo recInfo = qVariantValue<RecordingInfo> (dce->GetData()); if (resulttext == tr("Reactivate")) recInfo.ReactivateRecording(); else if (resulttext == tr("Stop recording")) { ProgramInfo pginfo( recInfo.GetChanID(), recInfo.GetRecordingStartTime()); if (pginfo.GetChanID()) RemoteStopRecording(&pginfo); } else if (resulttext == tr("Don't record")) recInfo.ApplyRecordStateChange(kDontRecord); else if (resulttext == tr("Never record")) { recInfo.SetRecordingStatus(rsNeverRecord); recInfo.SetScheduledStartTime(QDateTime::currentDateTime()); recInfo.SetScheduledEndTime(recInfo.GetRecordingStartTime()); recInfo.AddHistory(true, true); } else if (resulttext == tr("Clear Override")) recInfo.ApplyRecordStateChange(kNotRecording); else if (resulttext == tr("Modify Recording Options")) { if (recInfo.GetRecordingRuleType() == kSingleRecord || recInfo.GetRecordingRuleType() == kOverrideRecord || recInfo.GetRecordingRuleType() == kFindOneRecord) EditScheduled(&recInfo); else MakeOverride(&recInfo, true); } else if (resulttext == tr("Edit Override") || resulttext == tr("Edit Options")) { EditScheduled(&recInfo); } else if (resulttext == tr("Add Override")) { MakeOverride(&recInfo); } } } }
/** * \brief Returns true if a search should be employed to find a matching * program. */ bool ScheduleCommon::IsFindApplicable(const RecordingInfo& recInfo) const { return recInfo.GetRecordingRuleType() == kDailyRecord || recInfo.GetRecordingRuleType() == kWeeklyRecord; }
void ScheduleCommon::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "editrecording") { if (!dce->GetData().canConvert<RecordingInfo>()) return; RecordingInfo recInfo = dce->GetData().value<RecordingInfo>(); if (resulttext == tr("Record this showing")) { if (recInfo.GetRecordingRuleType() == kNotRecording) recInfo.ApplyRecordStateChange(kSingleRecord); else { recInfo.ApplyRecordStateChange(kOverrideRecord); if (recInfo.GetRecordingStartTime() < MythDate::current()) recInfo.ReactivateRecording(); } } else if (resulttext == tr("Record all showings")) recInfo.ApplyRecordStateChange(kAllRecord); else if (resulttext == tr("Record one showing (this episode)") || resulttext == tr("Record one showing")) { recInfo.ApplyRecordStateChange(kOneRecord, false); recInfo.GetRecordingRule()->m_filter |= 64; // This episode recInfo.GetRecordingRule()->Save(); } else if (resulttext == tr("Record all showings (this channel)")) { recInfo.ApplyRecordStateChange(kAllRecord, false); recInfo.GetRecordingRule()->m_filter |= 1024; // This channel recInfo.GetRecordingRule()->Save(); } else if (resulttext == tr("Stop this recording")) { RemoteStopRecording(&recInfo); } else if (resulttext == tr("Modify recording options") || resulttext == tr("Add override rule")) { if (recInfo.GetRecordingRuleType() == kSingleRecord || recInfo.GetRecordingRuleType() == kOverrideRecord || recInfo.GetRecordingRuleType() == kOneRecord) EditScheduled(&recInfo); else MakeOverride(&recInfo); } else if (resulttext == tr("Restart this recording")) recInfo.ReactivateRecording(); else if (resulttext == tr("Forget previous recording")) recInfo.ForgetHistory(); else if (resulttext == tr("Don't record this showing")) recInfo.ApplyRecordStateChange(kDontRecord); else if (resulttext == tr("Never record this episode")) { recInfo.ApplyNeverRecord(); } else if (resulttext == tr("Edit recording rule") || resulttext == tr("Edit override rule")) EditScheduled(&recInfo); else if (resulttext == tr("Delete recording rule") || resulttext == tr("Delete override rule")) recInfo.ApplyRecordStateChange(kNotRecording); } } }
void FillProgramInfo( DTC::Program *pProgram, ProgramInfo *pInfo, bool bIncChannel /* = true */, bool bDetails /* = true */) { if ((pProgram == NULL) || (pInfo == NULL)) return; pProgram->setStartTime ( pInfo->GetScheduledStartTime()); pProgram->setEndTime ( pInfo->GetScheduledEndTime ()); pProgram->setTitle ( pInfo->GetTitle() ); pProgram->setSubTitle ( pInfo->GetSubtitle() ); pProgram->setCategory ( pInfo->GetCategory() ); pProgram->setCatType ( pInfo->GetCategoryType() ); pProgram->setRepeat ( pInfo->IsRepeat() ); pProgram->setVideoProps( pInfo->GetVideoProperties() ); pProgram->setAudioProps( pInfo->GetAudioProperties() ); pProgram->setSubProps ( pInfo->GetSubtitleType() ); pProgram->setSerializeDetails( bDetails ); if (bDetails) { pProgram->setSeriesId ( pInfo->GetSeriesID() ); pProgram->setProgramId ( pInfo->GetProgramID() ); pProgram->setStars ( pInfo->GetStars() ); pProgram->setFileSize ( pInfo->GetFilesize() ); pProgram->setLastModified( pInfo->GetLastModifiedTime() ); pProgram->setProgramFlags( pInfo->GetProgramFlags() ); pProgram->setHostname ( pInfo->GetHostname() ); if (pInfo->GetOriginalAirDate().isValid()) pProgram->setAirdate( pInfo->GetOriginalAirDate() ); pProgram->setDescription( pInfo->GetDescription() ); pProgram->setInetref ( pInfo->GetInetRef() ); pProgram->setSeason ( pInfo->GetSeason() ); pProgram->setEpisode ( pInfo->GetEpisode() ); } pProgram->setSerializeChannel( bIncChannel ); if ( bIncChannel ) { // Build Channel Child Element FillChannelInfo( pProgram->Channel(), pInfo, bDetails ); } // Build Recording Child Element if ( pInfo->GetRecordingStatus() != rsUnknown ) { pProgram->setSerializeRecording( true ); DTC::RecordingInfo *pRecording = pProgram->Recording(); pRecording->setStatus ( pInfo->GetRecordingStatus() ); pRecording->setPriority( pInfo->GetRecordingPriority() ); pRecording->setStartTs ( pInfo->GetRecordingStartTime() ); pRecording->setEndTs ( pInfo->GetRecordingEndTime() ); pRecording->setSerializeDetails( bDetails ); if (bDetails) { pRecording->setRecordId ( pInfo->GetRecordingRuleID() ); pRecording->setRecGroup ( pInfo->GetRecordingGroup() ); pRecording->setPlayGroup( pInfo->GetPlaybackGroup() ); pRecording->setRecType ( pInfo->GetRecordingRuleType() ); pRecording->setDupInType( pInfo->GetDuplicateCheckSource() ); pRecording->setDupMethod( pInfo->GetDuplicateCheckMethod() ); pRecording->setEncoderId( pInfo->GetCardID() ); const RecordingInfo ri(*pInfo); pRecording->setProfile( ri.GetProgramRecordingProfile() ); } } }
int Dvr::AddRecordSchedule ( int nChanId, QDateTime dStartTime, int nParentId, bool bInactive, uint nSeason, uint nEpisode, QString sInetref, int nFindId, QString sType, QString sSearchType, int nRecPriority, uint nPreferredInput, int nStartOffset, int nEndOffset, QString sDupMethod, QString sDupIn, uint nFilter, QString sRecProfile, QString sRecGroup, QString sStorageGroup, QString sPlayGroup, bool bAutoExpire, int nMaxEpisodes, bool bMaxNewest, bool bAutoCommflag, bool bAutoTranscode, bool bAutoMetaLookup, bool bAutoUserJob1, bool bAutoUserJob2, bool bAutoUserJob3, bool bAutoUserJob4, int nTranscoder) { RecordingInfo *info = new RecordingInfo(nChanId, dStartTime, false); RecordingRule *rule = info->GetRecordingRule(); delete info; info = NULL; if (sType.isEmpty()) sType = "single"; if (sSearchType.isEmpty()) sSearchType = "none"; if (sDupMethod.isEmpty()) sDupMethod = "subtitleanddescription"; if (sDupIn.isEmpty()) sDupIn = "all"; rule->m_type = recTypeFromString(sType); rule->m_searchType = searchTypeFromString(sSearchType); rule->m_dupMethod = dupMethodFromString(sDupMethod); rule->m_dupIn = dupInFromString(sDupIn); if (sRecProfile.isEmpty()) sRecProfile = "Default"; if (sRecGroup.isEmpty()) sRecGroup = "Default"; if (sStorageGroup.isEmpty()) sStorageGroup = "Default"; if (sPlayGroup.isEmpty()) sPlayGroup = "Default"; rule->m_recProfile = sRecProfile; rule->m_recGroup = sRecGroup; rule->m_storageGroup = sStorageGroup; rule->m_playGroup = sPlayGroup; rule->m_parentRecID = nParentId; rule->m_isInactive = bInactive; rule->m_season = nSeason; rule->m_episode = nEpisode; rule->m_inetref = sInetref; rule->m_findid = nFindId; rule->m_recPriority = nRecPriority; rule->m_prefInput = nPreferredInput; rule->m_startOffset = nStartOffset; rule->m_endOffset = nEndOffset; rule->m_filter = nFilter; rule->m_autoExpire = bAutoExpire; rule->m_maxEpisodes = nMaxEpisodes; rule->m_maxNewest = bMaxNewest; rule->m_autoCommFlag = bAutoCommflag; rule->m_autoTranscode = bAutoTranscode; rule->m_autoMetadataLookup = bAutoMetaLookup; rule->m_autoUserJob1 = bAutoUserJob1; rule->m_autoUserJob2 = bAutoUserJob2; rule->m_autoUserJob3 = bAutoUserJob3; rule->m_autoUserJob4 = bAutoUserJob4; rule->m_transcoder = nTranscoder; rule->Save(); int recid = rule->m_recordID; delete rule; rule = NULL; return recid; }
/** * \brief Creates a dialog displaying current recording status and options * available */ void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo) { QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - "); message += "\n\n"; message += toDescription(recinfo.GetRecordingStatus(), recinfo.GetRecordingRuleType(), recinfo.GetRecordingStartTime()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, "recOptionPopup", true); if (menuPopup->Create()) { menuPopup->SetReturnEvent(this, "schedulerecording"); QDateTime now = MythDate::current(); if (recinfo.GetRecordingStartTime() < now && recinfo.GetRecordingEndTime() > now) { if (recinfo.GetRecordingStatus() != rsRecording && recinfo.GetRecordingStatus() != rsTuning && recinfo.GetRecordingStatus() != rsOtherRecording && recinfo.GetRecordingStatus() != rsOtherTuning) menuPopup->AddButton(tr("Restart recording this showing"), qVariantFromValue(recinfo)); else menuPopup->AddButton(tr("Stop recording this showing"), qVariantFromValue(recinfo)); } if (recinfo.GetRecordingEndTime() > now) { if (recinfo.GetRecordingRuleType() != kSingleRecord && recinfo.GetRecordingRuleType() != kOverrideRecord) { if (recinfo.GetRecordingStartTime() > now) { menuPopup->AddButton(tr("Don't record this showing"), qVariantFromValue(recinfo)); } const RecordingDupMethodType dupmethod = recinfo.GetDuplicateCheckMethod(); if (recinfo.GetRecordingStatus() != rsRecording && recinfo.GetRecordingStatus() != rsTuning && recinfo.GetRecordingStatus() != rsOtherRecording && recinfo.GetRecordingStatus() != rsOtherTuning && 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() != kOverrideRecord && recinfo.GetRecordingRuleType() != kDontRecord) { if (recinfo.GetRecordingStatus() == rsRecording || recinfo.GetRecordingStatus() == rsTuning || recinfo.GetRecordingStatus() == rsOtherRecording || recinfo.GetRecordingStatus() == rsOtherTuning) { menuPopup->AddButton(tr("Edit options for this showing"), qVariantFromValue(recinfo)); } else { if (recinfo.GetRecordingRuleType() != kSingleRecord) { menuPopup->AddButton(tr("Override this showing with options"), qVariantFromValue(recinfo)); } } } if (recinfo.GetRecordingRuleType() == kOverrideRecord || recinfo.GetRecordingRuleType() == kDontRecord) { if (recinfo.GetRecordingStatus() == rsRecording || recinfo.GetRecordingStatus() == rsTuning || recinfo.GetRecordingStatus() == rsOtherRecording || recinfo.GetRecordingStatus() == rsOtherTuning) { menuPopup->AddButton(tr("Edit options for this showing"), qVariantFromValue(recinfo)); } else { menuPopup->AddButton(tr("Edit override options"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete override rule"), qVariantFromValue(recinfo)); } } } if (recinfo.GetRecordingRuleType() != kOverrideRecord && recinfo.GetRecordingRuleType() != kDontRecord) { menuPopup->AddButton(tr("Edit recording options"), qVariantFromValue(recinfo)); menuPopup->AddButton(tr("Delete recording rule"), qVariantFromValue(recinfo)); } popupStack->AddScreen(menuPopup); } else delete 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; }
void ScheduleCommon::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "schedulenotscheduled") { if (!qVariantCanConvert<RecordingInfo>(dce->GetData())) return; RecordingInfo recInfo = qVariantValue<RecordingInfo> (dce->GetData()); if (resulttext == tr("Record only this showing")) recInfo.ApplyRecordStateChange(kSingleRecord); else if (resulttext == tr("Record all showings")) recInfo.ApplyRecordStateChange(kAllRecord); else if (resulttext == tr("Record one showing of this episode")) { recInfo.ApplyRecordStateChange(kOneRecord, false); recInfo.GetRecordingRule()->m_filter |= 64; // This episode recInfo.GetRecordingRule()->Save(); } else if (resulttext == tr("Record all showings on this channel")) { recInfo.ApplyRecordStateChange(kAllRecord, false); recInfo.GetRecordingRule()->m_filter |= 1024; // This channel recInfo.GetRecordingRule()->Save(); } else if (resulttext == tr("Record with more options")) { EditScheduled(&recInfo); } } else if (resultid == "schedulenotrecording") { if (!qVariantCanConvert<RecordingInfo>(dce->GetData())) return; RecordingInfo recInfo = qVariantValue<RecordingInfo> (dce->GetData()); if (resulttext == tr("Restart recording this showing")) recInfo.ReactivateRecording(); else if (resulttext == tr("Record this showing anyway")) { recInfo.ApplyRecordStateChange(kOverrideRecord); if (recInfo.GetRecordingStartTime() < MythDate::current()) recInfo.ReactivateRecording(); } else if (resulttext == tr("Forget previous recording")) recInfo.ForgetHistory(); else if (resulttext == tr("Don't record this showing")) recInfo.ApplyRecordStateChange(kDontRecord); else if (resulttext == tr("Never record this episode")) { recInfo.SetRecordingStatus(rsNeverRecord); recInfo.SetScheduledStartTime(MythDate::current()); recInfo.SetScheduledEndTime(recInfo.GetRecordingStartTime()); recInfo.AddHistory(true, true); } else if (resulttext == tr("Delete override rule") || resulttext == tr("Delete recording rule")) recInfo.ApplyRecordStateChange(kNotRecording); else if (resulttext == tr("Edit override options") || resulttext == tr("Edit recording options")) { EditScheduled(&recInfo); } else if (resulttext == tr("Override this showing with options")) { MakeOverride(&recInfo); } } else if (resultid == "schedulerecording") { if (!qVariantCanConvert<RecordingInfo>(dce->GetData())) return; RecordingInfo recInfo = qVariantValue<RecordingInfo> (dce->GetData()); if (resulttext == tr("Restart recording this showing")) recInfo.ReactivateRecording(); else if (resulttext == tr("Stop recording this showing")) { ProgramInfo pginfo( recInfo.GetChanID(), recInfo.GetRecordingStartTime()); if (pginfo.GetChanID()) RemoteStopRecording(&pginfo); } else if (resulttext == tr("Don't record this showing")) recInfo.ApplyRecordStateChange(kDontRecord); else if (resulttext == tr("Never record this episode")) { recInfo.SetRecordingStatus(rsNeverRecord); recInfo.SetScheduledStartTime(MythDate::current()); recInfo.SetScheduledEndTime(recInfo.GetRecordingStartTime()); recInfo.AddHistory(true, true); } else if (resulttext == tr("Delete override rule") || resulttext == tr("Delete recording rule")) recInfo.ApplyRecordStateChange(kNotRecording); else if (resulttext == tr("Edit options for this showing")) { if (recInfo.GetRecordingRuleType() == kSingleRecord || recInfo.GetRecordingRuleType() == kOverrideRecord || recInfo.GetRecordingRuleType() == kOneRecord) EditScheduled(&recInfo); else MakeOverride(&recInfo, true); } else if (resulttext == tr("Edit override options") || resulttext == tr("Edit recording options")) { EditScheduled(&recInfo); } else if (resulttext == tr("Override this showing with options")) { MakeOverride(&recInfo); } } } }
void FillProgramInfo( DTC::Program *pProgram, ProgramInfo *pInfo, bool bIncChannel /* = true */, bool bDetails /* = true */, bool bIncCast /* = true */) { if ((pProgram == NULL) || (pInfo == NULL)) return; pProgram->setStartTime ( pInfo->GetScheduledStartTime()); pProgram->setEndTime ( pInfo->GetScheduledEndTime ()); pProgram->setTitle ( pInfo->GetTitle() ); pProgram->setSubTitle ( pInfo->GetSubtitle() ); pProgram->setCategory ( pInfo->GetCategory() ); pProgram->setCatType ( pInfo->GetCategoryTypeString()); pProgram->setRepeat ( pInfo->IsRepeat() ); pProgram->setVideoProps( pInfo->GetVideoProperties() ); pProgram->setAudioProps( pInfo->GetAudioProperties() ); pProgram->setSubProps ( pInfo->GetSubtitleType() ); pProgram->setSerializeDetails( bDetails ); if (bDetails) { pProgram->setSeriesId ( pInfo->GetSeriesID() ); pProgram->setProgramId ( pInfo->GetProgramID() ); pProgram->setStars ( pInfo->GetStars() ); pProgram->setLastModified( pInfo->GetLastModifiedTime() ); pProgram->setProgramFlags( pInfo->GetProgramFlags() ); // ---- // DEPRECATED - See RecordingInfo instead pProgram->setFileName ( pInfo->GetPathname() ); pProgram->setFileSize ( pInfo->GetFilesize() ); pProgram->setHostName ( pInfo->GetHostname() ); // ---- if (pInfo->GetOriginalAirDate().isValid()) pProgram->setAirdate( pInfo->GetOriginalAirDate() ); else if (pInfo->GetYearOfInitialRelease() > 0) { QDate year; year.setDate(pInfo->GetYearOfInitialRelease(), 1, 1); pProgram->setAirdate( year ); } pProgram->setDescription( pInfo->GetDescription() ); pProgram->setInetref ( pInfo->GetInetRef() ); pProgram->setSeason ( pInfo->GetSeason() ); pProgram->setEpisode ( pInfo->GetEpisode() ); pProgram->setTotalEpisodes( pInfo->GetEpisodeTotal() ); } pProgram->setSerializeCast(bIncCast); if (bIncCast) { FillCastMemberList( pProgram->Cast(), pInfo ); } pProgram->setSerializeChannel( bIncChannel ); if ( bIncChannel ) { // Build Channel Child Element if (!FillChannelInfo( pProgram->Channel(), pInfo->GetChanID(), bDetails )) { // The channel associated with a given recording may no longer exist // however the ChanID is one half of the unique identifier for the // recording and therefore MUST be included in the return data pProgram->Channel()->setChanId(pInfo->GetChanID()); } } // Build Recording Child Element if ( pInfo->GetRecordingStatus() != RecStatus::Unknown ) { pProgram->setSerializeRecording( true ); DTC::RecordingInfo *pRecording = pProgram->Recording(); const RecordingInfo pRecInfo(*pInfo); pRecording->setRecordedId ( pRecInfo.GetRecordingID() ); pRecording->setStatus ( pRecInfo.GetRecordingStatus() ); pRecording->setPriority( pRecInfo.GetRecordingPriority() ); pRecording->setStartTs ( pRecInfo.GetRecordingStartTime() ); pRecording->setEndTs ( pRecInfo.GetRecordingEndTime() ); pRecording->setSerializeDetails( bDetails ); if (bDetails) { pRecording->setFileName ( pRecInfo.GetPathname() ); pRecording->setFileSize ( pRecInfo.GetFilesize() ); pRecording->setHostName ( pRecInfo.GetHostname() ); pRecording->setLastModified( pRecInfo.GetLastModifiedTime() ); pRecording->setRecordId ( pRecInfo.GetRecordingRuleID() ); pRecording->setRecGroup ( pRecInfo.GetRecordingGroup() ); pRecording->setPlayGroup ( pRecInfo.GetPlaybackGroup() ); pRecording->setStorageGroup( pRecInfo.GetStorageGroup() ); pRecording->setRecType ( pRecInfo.GetRecordingRuleType() ); pRecording->setDupInType ( pRecInfo.GetDuplicateCheckSource() ); pRecording->setDupMethod ( pRecInfo.GetDuplicateCheckMethod() ); pRecording->setEncoderId ( pRecInfo.GetInputID() ); if (pProgram->Channel()) { QString encoderName = CardUtil::GetDisplayName(pRecInfo.GetInputID()); pRecording->setEncoderName( encoderName ); } pRecording->setProfile( pRecInfo.GetProgramRecordingProfile() ); } } if (!pInfo->GetInetRef().isEmpty() ) { pProgram->setSerializeArtwork( true ); FillArtworkInfoList( pProgram->Artwork(), pInfo->GetInetRef(), pInfo->GetSeason()); } }