From: ksooo <3226626+ksooo@users.noreply.github.com> Date: Fri, 6 Sep 2024 05:59:50 +0000 (+0200) Subject: HTSP: deliver 'comment' with autorecEntry(Add|Update), timerecEntry(Add|Update).... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4aff543283b88017a59c90ccd7d22aee24b5ee4f;p=thirdparty%2Ftvheadend.git HTSP: deliver 'comment' with autorecEntry(Add|Update), timerecEntry(Add|Update). Allow setting 'comment' with 'updateDvrEntry'. --- diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index b6a27db0e..13dc60743 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -603,7 +603,7 @@ dvr_entry_update( dvr_entry_t *de, int enabled, time_t start_extra, time_t stop_extra, dvr_prio_t pri, int retention, int removal, int playcount, int playposition, int age_rating, - ratinglabel_t *rating_label); + ratinglabel_t *rating_label, const char *comment); void dvr_destroy_by_channel(channel_t *ch, int delconf); diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 82e473f51..153e11d4b 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -2397,10 +2397,11 @@ dvr_timer_remove_files(void *aux) #define DVR_UPDATED_PLAYPOS (1<<18) #define DVR_UPDATED_PLAYCOUNT (1<<19) #define DVR_UPDATED_AGE_RATING (1<<20) +#define DVR_UPDATED_COMMENT (1<<21) static char *dvr_updated_str(char *buf, size_t buflen, int flags) { - static const char *x = "ecoOsStumdpgrviBEC"; + static const char *x = "ecoOsStumdpgrviBECPaAM"; const char *p = x; char *w = buf, *end = buf + buflen; @@ -2445,7 +2446,7 @@ static dvr_entry_t *_dvr_entry_update time_t start_extra, time_t stop_extra, dvr_prio_t pri, int retention, int removal, int playcount, int playposition, int age_rating, - ratinglabel_t *rating_label) + ratinglabel_t *rating_label, const char *comment) { char buf[40]; int save = 0, updated = 0; @@ -2567,6 +2568,13 @@ static dvr_entry_t *_dvr_entry_update save |= DVR_UPDATED_AGE_RATING; } + /* Comment */ + if (strcmp(de->de_comment ?: "", comment ?: "")) { + free(de->de_comment); + de->de_comment = comment ? strdup(comment) : NULL; + save |= DVR_UPDATED_COMMENT; + } + /* Title */ if (e && e->title) { save |= lang_str_set2(&de->de_title, e->title) ? DVR_UPDATED_TITLE : 0; @@ -2683,13 +2691,13 @@ dvr_entry_update time_t start, time_t stop, time_t start_extra, time_t stop_extra, dvr_prio_t pri, int retention, int removal, int playcount, int playposition, - int age_rating, ratinglabel_t *rating_label ) + int age_rating, ratinglabel_t *rating_label, const char *comment) { return _dvr_entry_update(de, enabled, dvr_config_uuid, NULL, ch, title, subtitle, summary, desc, lang, start, stop, start_extra, stop_extra, pri, retention, removal, playcount, playposition, - age_rating, rating_label); + age_rating, rating_label, comment); } /** @@ -2743,7 +2751,7 @@ dvr_event_replaced(epg_broadcast_t *e, epg_broadcast_t *new_e) gmtime2local(e2->start, t1buf, sizeof(t1buf)), gmtime2local(e2->stop, t2buf, sizeof(t2buf))); _dvr_entry_update(de, -1, NULL, e2, NULL, NULL, NULL, NULL, NULL, - NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL); + NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL, NULL); return; } } @@ -2784,7 +2792,7 @@ void dvr_event_updated(epg_broadcast_t *e) assert(de->de_bcast == e); if (de->de_sched_state != DVR_SCHEDULED) continue; _dvr_entry_update(de, -1, NULL, e, NULL, NULL, NULL, NULL, NULL, - NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL); + NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL, NULL); } LIST_FOREACH(de, &e->channel->ch_dvrs, de_channel_link) { if (de->de_sched_state != DVR_SCHEDULED) continue; @@ -2796,7 +2804,7 @@ void dvr_event_updated(epg_broadcast_t *e) epg_broadcast_get_title(e, NULL), channel_get_name(e->channel, channel_blank_name)); _dvr_entry_update(de, -1, NULL, e, NULL, NULL, NULL, NULL, NULL, - NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL); + NULL, 0, 0, 0, 0, DVR_PRIO_NOTSET, 0, 0, -1, -1, 0, NULL, NULL); } } } diff --git a/src/htsp_server.c b/src/htsp_server.c index 3b0c423bf..0b17ce183 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -51,7 +51,7 @@ static void *htsp_server, *htsp_server_2; -#define HTSP_PROTO_VERSION 41 +#define HTSP_PROTO_VERSION 42 #define HTSP_ASYNC_OFF 0x00 #define HTSP_ASYNC_ON 0x01 @@ -1267,6 +1267,7 @@ htsp_build_autorecentry(htsp_connection_t *htsp, dvr_autorec_entry_t *dae, const htsmsg_add_u32(out, "dupDetect", dae->dae_record); htsmsg_add_u32(out, "maxCount", dae->dae_max_count); htsmsg_add_u32(out, "broadcastType", dae->dae_btype); + htsmsg_add_str2(out, "comment", dae->dae_comment); if(dae->dae_title) { htsmsg_add_str(out, "title", dae->dae_title); @@ -1312,6 +1313,7 @@ htsp_build_timerecentry(htsp_connection_t *htsp, dvr_timerec_entry_t *dte, const htsmsg_add_u32(out, "priority", dte->dte_pri); htsmsg_add_s32(out, "start", dte->dte_start); htsmsg_add_s32(out, "stop", dte->dte_stop); + htsmsg_add_str2(out, "comment", dte->dte_comment); if(dte->dte_title) htsmsg_add_str(out, "title", dte->dte_title); @@ -2192,7 +2194,7 @@ htsp_method_updateDvrEntry(htsp_connection_t *htsp, htsmsg_t *in) uint32_t u32; dvr_entry_t *de; time_t start, stop, start_extra, stop_extra, priority; - const char *dvr_config_name, *title, *subtitle, *summary, *desc, *lang; + const char *dvr_config_name, *title, *subtitle, *summary, *desc, *lang, *comment; channel_t *channel = NULL; int enabled, retention, removal, playcount = -1, playposition = -1; int age_rating; @@ -2227,6 +2229,7 @@ htsp_method_updateDvrEntry(htsp_connection_t *htsp, htsmsg_t *in) summary = htsmsg_get_str(in, "summary"); desc = htsmsg_get_str(in, "description"); lang = htsmsg_get_str(in, "language") ?: htsp->htsp_language; + comment = htsmsg_get_str(in, "comment"); if(!htsmsg_get_u32(in, "playcount", &u32)) { if (u32 > INT_MAX) @@ -2255,7 +2258,7 @@ htsp_method_updateDvrEntry(htsp_connection_t *htsp, htsmsg_t *in) de = dvr_entry_update(de, enabled, dvr_config_name, channel, title, subtitle, summary, desc, lang, start, stop, start_extra, stop_extra, priority, retention, removal, playcount, playposition, - age_rating, rating_label); + age_rating, rating_label, comment); return htsp_success(); }