From: pablozg Date: Sun, 4 Feb 2018 14:53:36 +0000 (+0100) Subject: DVR: add the possibility to edit the extratext field and the episode field, fixes... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ac382498a33abc2ecb06d42e6eb0e9c89aa21ec;p=thirdparty%2Ftvheadend.git DVR: add the possibility to edit the extratext field and the episode field, fixes #4902 Sometimes the recordings don't have the proper order (one missed, no free adapter, etc) and it would be good to have the option to add the "Season XX.Episode XX" text by hand if it is not set previously. --- diff --git a/src/api/api_dvr.c b/src/api/api_dvr.c index 04c1e2e6a..767371f00 100644 --- a/src/api/api_dvr.c +++ b/src/api/api_dvr.c @@ -164,6 +164,8 @@ api_dvr_entry_create } s1 = htsmsg_get_str(conf, "disp_subtitle"); + if (s1 == NULL || s1[0] == '\0') + s1 = htsmsg_get_str(conf, "disp_extratext"); if (s1 && !htsmsg_get_map(conf, "subtitle")) { m = htsmsg_create_map(); htsmsg_add_str(m, lang, s1); diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 67749275c..d8cf59051 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -3233,6 +3233,27 @@ dvr_entry_class_disp_extratext_get(void *o) return &prop_ptr; } +static int +dvr_entry_class_disp_extratext_set(void *o, const void *v) +{ + dvr_entry_t *de = (dvr_entry_t *)o; + const char *lang = idnode_lang(o); + v = tvh_str_default(v, "?????"); + + if (de->de_subtitle && lang_str_get(de->de_subtitle, lang)[0] != '\0'){ + return lang_str_set(&de->de_subtitle, v, lang); + } + if (de->de_summary && lang_str_get(de->de_summary, lang)[0] != '\0'){ + return lang_str_set(&de->de_summary, v, lang); + } + if (de->de_desc && lang_str_get(de->de_desc, lang)[0] != '\0'){ + return lang_str_set(&de->de_desc, v, lang); + } + // If subtitle, summary or descripcion is not set, the extratext + // field is stored in subtitle by default + return lang_str_set(&de->de_subtitle, v, lang); +} + static int dvr_entry_class_disp_episode_set(void *o, const void *v) { @@ -3715,9 +3736,10 @@ const idclass_t dvr_entry_class = { .type = PT_STR, .id = "disp_extratext", .name = N_("Extra text"), - .desc = N_("Subtitle, summary or description of the program (if any) (display only)."), + .desc = N_("Subtitle, summary or description of the program (if any)."), .get = dvr_entry_class_disp_extratext_get, - .opts = PO_RDONLY | PO_NOSAVE, + .set = dvr_entry_class_disp_extratext_set, + .opts = PO_NOSAVE, }, { .type = PT_INT, @@ -3969,7 +3991,7 @@ const idclass_t dvr_entry_class = { .desc = N_("Episode number/ID."), .set = dvr_entry_class_disp_episode_set, .get = dvr_entry_class_disp_episode_get, - .opts = PO_RDONLY | PO_HIDDEN | PO_NOSAVE, + .opts = PO_HIDDEN | PO_NOSAVE, }, { .type = PT_STR, diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 0df5df9b6..4923ba968 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -291,10 +291,10 @@ tvheadend.dvrButtonFcn = function(store, select, _url, q) { tvheadend.dvr_upcoming = function(panel, index) { var actions = tvheadend.dvrRowActions(); - var list = 'disp_title,channel,start,start_extra,stop,stop_extra,pri,config_name,comment'; + var list = 'disp_title,disp_extratext,channel,start,start_extra,stop,stop_extra,pri,config_name,comment'; var elist = 'enabled,' + (tvheadend.accessUpdate.admin ? - list + ',owner,creator' : list) + ',retention,removal'; + list + ',episode_disp,owner,creator' : list) + ',retention,removal'; var duplicates = 0; var buttonFcn = tvheadend.dvrButtonFcn; var columnId = null; @@ -588,7 +588,7 @@ tvheadend.dvr_finished = function(panel, index) { tabIndex: index, edit: { params: { - list: tvheadend.admin ? "playcount,retention,removal,owner,comment" : + list: tvheadend.admin ? "disp_title,disp_extratext,episode_disp,playcount,retention,removal,owner,comment" : "retention,removal,comment" } }, @@ -782,7 +782,7 @@ tvheadend.dvr_removed = function(panel, index) { iconCls: 'remove', tabIndex: index, uilevel: 'expert', - edit: { params: { list: tvheadend.admin ? "retention,owner,comment" : "retention,comment" } }, + edit: { params: { list: tvheadend.admin ? "retention,owner,disp_title,disp_extratext,episode_disp,comment" : "retention,comment" } }, del: true, list: 'disp_title,disp_extratext,episode_disp,channelname,image,' + 'copyright_year,start_real,stop_real,duration,status,' + @@ -836,7 +836,7 @@ tvheadend.autorec_editor = function(panel, index) { var list = 'name,title,fulltext,channel,start,start_window,weekdays,' + 'record,tag,btype,content_type,cat1,cat2,cat3,minduration,maxduration,' + - 'star_rating,dedup,directory,config_name,comment'; + 'star_rating,dedup,directory,config_name,comment,pri'; var elist = 'enabled,start_extra,stop_extra,' + (tvheadend.accessUpdate.admin ? list + ',owner,creator' : list) + ',pri,retention,removal,maxcount,maxsched';