]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Prefer image from current broadcast to persisted image, fixes #4685
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Mon, 6 Nov 2017 12:03:02 +0000 (12:03 +0000)
committerJaroslav Kysela <perex@perex.cz>
Wed, 8 Nov 2017 16:55:16 +0000 (17:55 +0100)
A programme in the far future may have generic details and a generic
image. For example, "Oprah is interviewing people." As the programme
nears broadcast date, the programme may then get more specific details
and a more specific image ("Oprah is interviewing Bob").

So we prefer the image from the broadcast to the one currently persisted.

src/dvr/dvr_db.c

index f3a4ef56d4945c8eeba92805a896a08e91b41458..fdc07da41dee5a10f9748a6ac4763029c37bf195 100644 (file)
@@ -3300,16 +3300,23 @@ static const void *
 dvr_entry_class_image_url_get_as_property(void *o)
 {
   dvr_entry_t *de = (dvr_entry_t *)o;
+  static const char *s = "";
+  /* We prefer the image from the broadcast to the one currently
+   * persisted.  This is because a programme scheduled far in the
+   * future may have a generic image that will be updated nearer the
+   * broadcast date with a more specific image.
+   */
+  if (de->de_bcast && de->de_bcast->episode && de->de_bcast->episode->image) {
+    snprintf(prop_sbuf, PROP_SBUF_LEN, "%s", de->de_bcast->episode->image);
+    return &prop_sbuf_ptr;
+  }
+
   if (de->de_image) {
     prop_ptr = de->de_image;
     return &prop_ptr;
   }
 
-  static const char *s = "";
-  if (!de->de_bcast || !de->de_bcast->episode || !de->de_bcast->episode->image)
-      return &s;
-  snprintf(prop_sbuf, PROP_SBUF_LEN, "%s", de->de_bcast->episode->image);
-  return &prop_sbuf_ptr;
+  return &s;
 }
 
 const char *
@@ -3506,7 +3513,7 @@ const idclass_t dvr_entry_class = {
       .desc     = N_("Episode image."),
       .get      = dvr_entry_class_image_url_get_as_property,
       .off      = offsetof(dvr_entry_t, de_image),
-      .opts     = PO_HIDDEN,
+      .opts     = PO_HIDDEN | PO_RDONLY,
     },
     {
       .type     = PT_LANGSTR,