]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add function for removing all log entries for completed recordings
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 13 Feb 2008 18:30:16 +0000 (18:30 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 13 Feb 2008 18:30:16 +0000 (18:30 +0000)
htmlui.c
pvr.c
pvr.h

index 44caa4ae6769bf0cccf13e18365538fde45dace6..bd7f0a47648e6c7ae14bedc54b4c8b02fb8d628b 100644 (file)
--- a/htmlui.c
+++ b/htmlui.c
@@ -831,6 +831,10 @@ page_pvr(http_connection_t *hc, const char *remain, void *opaque)
   if(!html_verify_access(hc, "record-events"))
     return HTTP_STATUS_UNAUTHORIZED;
 
+  if(http_arg_get(&hc->hc_url_args, "clearall")) {
+    pvr_clear_all_completed();
+  }
+
   op = -1;
   pvrr_tgt = NULL;
   LIST_FOREACH(ra, &hc->hc_url_args, link) {
@@ -1004,10 +1008,10 @@ page_pvr(http_connection_t *hc, const char *remain, void *opaque)
     divid++;
   }
 
-    tcp_qprintf(&tq,
-               "<br><div style=\"text-align: center\">"
-               "<input type=\"submit\" class=\"knapp\" name=\"clearall\" "
-               "value=\"Remove all completed recordings\"></div>");
+  tcp_qprintf(&tq,
+             "<br><div style=\"text-align: center\">"
+             "<input type=\"submit\" class=\"knapp\" name=\"clearall\" "
+             "value=\"Remove all completed recording log entries\"></div>");
 
   tcp_qprintf(&tq, "</div>\r\n");
 
diff --git a/pvr.c b/pvr.c
index 9cc533134b28da1c563b75c10514a03ae511fe76..0c3576393d9089de563be1449d738d89ead5be0a 100644 (file)
--- a/pvr.c
+++ b/pvr.c
@@ -220,6 +220,30 @@ pvr_do_op(pvr_rec_t *pvrr, recop_t op)
 }
 
 
+/**
+ * Remove log info about all completed recordings
+ */
+void
+pvr_clear_all_completed(void)
+{
+  pvr_rec_t *pvrr, *next;
+  for(pvrr = LIST_FIRST(&pvrr_global_list); pvrr != NULL; pvrr = next) {
+    next = LIST_NEXT(pvrr, pvrr_global_link);
+
+    switch(pvrr->pvrr_status) {
+    case HTSTV_PVR_STATUS_SCHEDULED:
+    case HTSTV_PVR_STATUS_RECORDING:
+      break;
+    default:
+      pvr_database_erase(pvrr);
+      pvr_free(pvrr);
+      break;
+    }
+  }
+}
+
+
+
 void
 pvr_event_record_op(th_channel_t *ch, event_t *e, recop_t op)
 {
diff --git a/pvr.h b/pvr.h
index cca8d0f43bfe111cd9ea6e55d966fd010d50f6a4..a82a7b9fdca85eefaf35a1756aa3bd89a42501ae 100644 (file)
--- a/pvr.h
+++ b/pvr.h
@@ -119,4 +119,6 @@ int pvr_op2int(const char *op);
 
 void pvr_do_op(pvr_rec_t *pvrr, recop_t op);
 
+void pvr_clear_all_completed(void);
+
 #endif /* PVR_H */