From ea4d95752274f07fe2998d30a8feb96a62622aee Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Mon, 6 Nov 2017 12:03:02 +0000 Subject: [PATCH] dvr: Prefer image from current broadcast to persisted image, fixes #4685 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 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index f3a4ef56d..fdc07da41 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -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, -- 2.47.3