DVR: Add owner (user) field
This commit is contained in:
parent
932ade39e8
commit
066b273387
8 changed files with 74 additions and 22 deletions
|
@ -209,7 +209,9 @@ api_dvr_entry_create_by_event
|
|||
dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid);
|
||||
if (cfg) {
|
||||
de = dvr_entry_create_by_event(idnode_uuid_as_str(&cfg->dvr_id),
|
||||
e, 0, 0, perm->aa_representative,
|
||||
e, 0, 0,
|
||||
perm->aa_username,
|
||||
perm->aa_representative,
|
||||
NULL, DVR_PRIO_NORMAL, 0, comment);
|
||||
if (de)
|
||||
dvr_entry_save(de);
|
||||
|
@ -257,6 +259,8 @@ api_dvr_autorec_create
|
|||
if (!(conf = htsmsg_get_map(args, "conf")))
|
||||
return EINVAL;
|
||||
|
||||
if (perm->aa_username)
|
||||
htsmsg_set_str(conf, "owner", perm->aa_username);
|
||||
if (perm->aa_representative)
|
||||
htsmsg_set_str(conf, "creator", perm->aa_representative);
|
||||
|
||||
|
@ -301,7 +305,9 @@ api_dvr_autorec_create_by_series
|
|||
dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid);
|
||||
if (cfg) {
|
||||
dae = dvr_autorec_add_series_link(idnode_uuid_as_str(&cfg->dvr_id),
|
||||
e, perm->aa_representative,
|
||||
e,
|
||||
perm->aa_username,
|
||||
perm->aa_representative,
|
||||
"Created from EPG query");
|
||||
if (dae) {
|
||||
dvr_autorec_save(dae);
|
||||
|
@ -338,6 +344,8 @@ api_dvr_timerec_create
|
|||
if (!(conf = htsmsg_get_map(args, "conf")))
|
||||
return EINVAL;
|
||||
|
||||
if (perm->aa_username)
|
||||
htsmsg_set_str(conf, "owner", perm->aa_username);
|
||||
if (perm->aa_representative)
|
||||
htsmsg_set_str(conf, "creator", perm->aa_representative);
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ typedef struct dvr_entry {
|
|||
time_t de_start_extra;
|
||||
time_t de_stop_extra;
|
||||
|
||||
char *de_owner;
|
||||
char *de_creator;
|
||||
char *de_comment;
|
||||
char *de_filename; /* Initially null if no filename has been
|
||||
|
@ -243,6 +244,7 @@ typedef struct dvr_autorec_entry {
|
|||
LIST_ENTRY(dvr_autorec_entry) dae_config_link;
|
||||
|
||||
int dae_enabled;
|
||||
char *dae_owner;
|
||||
char *dae_creator;
|
||||
char *dae_comment;
|
||||
|
||||
|
@ -296,6 +298,7 @@ typedef struct dvr_timerec_entry {
|
|||
LIST_ENTRY(dvr_timerec_entry) dte_config_link;
|
||||
|
||||
int dte_enabled;
|
||||
char *dte_owner;
|
||||
char *dte_creator;
|
||||
char *dte_comment;
|
||||
|
||||
|
@ -404,7 +407,7 @@ dvr_entry_t *
|
|||
dvr_entry_create_by_event( const char *dvr_config_uuid,
|
||||
epg_broadcast_t *e,
|
||||
time_t start_extra, time_t stop_extra,
|
||||
const char *creator,
|
||||
const char *owner, const char *creator,
|
||||
dvr_autorec_entry_t *dae,
|
||||
dvr_prio_t pri, int retention,
|
||||
const char *comment );
|
||||
|
@ -415,7 +418,8 @@ dvr_entry_create_htsp( const char *dvr_config_uuid,
|
|||
time_t start_extra, time_t stop_extra,
|
||||
const char *title, const char *description,
|
||||
const char *lang, epg_genre_t *content_type,
|
||||
const char *creator, dvr_autorec_entry_t *dae,
|
||||
const char *owner, const char *creator,
|
||||
dvr_autorec_entry_t *dae,
|
||||
dvr_prio_t pri, int retention,
|
||||
const char *comment );
|
||||
|
||||
|
@ -475,8 +479,8 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e,
|
|||
time_t start_extra, time_t stop_extra,
|
||||
const char *title, const char *description,
|
||||
const char *lang, epg_genre_t *content_type,
|
||||
const char *creator, dvr_autorec_entry_t *dae,
|
||||
dvr_timerec_entry_t *tae,
|
||||
const char *owner, const char *creator,
|
||||
dvr_autorec_entry_t *dae, dvr_timerec_entry_t *tae,
|
||||
dvr_prio_t pri, int retention, const char *comment);
|
||||
|
||||
dvr_autorec_entry_t *
|
||||
|
@ -485,12 +489,14 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
|
|||
uint32_t days, time_t start_extra, time_t stop_extra,
|
||||
dvr_prio_t pri, int retention,
|
||||
int min_duration, int max_duration,
|
||||
const char *creator, const char *comment);
|
||||
const char *owner, const char *creator,
|
||||
const char *comment);
|
||||
|
||||
dvr_autorec_entry_t *
|
||||
dvr_autorec_add_series_link(const char *dvr_config_name,
|
||||
epg_broadcast_t *event,
|
||||
const char *creator, const char *comment);
|
||||
const char *owner, const char *creator,
|
||||
const char *comment);
|
||||
|
||||
void dvr_autorec_save(dvr_autorec_entry_t *dae);
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
|
|||
uint32_t weekdays, time_t start_extra, time_t stop_extra,
|
||||
dvr_prio_t pri, int retention,
|
||||
int min_duration, int max_duration,
|
||||
const char *creator, const char *comment)
|
||||
const char *owner, const char *creator, const char *comment)
|
||||
{
|
||||
dvr_autorec_entry_t *dae;
|
||||
htsmsg_t *conf, *days;
|
||||
|
@ -214,6 +214,7 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
|
|||
htsmsg_add_s64(conf, "stop_extra", stop_extra);
|
||||
htsmsg_add_str(conf, "title", title);
|
||||
htsmsg_add_str(conf, "config_name", dvr_config_name ?: "");
|
||||
htsmsg_add_str(conf, "owner", owner ?: "");
|
||||
htsmsg_add_str(conf, "creator", creator ?: "");
|
||||
htsmsg_add_str(conf, "comment", comment ?: "");
|
||||
|
||||
|
@ -248,7 +249,8 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title,
|
|||
dvr_autorec_entry_t *
|
||||
dvr_autorec_add_series_link(const char *dvr_config_name,
|
||||
epg_broadcast_t *event,
|
||||
const char *creator, const char *comment)
|
||||
const char *owner, const char *creator,
|
||||
const char *comment)
|
||||
{
|
||||
dvr_autorec_entry_t *dae;
|
||||
htsmsg_t *conf;
|
||||
|
@ -264,6 +266,7 @@ dvr_autorec_add_series_link(const char *dvr_config_name,
|
|||
htsmsg_add_str(conf, "channel", channel_get_name(event->channel));
|
||||
if (event->serieslink)
|
||||
htsmsg_add_str(conf, "serieslink", event->serieslink->uri);
|
||||
htsmsg_add_str(conf, "owner", owner ?: "");
|
||||
htsmsg_add_str(conf, "creator", creator ?: "");
|
||||
htsmsg_add_str(conf, "comment", comment ?: "");
|
||||
dae = dvr_autorec_create(NULL, conf);
|
||||
|
@ -291,6 +294,7 @@ autorec_entry_destroy(dvr_autorec_entry_t *dae, int delconf)
|
|||
LIST_REMOVE(dae, dae_config_link);
|
||||
|
||||
free(dae->dae_name);
|
||||
free(dae->dae_owner);
|
||||
free(dae->dae_creator);
|
||||
free(dae->dae_comment);
|
||||
|
||||
|
@ -959,6 +963,13 @@ const idclass_t dvr_autorec_entry_class = {
|
|||
.get = dvr_autorec_entry_class_series_link_get,
|
||||
.opts = PO_RDONLY,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "owner",
|
||||
.name = "Owner",
|
||||
.off = offsetof(dvr_autorec_entry_t, dae_owner),
|
||||
.opts = PO_RDONLY,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "creator",
|
||||
|
|
|
@ -458,6 +458,7 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e,
|
|||
time_t start_extra, time_t stop_extra,
|
||||
const char *title, const char *description,
|
||||
const char *lang, epg_genre_t *content_type,
|
||||
const char *owner,
|
||||
const char *creator, dvr_autorec_entry_t *dae,
|
||||
dvr_timerec_entry_t *dte,
|
||||
dvr_prio_t pri, int retention,
|
||||
|
@ -479,6 +480,7 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e,
|
|||
htsmsg_add_str(conf, "config_name", config_uuid ?: "");
|
||||
htsmsg_add_s64(conf, "start_extra", start_extra);
|
||||
htsmsg_add_s64(conf, "stop_extra", stop_extra);
|
||||
htsmsg_add_str(conf, "owner", owner ?: "");
|
||||
htsmsg_add_str(conf, "creator", creator ?: "");
|
||||
htsmsg_add_str(conf, "comment", comment ?: "");
|
||||
if (e) {
|
||||
|
@ -547,6 +549,7 @@ dvr_entry_create_htsp(const char *config_uuid,
|
|||
const char *title,
|
||||
const char *description, const char *lang,
|
||||
epg_genre_t *content_type,
|
||||
const char *owner,
|
||||
const char *creator, dvr_autorec_entry_t *dae,
|
||||
dvr_prio_t pri, int retention,
|
||||
const char *comment)
|
||||
|
@ -558,7 +561,7 @@ dvr_entry_create_htsp(const char *config_uuid,
|
|||
NULL,
|
||||
ch, start, stop, start_extra, stop_extra,
|
||||
title, description, lang, content_type,
|
||||
creator, dae, NULL, pri, retention,
|
||||
owner, creator, dae, NULL, pri, retention,
|
||||
comment);
|
||||
}
|
||||
|
||||
|
@ -569,6 +572,7 @@ dvr_entry_t *
|
|||
dvr_entry_create_by_event(const char *config_uuid,
|
||||
epg_broadcast_t *e,
|
||||
time_t start_extra, time_t stop_extra,
|
||||
const char *owner,
|
||||
const char *creator, dvr_autorec_entry_t *dae,
|
||||
dvr_prio_t pri, int retention,
|
||||
const char *comment)
|
||||
|
@ -581,7 +585,7 @@ dvr_entry_create_by_event(const char *config_uuid,
|
|||
start_extra, stop_extra,
|
||||
NULL, NULL, NULL,
|
||||
LIST_FIRST(&e->episode->genre),
|
||||
creator, dae, NULL, pri, retention,
|
||||
owner, creator, dae, NULL, pri, retention,
|
||||
comment);
|
||||
}
|
||||
|
||||
|
@ -639,7 +643,7 @@ dvr_entry_create_by_autorec(epg_broadcast_t *e, dvr_autorec_entry_t *dae)
|
|||
|
||||
dvr_entry_create_by_event(idnode_uuid_as_str(&dae->dae_config->dvr_id), e,
|
||||
dae->dae_start_extra, dae->dae_stop_extra,
|
||||
buf, dae, dae->dae_pri, dae->dae_retention,
|
||||
dae->dae_owner, buf, dae, dae->dae_pri, dae->dae_retention,
|
||||
dae->dae_comment);
|
||||
}
|
||||
|
||||
|
@ -670,6 +674,7 @@ dvr_entry_dec_ref(dvr_entry_t *de)
|
|||
LIST_REMOVE(de, de_config_link);
|
||||
|
||||
free(de->de_filename);
|
||||
free(de->de_owner);
|
||||
free(de->de_creator);
|
||||
free(de->de_comment);
|
||||
if (de->de_title) lang_str_destroy(de->de_title);
|
||||
|
@ -1819,6 +1824,13 @@ const idclass_t dvr_entry_class = {
|
|||
.rend = dvr_entry_class_config_name_rend,
|
||||
.get_opts = dvr_entry_class_start_opts,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "owner",
|
||||
.name = "Owner",
|
||||
.off = offsetof(dvr_entry_t, de_owner),
|
||||
.opts = PO_RDONLY,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "creator",
|
||||
|
|
|
@ -155,7 +155,7 @@ dvr_timerec_check(dvr_timerec_entry_t *dte)
|
|||
de = dvr_entry_create_(idnode_uuid_as_str(&dte->dte_config->dvr_id),
|
||||
NULL, dte->dte_channel,
|
||||
start, stop, 0, 0, title,
|
||||
NULL, NULL, NULL, buf,
|
||||
NULL, NULL, NULL, dte->dte_owner, buf,
|
||||
NULL, dte, dte->dte_pri, dte->dte_retention,
|
||||
dte->dte_comment);
|
||||
|
||||
|
@ -216,6 +216,7 @@ timerec_entry_destroy(dvr_timerec_entry_t *dte, int delconf)
|
|||
|
||||
free(dte->dte_name);
|
||||
free(dte->dte_title);
|
||||
free(dte->dte_owner);
|
||||
free(dte->dte_creator);
|
||||
free(dte->dte_comment);
|
||||
|
||||
|
@ -553,6 +554,13 @@ const idclass_t dvr_timerec_entry_class = {
|
|||
.rend = dvr_timerec_entry_class_config_name_rend,
|
||||
.list = dvr_entry_class_config_name_list,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "owner",
|
||||
.name = "Owner",
|
||||
.off = offsetof(dvr_timerec_entry_t, dte_creator),
|
||||
.opts = PO_RDONLY,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "creator",
|
||||
|
|
|
@ -1384,13 +1384,16 @@ htsp_method_addDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
// create the dvr entry
|
||||
de = dvr_entry_create_htsp(dvr_config_name, ch, start, stop,
|
||||
start_extra, stop_extra,
|
||||
title, desc, lang, 0, creator, NULL,
|
||||
title, desc, lang, 0,
|
||||
htsp->htsp_granted_access->aa_username,
|
||||
creator, NULL,
|
||||
priority, retention, comment);
|
||||
|
||||
/* Event timer */
|
||||
} else {
|
||||
de = dvr_entry_create_by_event(dvr_config_name, e,
|
||||
start_extra, stop_extra,
|
||||
htsp->htsp_granted_access->aa_username,
|
||||
creator, NULL,
|
||||
priority, retention, comment);
|
||||
}
|
||||
|
@ -1574,7 +1577,8 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
return htsp_error("User does not have access");
|
||||
|
||||
dae = dvr_autorec_create_htsp(dvr_config_name, title, ch, start, start_window, days_of_week,
|
||||
start_extra, stop_extra, priority, retention, min_duration, max_duration, creator, comment);
|
||||
start_extra, stop_extra, priority, retention, min_duration, max_duration,
|
||||
htsp->htsp_granted_access->aa_username, creator, comment);
|
||||
|
||||
/* create response */
|
||||
out = htsmsg_create_map();
|
||||
|
|
|
@ -315,7 +315,8 @@ page_einfo(http_connection_t *hc, const char *remain, void *opaque)
|
|||
de = dvr_entry_find_by_event(e);
|
||||
|
||||
if((http_arg_get(&hc->hc_req_args, "rec")) != NULL) {
|
||||
de = dvr_entry_create_by_event(NULL, e, 0, 0, hc->hc_username ?: NULL, NULL,
|
||||
de = dvr_entry_create_by_event(NULL, e, 0, 0, hc->hc_username ?: NULL,
|
||||
hc->hc_representative ?: NULL, NULL,
|
||||
DVR_PRIO_NORMAL, 0, "simpleui");
|
||||
} else if(de != NULL && (http_arg_get(&hc->hc_req_args, "cancel")) != NULL) {
|
||||
de = dvr_entry_cancel(de);
|
||||
|
|
|
@ -207,7 +207,7 @@ tvheadend.dvr_upcoming = function(panel, index) {
|
|||
},
|
||||
del: true,
|
||||
list: 'disp_title,episode,pri,start_real,stop_real,' +
|
||||
'duration,channelname,creator,config_name,' +
|
||||
'duration,channelname,owner,creator,config_name,' +
|
||||
'sched_status,comment',
|
||||
sort: {
|
||||
field: 'start_real',
|
||||
|
@ -270,7 +270,7 @@ tvheadend.dvr_finished = function(panel, index) {
|
|||
delquestion: 'Do you really want to delete the selected recordings?<br/><br/>' +
|
||||
'The associated file will be removed from the storage.',
|
||||
list: 'disp_title,episode,start_real,stop_real,' +
|
||||
'duration,filesize,channelname,creator,' +
|
||||
'duration,filesize,channelname,owner,creator,' +
|
||||
'sched_status,url,comment',
|
||||
columns: {
|
||||
filesize: {
|
||||
|
@ -350,7 +350,7 @@ tvheadend.dvr_failed = function(panel, index) {
|
|||
delquestion: 'Do you really want to delete the selected recordings?<br/><br/>' +
|
||||
'The associated file will be removed from the storage.',
|
||||
list: 'disp_title,episode,start_real,stop_real,' +
|
||||
'duration,filesize,channelname,creator,' +
|
||||
'duration,filesize,channelname,owner,creator,' +
|
||||
'status,sched_status,url,comment',
|
||||
columns: {
|
||||
filesize: {
|
||||
|
@ -437,6 +437,7 @@ tvheadend.autorec_editor = function(panel, index) {
|
|||
start_window: { width: 100 },
|
||||
pri: { width: 80 },
|
||||
config_name: { width: 120 },
|
||||
owner: { width: 100 },
|
||||
creator: { width: 200 },
|
||||
comment: { width: 200 }
|
||||
},
|
||||
|
@ -450,7 +451,7 @@ tvheadend.autorec_editor = function(panel, index) {
|
|||
},
|
||||
del: true,
|
||||
list: 'enabled,name,title,channel,tag,content_type,minduration,' +
|
||||
'maxduration,weekdays,start,start_window,pri,config_name,creator,comment',
|
||||
'maxduration,weekdays,start,start_window,pri,config_name,owner,creator,comment',
|
||||
columns: {
|
||||
weekdays: {
|
||||
renderer: function(st) { return tvheadend.weekdaysRenderer(st); }
|
||||
|
@ -490,6 +491,7 @@ tvheadend.timerec_editor = function(panel, index) {
|
|||
stop: { width: 100 },
|
||||
pri: { width: 80 },
|
||||
config_name: { width: 120 },
|
||||
owner: { width: 100 },
|
||||
creator: { width: 200 },
|
||||
comment: { width: 200 }
|
||||
},
|
||||
|
@ -501,7 +503,7 @@ tvheadend.timerec_editor = function(panel, index) {
|
|||
create: { }
|
||||
},
|
||||
del: true,
|
||||
list: 'enabled,name,title,channel,weekdays,start,stop,pri,config_name,comment',
|
||||
list: 'enabled,name,title,channel,weekdays,start,stop,pri,config_name,owner,creator,comment',
|
||||
columns: {
|
||||
weekdays: {
|
||||
renderer: function(st) { return tvheadend.weekdaysRenderer(st); }
|
||||
|
|
Loading…
Add table
Reference in a new issue