add command for recording direct of a channel (without any events around or so)
This commit is contained in:
parent
119704586b
commit
19f6af2e67
3 changed files with 50 additions and 0 deletions
25
htsclient.c
25
htsclient.c
|
@ -558,6 +558,30 @@ cr_event_record(client_t *c, char **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
cr_channel_record(client_t *c, char **argv, int argc)
|
||||
{
|
||||
th_channel_t *ch;
|
||||
int duration;
|
||||
|
||||
if(argc < 2)
|
||||
return 1;
|
||||
|
||||
if((ch = channel_by_index(atoi(argv[0]))) == NULL)
|
||||
return 1;
|
||||
|
||||
duration = atoi(argv[1]);
|
||||
|
||||
pvr_channel_record_op(ch, duration);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
@ -643,6 +667,7 @@ const struct {
|
|||
{ "channel.info", cr_channel_info },
|
||||
{ "channel.subscribe", cr_channel_subscribe },
|
||||
{ "channel.unsubscribe", cr_channel_unsubscribe },
|
||||
{ "channel.record", cr_channel_record },
|
||||
{ "event.info", cr_event_info },
|
||||
{ "event.record", cr_event_record },
|
||||
{ "pvr.getlog", cr_pvr_getlog },
|
||||
|
|
23
pvr.c
23
pvr.c
|
@ -268,6 +268,29 @@ pvr_event_record_op(th_channel_t *ch, event_t *e, recop_t op)
|
|||
|
||||
|
||||
|
||||
void
|
||||
pvr_channel_record_op(th_channel_t *ch, int duration)
|
||||
{
|
||||
time_t now = dispatch_clock;
|
||||
time_t start = now;
|
||||
time_t stop = now + duration;
|
||||
pvr_rec_t *pvrr;
|
||||
|
||||
pvrr = calloc(1, sizeof(pvr_rec_t));
|
||||
pvrr->pvrr_status = HTSTV_PVR_STATUS_SCHEDULED;
|
||||
pvrr->pvrr_channel = ch;
|
||||
pvrr->pvrr_start = start;
|
||||
pvrr->pvrr_stop = stop;
|
||||
pvrr->pvrr_title = strdup("Manual recording");
|
||||
pvrr->pvrr_desc = NULL;
|
||||
|
||||
pvr_link_pvrr(pvrr);
|
||||
pvr_database_save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Plain text "database" of pvr programmes
|
||||
|
|
2
pvr.h
2
pvr.h
|
@ -46,4 +46,6 @@ void pvr_database_save(void);
|
|||
|
||||
void pvrr_set_rec_state(pvr_rec_t *pvrr, pvrr_rec_status_t status);
|
||||
|
||||
void pvr_channel_record_op(th_channel_t *ch, int duration);
|
||||
|
||||
#endif /* PVR_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue