]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
channel: add imagecache field
authorAdam Sutton <dev@adamsutton.me.uk>
Thu, 16 Jan 2014 21:18:32 +0000 (21:18 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Thu, 16 Jan 2014 21:19:15 +0000 (21:19 +0000)
src/channels.c

index 8207543350b3d6ded1aeca0f3fcfe00a8620d252..749fcb9c381b19f1f626fa761efc9fbec9d7836d 100644 (file)
@@ -183,6 +183,26 @@ channel_class_icon_notify ( void *obj )
     imagecache_get_id(ch->ch_icon);
 }
 
+static const void *
+channel_class_get_imagecache ( void *obj )
+{
+  static char buf[512], *r;
+  uint32_t id;
+  channel_t *ch = obj;
+
+  if (!ch->ch_icon) {
+    r = NULL;
+  } else if ((id = imagecache_get_id(ch->ch_icon))) {
+    snprintf(buf, sizeof(buf), "imagecache/%d", id);
+    r = buf;
+  } else {
+    strncpy(buf, ch->ch_icon, sizeof(buf));
+    r = buf;
+  }
+
+  return &r;
+}
+
 static const char *
 channel_class_get_title ( idnode_t *self )
 {
@@ -300,6 +320,13 @@ const idclass_t channel_class = {
       .off      = offsetof(channel_t, ch_icon),
       .notify   = channel_class_icon_notify,
     },
+    {
+      .type     = PT_STR,
+      .id       = "icon_public_url",
+      .name     = "Icon URL",
+      .get      = channel_class_get_imagecache,
+      .opts     = PO_RDONLY | PO_NOSAVE | PO_HIDDEN,
+    },
     {
       .type     = PT_STR,
       .islist   = 1,