Feature: Add the possibility to update timers via HTSP
This commit is contained in:
parent
48ee984082
commit
5482182c80
3 changed files with 62 additions and 0 deletions
|
@ -242,6 +242,8 @@ dvr_entry_t *dvr_entry_create(const char *dvr_config_name,
|
|||
epg_episode_t *ee, uint8_t content_type,
|
||||
dvr_prio_t pri);
|
||||
|
||||
dvr_entry_t *dvr_entry_update(dvr_entry_t *de, const char* de_title, int de_start, int de_stop);
|
||||
|
||||
void dvr_init(void);
|
||||
|
||||
void dvr_autorec_init(void);
|
||||
|
|
|
@ -589,6 +589,26 @@ dvr_timer_expire(void *aux)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
dvr_entry_t *
|
||||
dvr_entry_update(dvr_entry_t *de, const char* de_title, int de_start, int de_stop)
|
||||
{
|
||||
|
||||
de->de_title = strdup(de_title);
|
||||
de->de_start = de_start;
|
||||
de->de_stop = de_stop;
|
||||
|
||||
dvr_entry_save(de);
|
||||
htsp_dvr_entry_update(de);
|
||||
dvr_entry_notify(de);
|
||||
|
||||
|
||||
tvhlog(LOG_INFO, "dvr", "\"%s\" on \"%s\": Updated Timer", de->de_title, de->de_channel->ch_name);
|
||||
|
||||
return de;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
40
src/htsp.c
40
src/htsp.c
|
@ -534,6 +534,45 @@ htsp_method_addDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
|||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* update a Dvrentry
|
||||
*/
|
||||
static htsmsg_t *
|
||||
htsp_method_updateDvrEntry(htsp_connection_t *htsp, htsmsg_t *in)
|
||||
{
|
||||
htsmsg_t *out;
|
||||
uint32_t dvrEntryId;
|
||||
dvr_entry_t *de;
|
||||
uint32_t start;
|
||||
uint32_t stop;
|
||||
const char *title = NULL;
|
||||
|
||||
if(htsmsg_get_u32(in, "id", &dvrEntryId))
|
||||
return htsp_error("Missing argument 'id'");
|
||||
|
||||
if(htsmsg_get_u32(in, "start", &start))
|
||||
return htsp_error("Missing argument 'start'");
|
||||
|
||||
if(htsmsg_get_u32(in, "stop", &stop))
|
||||
return htsp_error("Missing argument 'stop'");
|
||||
|
||||
title = htsmsg_get_str(in, "title");
|
||||
if (title == NULL)
|
||||
return htsp_error("Missing argument 'title'");
|
||||
|
||||
|
||||
if( (de = dvr_entry_find_by_id(dvrEntryId)) == NULL)
|
||||
return htsp_error("id not found");
|
||||
|
||||
de = dvr_entry_update(de, title, start, stop);
|
||||
|
||||
//create response
|
||||
out = htsmsg_create_map();
|
||||
htsmsg_add_u32(out, "success", 1);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete a Dvrentry
|
||||
*/
|
||||
|
@ -925,6 +964,7 @@ struct {
|
|||
{ "unsubscribe", htsp_method_unsubscribe, ACCESS_STREAMING},
|
||||
{ "subscriptionChangeWeight", htsp_method_change_weight, ACCESS_STREAMING},
|
||||
{ "addDvrEntry", htsp_method_addDvrEntry, ACCESS_RECORDER},
|
||||
{ "updateDvrEntry", htsp_method_updateDvrEntry, ACCESS_RECORDER},
|
||||
{ "deleteDvrEntry", htsp_method_deleteDvrEntry, ACCESS_RECORDER},
|
||||
{ "epgQuery", htsp_method_epgQuery, ACCESS_STREAMING},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue