Permalink
Browse files

Add Recording Schedule methods to scriptable API

Unlike the http (xml/json) API, for the scriptable API you pass
a pointer as the sole argument to the RecRule object for
AddRecordSchedule and UpdateRecordSchedule instead of the 40
variables which make up the object. They behave identically but
it's a lot easier to use.
  • Loading branch information...
1 parent afb7929 commit 641d61269c97c55ce653404d9cb0bebd34796eeb @stuartm stuartm committed Oct 24, 2013
@@ -17,6 +17,7 @@
#include "datacontracts/programList.h"
#include "datacontracts/encoderList.h"
+#include "datacontracts/recRule.h"
#include "datacontracts/recRuleList.h"
#include "datacontracts/titleInfoList.h"
@@ -29,6 +29,7 @@
#include <QScriptEngine>
#include "services/dvrServices.h"
+#include "datacontracts/recRule.h"
class Dvr : public DvrServices
{
@@ -240,6 +241,92 @@ class ScriptableDvr : public QObject
QObject* GetTitleInfoList () { return m_obj.GetTitleInfoList(); }
+ uint AddRecordSchedule ( DTC::RecRule *rule )
+ {
+ return m_obj.AddRecordSchedule(
+ rule->Title(), rule->SubTitle(),
+ rule->Description(), rule->Category(),
+ rule->StartTime(), rule->EndTime(),
+ rule->SeriesId(), rule->ProgramId(),
+ rule->ChanId(), rule->CallSign(),
+ rule->FindDay(), rule->FindTime(),
+ rule->ParentId(), rule->Inactive(),
+ rule->Season(), rule->Episode(),
+ rule->Inetref(), rule->Type(),
+ rule->SearchType(), rule->RecPriority(),
+ rule->PreferredInput(), rule->StartOffset(),
+ rule->EndOffset(), rule->DupMethod(),
+ rule->DupIn(), rule->Filter(),
+ rule->RecProfile(), rule->RecGroup(),
+ rule->StorageGroup(), rule->PlayGroup(),
+ rule->AutoExpire(), rule->MaxEpisodes(),
+ rule->MaxNewest(), rule->AutoCommflag(),
+ rule->AutoTranscode(), rule->AutoMetaLookup(),
+ rule->AutoUserJob1(), rule->AutoUserJob2(),
+ rule->AutoUserJob3(), rule->AutoUserJob4(),
+ rule->Transcoder());
+ }
+
+ bool UpdateRecordSchedule ( DTC::RecRule *rule )
+ {
+ if (rule->Id() <= 0)
+ throw QString("Record ID cannot be <= zero");
+
+ return m_obj.UpdateRecordSchedule(
+ static_cast<uint>(rule->Id()),
+ rule->Title(), rule->SubTitle(),
+ rule->Description(), rule->Category(),
+ rule->StartTime(), rule->EndTime(),
+ rule->SeriesId(), rule->ProgramId(),
+ rule->ChanId(), rule->CallSign(),
+ rule->FindDay(), rule->FindTime(),
+ rule->Inactive(),
+ rule->Season(), rule->Episode(),
+ rule->Inetref(), rule->Type(),
+ rule->SearchType(), rule->RecPriority(),
+ rule->PreferredInput(), rule->StartOffset(),
+ rule->EndOffset(), rule->DupMethod(),
+ rule->DupIn(), rule->Filter(),
+ rule->RecProfile(), rule->RecGroup(),
+ rule->StorageGroup(), rule->PlayGroup(),
+ rule->AutoExpire(), rule->MaxEpisodes(),
+ rule->MaxNewest(), rule->AutoCommflag(),
+ rule->AutoTranscode(), rule->AutoMetaLookup(),
+ rule->AutoUserJob1(), rule->AutoUserJob2(),
+ rule->AutoUserJob3(), rule->AutoUserJob4(),
+ rule->Transcoder());
+ }
+
+ bool RemoveRecordSchedule ( uint RecordId )
+ {
+ return m_obj.RemoveRecordSchedule(RecordId);
+ }
+
+ QObject* GetRecordScheduleList( int StartIndex, int Count )
+ {
+ return m_obj.GetRecordScheduleList(StartIndex, Count);
+ }
+
+ QObject* GetRecordSchedule ( uint RecordId,
+ QString Template,
+ int ChanId,
+ QDateTime StartTime,
+ bool MakeOverride )
+ {
+ return m_obj.GetRecordSchedule( RecordId, Template, ChanId,
+ StartTime, MakeOverride);
+ }
+
+ bool EnableRecordSchedule ( uint RecordId )
+ {
+ return m_obj.EnableRecordSchedule(RecordId);
+ }
+
+ bool DisableRecordSchedule( uint RecordId )
+ {
+ return m_obj.DisableRecordSchedule(RecordId);
+ }
+
};
Q_SCRIPT_DECLARE_QMETAOBJECT( ScriptableDvr, QObject*);

0 comments on commit 641d612

Please sign in to comment.