]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
add command for recording direct of a channel (without any events around or so)
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 18 Sep 2007 06:21:36 +0000 (06:21 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 18 Sep 2007 06:21:36 +0000 (06:21 +0000)
htsclient.c
pvr.c
pvr.h

index d961a23a2a41960f28e925f00738b886381533ba..6f990ee8f4423a38fd5927b1e8d5b5b9084846cc 100644 (file)
@@ -558,6 +558,30 @@ cr_event_record(client_t *c, char **argv, int argc)
   return 0;
 }
 
+
+
+
+/*
+ *
+ */
+static int
+cr_channel_record(client_t *c, char **argv, int argc)
+{
+  th_channel_t *ch;
+  int duration;
+
+  if(argc < 2)
+    return 1;
+
+  if((ch = channel_by_index(atoi(argv[0]))) == NULL)
+    return 1;
+
+  duration = atoi(argv[1]);
+  
+  pvr_channel_record_op(ch, duration);
+  return 0;
+}
+
 /*
  *
  */
@@ -643,6 +667,7 @@ const struct {
   { "channel.info", cr_channel_info },
   { "channel.subscribe", cr_channel_subscribe },
   { "channel.unsubscribe", cr_channel_unsubscribe },
+  { "channel.record", cr_channel_record },
   { "event.info", cr_event_info },
   { "event.record", cr_event_record },
   { "pvr.getlog", cr_pvr_getlog },
diff --git a/pvr.c b/pvr.c
index 5c31f746342025d1b8d9b2695a7b6b7d18763368..1b7738334cddd90600045c76878983f4151457ea 100644 (file)
--- a/pvr.c
+++ b/pvr.c
@@ -268,6 +268,29 @@ pvr_event_record_op(th_channel_t *ch, event_t *e, recop_t op)
 
 
 
+void
+pvr_channel_record_op(th_channel_t *ch, int duration)
+{
+  time_t now   = dispatch_clock;
+  time_t start = now;
+  time_t stop  = now + duration;
+  pvr_rec_t *pvrr;
+
+  pvrr = calloc(1, sizeof(pvr_rec_t));
+  pvrr->pvrr_status  = HTSTV_PVR_STATUS_SCHEDULED;
+  pvrr->pvrr_channel = ch;
+  pvrr->pvrr_start   = start;
+  pvrr->pvrr_stop    = stop;
+  pvrr->pvrr_title   = strdup("Manual recording");
+  pvrr->pvrr_desc    = NULL;
+
+  pvr_link_pvrr(pvrr);  
+  pvr_database_save();
+}
+
+
+
+
 /*****************************************************************************
  *
  * Plain text "database" of pvr programmes
diff --git a/pvr.h b/pvr.h
index d7ca588016dc3666fdc10cbdcad5b84ed4d85bed..2aece0d397e7da546d16961f21867917c2c336a6 100644 (file)
--- a/pvr.h
+++ b/pvr.h
@@ -46,4 +46,6 @@ void pvr_database_save(void);
 
 void pvrr_set_rec_state(pvr_rec_t *pvrr, pvrr_rec_status_t status);
 
+void pvr_channel_record_op(th_channel_t *ch, int duration);
+
 #endif /* PVR_H */