Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Services: Add a AddDontRecordSchedule() to the DVR service. Takes an …

…optional NeverRecord arg.
  • Loading branch information...
commit d4247a962a95501dacebaf9e6898bde1a22486e4 1 parent 3af71b4
@stuartm stuartm authored
View
36 mythtv/libs/libmyth/programinfo.cpp
@@ -5083,6 +5083,42 @@ bool LoadFromProgram(
return true;
}
+ProgramInfo* LoadProgramFromProgram(const uint chanid,
+ const QDateTime& starttime)
+{
+ ProgramInfo *progInfo = NULL;
+
+ // Build add'l SQL statement for Program Listing
+
+ MSqlBindings bindings;
+ QString sSQL = "WHERE program.chanid = :ChanId "
+ "AND program.starttime = :StartTime ";
+
+ bindings[":ChanId" ] = chanid;
+ bindings[":StartTime"] = starttime;
+
+ // Get all Pending Scheduled Programs
+
+ ProgramList schedList;
+ bool hasConflicts;
+ LoadFromScheduler(schedList, hasConflicts);
+
+ // ----------------------------------------------------------------------
+
+ ProgramList progList;
+
+ LoadFromProgram( progList, sSQL, bindings, schedList );
+
+ if (progList.size() == 0)
+ return progInfo;
+
+ // progList is an Auto-delete deque, the object will be deleted with the
+ // list, so we need to make a copy
+ progInfo = new ProgramInfo(*(progList[0]));
+
+ return progInfo;
+}
+
bool LoadFromOldRecorded(
ProgramList &destination, const QString &sql, const MSqlBindings &bindings)
{
View
3  mythtv/libs/libmyth/programinfo.h
@@ -770,6 +770,9 @@ MPUBLIC bool LoadFromProgram(
const MSqlBindings &bindings,
const ProgramList &schedList);
+MPUBLIC ProgramInfo* LoadProgramFromProgram(
+ const uint chanid, const QDateTime &starttime);
+
MPUBLIC bool LoadFromOldRecorded(
ProgramList &destination,
const QString &sql,
View
2  mythtv/libs/libmythbase/mythversion.h
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in ABI changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods in exported headers.
-#define MYTH_BINARY_VERSION "0.28.20131103-1"
+#define MYTH_BINARY_VERSION "0.28.20131111-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
View
4 mythtv/libs/libmythservicecontracts/services/dvrServices.h
@@ -192,6 +192,10 @@ class SERVICE_PUBLIC DvrServices : public Service //, public QScriptable ???
virtual bool RemoveRecordSchedule ( uint RecordId ) = 0;
+ virtual bool AddDontRecordSchedule ( int ChanId,
+ const QDateTime &StartTime,
+ bool NeverRecord ) = 0;
+
virtual DTC::RecRuleList* GetRecordScheduleList ( int StartIndex,
int Count ) = 0;
View
12 mythtv/libs/libmythtv/recordinginfo.cpp
@@ -781,6 +781,18 @@ void RecordingInfo::ApplyTranscoderProfileChange(const QString &profile) const
}
}
+/**
+ * \brief Set this program to never be recorded by inserting 'history' for
+ * it into the database with a status of rsNeverRecord
+ */
+void RecordingInfo::ApplyNeverRecord(void)
+{
+ SetRecordingStatus(rsNeverRecord);
+ SetScheduledStartTime(MythDate::current());
+ SetScheduledEndTime(GetRecordingStartTime());
+ AddHistory(true, true);
+}
+
/** \fn RecordingInfo::QuickRecord(void)
* \brief Create a kSingleRecord if not already scheduled.
*/
View
1  mythtv/libs/libmythtv/recordinginfo.h
@@ -262,6 +262,7 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
const QString &newDescription);
void ApplyTranscoderProfileChange(const QString &profile) const;//pi
void ApplyTranscoderProfileChangeById(int);
+ void ApplyNeverRecord(void);
RecStatusType oldrecstatus;
RecStatusType savedrecstatus;
View
28 mythtv/programs/mythbackend/services/dvr.cpp
@@ -844,6 +844,34 @@ bool Dvr::RemoveRecordSchedule ( uint nRecordId )
return bResult;
}
+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;
+}
+
DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex,
int nCount )
{
View
11 mythtv/programs/mythbackend/services/dvr.h
@@ -170,6 +170,10 @@ class Dvr : public DvrServices
bool RemoveRecordSchedule ( uint RecordId );
+ bool AddDontRecordSchedule( int ChanId,
+ const QDateTime &StartTime,
+ bool NeverRecord );
+
DTC::RecRuleList* GetRecordScheduleList( int StartIndex,
int Count );
@@ -351,6 +355,13 @@ class ScriptableDvr : public QObject
return m_obj.RemoveRecordSchedule(RecordId);
}
+ bool AddDontRecordSchedule( int ChanId,
+ const QDateTime &StartTime,
+ bool NeverRecord )
+ {
+ return m_obj.AddDontRecordSchedule(ChanId, StartTime, NeverRecord);
+ }
+
QObject* GetRecordScheduleList( int StartIndex, int Count )
{
return m_obj.GetRecordScheduleList(StartIndex, Count);
View
28 mythtv/programs/mythbackend/services/guide.cpp
@@ -197,37 +197,15 @@ DTC::Program* Guide::GetProgramDetails( int nChanId,
// -=>TODO: Add support for getting Recorded Program Info
// ----------------------------------------------------------------------
- // Build add'l SQL statement for Program Listing
-
- MSqlBindings bindings;
- QString sSQL = "WHERE program.chanid = :ChanId "
- "AND program.starttime = :StartTime ";
-
- bindings[":ChanId" ] = nChanId;
- bindings[":StartTime"] = dtStartTime;
-
- // Get all Pending Scheduled Programs
-
- ProgramList schedList;
- bool hasConflicts;
- LoadFromScheduler(schedList, hasConflicts);
-
- // ----------------------------------------------------------------------
-
- ProgramList progList;
-
- LoadFromProgram( progList, sSQL, bindings, schedList );
-
- if ( progList.size() == 0)
- throw( "Error Reading Program Info" );
-
// Build Response
DTC::Program *pProgram = new DTC::Program();
- ProgramInfo *pInfo = progList[ 0 ];
+ ProgramInfo *pInfo = LoadProgramFromProgram(nChanId, dtStartTime);
FillProgramInfo( pProgram, pInfo, true, true );
+ delete pInfo;
+
return pProgram;
}
View
5 mythtv/programs/mythfrontend/schedulecommon.cpp
@@ -475,10 +475,7 @@ void ScheduleCommon::customEvent(QEvent *event)
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);
+ recInfo.ApplyNeverRecord();
}
else if (resulttext == tr("Edit recording rule") ||
resulttext == tr("Edit override rule"))
Please sign in to comment.
Something went wrong with that request. Please try again.