]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dtable removal: celebrate new idnode system
authorJaroslav Kysela <perex@perex.cz>
Tue, 30 Sep 2014 19:49:34 +0000 (21:49 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 30 Sep 2014 19:49:34 +0000 (21:49 +0200)
Makefile
src/channels.c
src/dtable.c [deleted file]
src/dtable.h [deleted file]
src/dvr/dvr_autorec.c
src/dvr/dvr_timerec.c
src/webui/extjs.c

index 7cb65df145f199c20e2b93165a129a4436c43143..341167b7f3f2db85387d4aa7cae577ea4140fba6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,6 @@ SRCS =  src/version.c \
        src/utils.c \
        src/wrappers.c \
        src/access.c \
-       src/dtable.c \
        src/tcp.c \
        src/udp.c \
        src/url.c \
index cdca4ef5d27f3ff05682df00d9615562f42066be..084f9c5d065417274bb3157d67a62fb3c41087e0 100644 (file)
@@ -34,7 +34,7 @@
 #include "epg.h"
 #include "epggrab.h"
 #include "channels.h"
-#include "dtable.h"
+#include "access.h"
 #include "notify.h"
 #include "dvr/dvr.h"
 #include "htsp_server.h"
diff --git a/src/dtable.c b/src/dtable.c
deleted file mode 100644 (file)
index f63e75f..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- *  Dtable (dyanmic, data, etc) table 
- *  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 <http://www.gnu.org/licenses/>.
- */
-
-
-#include <pthread.h>
-#include <ctype.h>
-#include <assert.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#include "settings.h"
-
-#include "tvheadend.h"
-#include "dtable.h"
-#include "notify.h"
-
-static LIST_HEAD(, dtable) dtables;
-
-/**
- *
- */
-void
-dtable_store_changed(const dtable_t *dt)
-{
-  htsmsg_t *m = htsmsg_create_map();
-
-  htsmsg_add_u32(m, "reload", 1);
-  notify_by_msg(dt->dt_tablename, m);
-}
-
-/**
- *
- */
-dtable_t *
-dtable_create(const dtable_class_t *dtc, const char *name, void *opaque)
-{
-  dtable_t *dt = calloc(1, sizeof(dtable_t));
-
-  dt->dt_opaque = opaque;
-  dt->dt_tablename = strdup(name);
-  dt->dt_dtc = dtc;
-
-  LIST_INSERT_HEAD(&dtables, dt, dt_link);
-  return dt;
-}
-
-/**
- *
- */
-void
-dtable_delete(const char *name)
-{
-  dtable_t *dt = dtable_find(name);
-
-  if (dt) {
-    pthread_mutex_lock(&global_lock);
-    LIST_REMOVE(dt, dt_link);
-    pthread_mutex_unlock(&global_lock);
-    free(dt->dt_tablename);
-    free(dt);
-  }
-}
-
-/**
- *
- */
-int
-dtable_load(dtable_t *dt)
-{
-  htsmsg_t *l, *c, *m;
-  htsmsg_field_t *f;
-  const char *id;
-
-  int records = 0;
-
-  if((l = hts_settings_load("%s", dt->dt_tablename)) != NULL) {
-    HTSMSG_FOREACH(f, l) {
-      if((c = htsmsg_get_map_by_field(f)) == NULL)
-       continue;
-      
-      if((id = htsmsg_get_str(c, "id")) == NULL)
-       continue;
-
-      m = dt->dt_dtc->dtc_record_update(dt->dt_opaque, id, c, 1);
-      if(m != NULL) {
-       records++;
-       htsmsg_destroy(m);
-      }
-    }
-    htsmsg_destroy(l);
-  }
-  return records;
-}
-
-
-/**
- *
- */
-dtable_t *
-dtable_find(const char *name)
-{
-  dtable_t *dt;
-  LIST_FOREACH(dt, &dtables, dt_link)
-    if(!strcmp(dt->dt_tablename, name))
-      break;
-  return dt;
-}
-
-
-/**
- *
- */
-int
-dtable_record_update_by_array(dtable_t *dt, htsmsg_t *msg)
-{
-  htsmsg_t *c, *update;
-  htsmsg_field_t *f;
-  const char *id;
-  int changed = 0;
-
-  TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) {
-    if((c = htsmsg_get_map_by_field(f)) == NULL)
-      continue;
-    if((id = htsmsg_get_str(c, "id")) == NULL)
-      continue;
-    
-    if((update = dt->dt_dtc->dtc_record_update(dt->dt_opaque, id, c, 0)) 
-       != NULL) {
-      /* Data changed */
-      changed = 1;
-      hts_settings_save(update, "%s/%s", dt->dt_tablename, id);
-      htsmsg_destroy(update);
-    }
-  }
-  if(changed)
-    dtable_store_changed(dt);
-  return 0;
-}
-
-
-/**
- *
- */
-void
-dtable_record_delete(dtable_t *dt, const char *id)
-{
-  dt->dt_dtc->dtc_record_delete(dt->dt_opaque, id);
-  hts_settings_remove("%s/%s", dt->dt_tablename, id);
-  dtable_store_changed(dt);
-}
-
-
-/**
- *
- */
-int
-dtable_record_delete_by_array(dtable_t *dt, htsmsg_t *msg)
-{
-  htsmsg_field_t *f;
-  const char *id;
-  int changed = 0;
-
-  TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) {
-    if((id = htsmsg_field_get_string(f)) != NULL) {
-      changed = 1;
-      dtable_record_delete(dt, id);
-    }
-  }
-  if(changed)
-    dtable_store_changed(dt);
-  return 0;
-}
-
-
-/**
- *
- */
-htsmsg_t *
-dtable_record_create(dtable_t *dt)
-{
-  htsmsg_t *r;
-  const char *id;
-
-  if((r = dt->dt_dtc->dtc_record_create(dt->dt_opaque)) == NULL)
-    return NULL;
-
-  if((id = htsmsg_get_str(r, "id")) == NULL) {
-    htsmsg_destroy(r);
-    return NULL;
-  }
-
-  hts_settings_save(r, "%s/%s", dt->dt_tablename, id);
-  return r;
-}
-
-
-/**
- *
- */
-htsmsg_t *
-dtable_record_get_all(dtable_t *dt)
-{
-  return dt->dt_dtc->dtc_record_get_all(dt->dt_opaque);
-}
-
-
-/**
- *
- */
-void
-dtable_record_store(dtable_t *dt, const char *id, htsmsg_t *r)
-{
-  hts_settings_save(r, "%s/%s", dt->dt_tablename, id);
-}
-
-
-/**
- *
- */
-void
-dtable_record_erase(dtable_t *dt, const char *id)
-{
-  hts_settings_remove("%s/%s", dt->dt_tablename, id);
-}
diff --git a/src/dtable.h b/src/dtable.h
deleted file mode 100644 (file)
index 033ccec..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *  Dtable (dyanmic, data, etc) table 
- *  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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef DTABLE_H__
-#define DTABLE_H__
-
-#include "htsmsg.h"
-
-#include "access.h"
-
-typedef struct dtable_class {
-  const char *dtc_name;
-
-  htsmsg_t *(*dtc_record_get_all)(void *opaque);
-
-  htsmsg_t *(*dtc_record_get)(void *opaque, const char *id);
-  
-  htsmsg_t *(*dtc_record_create)(void *opaque);
-  
-  htsmsg_t *(*dtc_record_update)(void *opaque, const char *id, 
-                                htsmsg_t *values, int maycreate);
-
-  int (*dtc_record_delete)(void *opaque, const char *id);
-
-  int dtc_read_access;
-  int dtc_write_access;
-
-  pthread_mutex_t *dtc_mutex;
-
-} dtable_class_t;
-
-
-typedef struct dtable {
-  LIST_ENTRY(dtable) dt_link;
-
-  void *dt_opaque;
-  char *dt_tablename;
-
-  const dtable_class_t *dt_dtc;
-
-} dtable_t;
-
-dtable_t *dtable_create(const dtable_class_t *dtc, const char *name, 
-                       void *opaque);
-
-void dtable_delete(const char *name);
-
-int dtable_load(dtable_t *dt);
-
-dtable_t *dtable_find(const char *name);
-
-int dtable_record_update_by_array(dtable_t *dt, htsmsg_t *msg);
-
-void dtable_record_delete(dtable_t *dt, const char *id);
-
-int dtable_record_delete_by_array(dtable_t *dt, htsmsg_t *msg);
-
-htsmsg_t *dtable_record_create(dtable_t *dt);
-
-htsmsg_t *dtable_record_get_all(dtable_t *dt);
-
-void dtable_record_store(dtable_t *dt, const char *id, htsmsg_t *r);
-
-void dtable_record_erase(dtable_t *dt, const char *id);
-
-void dtable_store_changed(const dtable_t *dt);
-
-#endif /* DTABLE_H__ */
index c7f299aba4b9ad85530c0b6d9f79fd24b523a88c..56183f2b48f3e15831dfc32c9d731d1975668831 100644 (file)
@@ -31,7 +31,6 @@
 #include "tvheadend.h"
 #include "settings.h"
 #include "dvr.h"
-#include "dtable.h"
 #include "epg.h"
 #include "htsp_server.h"
 
index d9d487d770339c8854ed41093e3a99b1bf7efe45..e2f0d0202bd19e8fe68274a07b0f7e9b4c0cf664 100644 (file)
@@ -31,7 +31,6 @@
 #include "tvheadend.h"
 #include "settings.h"
 #include "dvr.h"
-#include "dtable.h"
 #include "epg.h"
 
 static int dvr_timerec_in_init = 0;
index 8917e4608ce1c1dbfa7d40e81ab3a10b7003f3af..ce4e4385af207d7c2531badfeaede1d84a6a59ad 100755 (executable)
@@ -34,7 +34,6 @@
 #include "http.h"
 #include "webui.h"
 #include "access.h"
-#include "dtable.h"
 #include "channels.h"
 
 #include "dvr/dvr.h"
@@ -275,86 +274,6 @@ page_about(http_connection_t *hc, const char *remain, void *opaque)
   return 0;
 }
 
-/**
- *
- */
-static int
-extjs_tablemgr(http_connection_t *hc, const char *remain, void *opaque)
-{
-  htsbuf_queue_t *hq = &hc->hc_reply;
-  dtable_t *dt;
-  htsmsg_t *out = NULL, *in, *array;
-
-  const char *tablename = http_arg_get(&hc->hc_req_args, "table");
-  const char *op        = http_arg_get(&hc->hc_req_args, "op");
-  const char *entries   = http_arg_get(&hc->hc_req_args, "entries");
-
-  if(op == NULL)
-    return 400;
-
-  if(tablename == NULL || (dt = dtable_find(tablename)) == NULL)
-    return 404;
-  
-  if(http_access_verify(hc, dt->dt_dtc->dtc_read_access))
-    return HTTP_STATUS_UNAUTHORIZED;
-
-  in = entries != NULL ? htsmsg_json_deserialize(entries) : NULL;
-
-  pthread_mutex_lock(dt->dt_dtc->dtc_mutex);
-
-  if(!strcmp(op, "create")) {
-    if(http_access_verify(hc, dt->dt_dtc->dtc_write_access))
-      goto noaccess;
-
-    out = dtable_record_create(dt);
-
-  } else if(!strcmp(op, "get")) {
-    array = dtable_record_get_all(dt);
-
-    out = htsmsg_create_map();
-    htsmsg_add_msg(out, "entries", array);
-
-  } else if(!strcmp(op, "update")) {
-    if(http_access_verify(hc, dt->dt_dtc->dtc_write_access))
-      goto noaccess;
-
-    if(in == NULL)
-      goto bad;
-
-    dtable_record_update_by_array(dt, in);
-
-  } else if(!strcmp(op, "delete")) {
-    if(http_access_verify(hc, dt->dt_dtc->dtc_write_access))
-      goto noaccess;
-
-    if(in == NULL)
-      goto bad;
-
-    dtable_record_delete_by_array(dt, in);
-
-  } else {
-  bad:
-    pthread_mutex_unlock(dt->dt_dtc->dtc_mutex);
-    return HTTP_STATUS_BAD_REQUEST;
-
-  noaccess:
-    pthread_mutex_unlock(dt->dt_dtc->dtc_mutex);
-    return HTTP_STATUS_BAD_REQUEST;
-  }
-
-  pthread_mutex_unlock(dt->dt_dtc->dtc_mutex);
-
-  if(in != NULL)
-    htsmsg_destroy(in);
-
-  if(out == NULL)
-    out = htsmsg_create_map();
-  htsmsg_json_serialize(out, hq, 0);
-  htsmsg_destroy(out);
-  http_output_content(hc, "text/x-json; charset=UTF-8");
-  return 0;
-}
-
 /**
  *
  */
@@ -810,7 +729,6 @@ extjs_start(void)
   http_path_add("/extjs.html",       NULL, extjs_root,             ACCESS_WEB_INTERFACE);
   http_path_add("/tv.html",          NULL, extjs_livetv,           ACCESS_WEB_INTERFACE);
   http_path_add("/capabilities",     NULL, extjs_capabilities,     ACCESS_WEB_INTERFACE);
-  http_path_add("/tablemgr",         NULL, extjs_tablemgr,         ACCESS_WEB_INTERFACE);
   http_path_add("/epggrab",          NULL, extjs_epggrab,          ACCESS_WEB_INTERFACE);
   http_path_add("/config",           NULL, extjs_config,           ACCESS_WEB_INTERFACE);
   http_path_add("/languages",        NULL, extjs_languages,        ACCESS_WEB_INTERFACE);