diff --git a/Makefile b/Makefile
index cf3682f3..cc0a4be3 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ SRCS += http.c htmlui.c
SRCS += htsp.c rpc.c
-SRCS += pvr.c
+SRCS += pvr.c autorec.c
SRCS += epg.c epg_xmltv.c
diff --git a/autorec.c b/autorec.c
new file mode 100644
index 00000000..525c70a8
--- /dev/null
+++ b/autorec.c
@@ -0,0 +1,49 @@
+/*
+ * Automatic recording
+ * Copyright (C) 2008 Andreas Öman
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#define _GNU_SOURCE
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include "tvhead.h"
+#include "dispatch.h"
+#include "autorec.h"
+
+
+void
+autorec_create(const char *name, int prio, const char *title,
+ epg_content_group_t *ecg, th_channel_group_t *tcg,
+ th_channel_t *ch)
+{
+
+
+}
diff --git a/autorec.h b/autorec.h
new file mode 100644
index 00000000..852deda9
--- /dev/null
+++ b/autorec.h
@@ -0,0 +1,26 @@
+/*
+ * Automatic recording
+ * Copyright (C) 2008 Andreas Öman
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef AUTOREC_H
+#define AUTOREC_H
+
+void autorec_create(const char *name, int prio, const char *title,
+ epg_content_group_t *ecg, th_channel_group_t *tcg,
+ th_channel_t *ch);
+
+#endif /* AUTOREC_H */
diff --git a/htmlui.c b/htmlui.c
index e7ceec27..fb643342 100644
--- a/htmlui.c
+++ b/htmlui.c
@@ -39,6 +39,7 @@
#include "v4l.h"
#include "iptv_input.h"
#include "transports.h"
+#include "autorec.h"
#define MAIN_WIDTH 800
@@ -1665,20 +1666,63 @@ page_search(http_connection_t *hc, const char *remain, void *opaque)
struct tm a, day;
const char *search = http_arg_get(&hc->hc_url_args, "s");
+ const char *autorec = http_arg_get(&hc->hc_url_args, "ar");
const char *title = http_arg_get(&hc->hc_url_args, "n");
const char *content = http_arg_get(&hc->hc_url_args, "c");
const char *chgroup = http_arg_get(&hc->hc_url_args, "g");
const char *channel = http_arg_get(&hc->hc_url_args, "ch");
+ const char *ar_name = http_arg_get(&hc->hc_url_args, "ar_name");
+ const char *ar_prio = http_arg_get(&hc->hc_url_args, "ar_prio");
if(title != NULL && *title == 0) title = NULL;
if(content != NULL && !strcmp(content, "-All-")) content = NULL;
if(chgroup != NULL && !strcmp(chgroup, "-All-")) chgroup = NULL;
if(channel != NULL && !strcmp(channel, "-All-")) channel = NULL;
+ if(ar_name != NULL && *ar_name == 0) ar_name = NULL;
+ if(ar_prio != NULL && *ar_prio == 0) ar_prio = NULL;
+
s_ecg = content ? epg_content_group_find_by_name(content) : NULL;
s_tcg = chgroup ? channel_group_find(chgroup, 0) : NULL;
s_ch = channel ? channel_find(channel, 0, NULL) : NULL;
+ if(http_arg_get(&hc->hc_url_args, "ar_create")) {
+ /* Create autorecording */
+
+
+ if(ar_name == NULL || ar_prio == NULL || atoi(ar_prio) < 1) {
+ /* Invalid arguments */
+
+ tcp_init_queue(&tq, -1);
+ html_header(&tq, "HTS/tvheadend", !simple, MAIN_WIDTH, 0, NULL);
+ top_menu(hc, &tq);
+ tcp_qprintf(&tq, "