Add an option for replacing spaces in title with '-' for DVR recorded files
Patch by: tuomaz
This commit is contained in:
parent
e2148358bf
commit
8121d950be
5 changed files with 23 additions and 8 deletions
|
@ -34,11 +34,12 @@ extern int dvr_extra_time_pre;
|
|||
extern int dvr_extra_time_post;
|
||||
extern struct dvr_entry_list dvrentries;
|
||||
|
||||
#define DVR_DIR_PER_DAY 0x1
|
||||
#define DVR_DIR_PER_CHANNEL 0x2
|
||||
#define DVR_CHANNEL_IN_TITLE 0x4
|
||||
#define DVR_DATE_IN_TITLE 0x8
|
||||
#define DVR_TIME_IN_TITLE 0x10
|
||||
#define DVR_DIR_PER_DAY 0x1
|
||||
#define DVR_DIR_PER_CHANNEL 0x2
|
||||
#define DVR_CHANNEL_IN_TITLE 0x4
|
||||
#define DVR_DATE_IN_TITLE 0x8
|
||||
#define DVR_TIME_IN_TITLE 0x10
|
||||
#define DVR_WHITESPACE_IN_TITLE 0x20
|
||||
|
||||
LIST_HEAD(dvr_rec_stream_list, dvr_rec_stream);
|
||||
|
||||
|
|
|
@ -557,7 +557,10 @@ dvr_init(void)
|
|||
|
||||
if(!htsmsg_get_u32(m, "time-in-title", &u32) && u32)
|
||||
dvr_flags |= DVR_TIME_IN_TITLE;
|
||||
|
||||
|
||||
if(!htsmsg_get_u32(m, "whitespace-in-title", &u32) && u32)
|
||||
dvr_flags |= DVR_WHITESPACE_IN_TITLE;
|
||||
|
||||
tvh_str_set(&dvr_postproc, htsmsg_get_str(m, "postproc"));
|
||||
|
||||
htsmsg_destroy(m);
|
||||
|
@ -608,6 +611,7 @@ dvr_save(void)
|
|||
htsmsg_add_u32(m, "channel-in-title", !!(dvr_flags & DVR_CHANNEL_IN_TITLE));
|
||||
htsmsg_add_u32(m, "date-in-title", !!(dvr_flags & DVR_DATE_IN_TITLE));
|
||||
htsmsg_add_u32(m, "time-in-title", !!(dvr_flags & DVR_TIME_IN_TITLE));
|
||||
htsmsg_add_u32(m, "whitespace-in-title", !!(dvr_flags & DVR_WHITESPACE_IN_TITLE));
|
||||
if(dvr_postproc != NULL)
|
||||
htsmsg_add_str(m, "postproc", dvr_postproc);
|
||||
|
||||
|
|
|
@ -145,10 +145,14 @@ static void
|
|||
cleanupfilename(char *s)
|
||||
{
|
||||
int i, len = strlen(s);
|
||||
for(i = 0; i < len; i++)
|
||||
for(i = 0; i < len; i++) {
|
||||
if(s[i] == '/' || s[i] == ':' || s[i] == '\\' || s[i] == '<' ||
|
||||
s[i] == '>' || s[i] == '|' || s[i] == '*' || s[i] == '?')
|
||||
s[i] = '-';
|
||||
|
||||
if((dvr_flags & DVR_WHITESPACE_IN_TITLE) && s[i] == ' ')
|
||||
s[i] = '-';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -807,6 +807,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
|
|||
htsmsg_add_u32(r, "channelInTitle", !!(dvr_flags & DVR_CHANNEL_IN_TITLE));
|
||||
htsmsg_add_u32(r, "dateInTitle", !!(dvr_flags & DVR_DATE_IN_TITLE));
|
||||
htsmsg_add_u32(r, "timeInTitle", !!(dvr_flags & DVR_TIME_IN_TITLE));
|
||||
htsmsg_add_u32(r, "whitespaceInTitle", !!(dvr_flags & DVR_WHITESPACE_IN_TITLE));
|
||||
|
||||
out = json_single_record(r, "dvrSettings");
|
||||
|
||||
|
@ -837,6 +838,8 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
|
|||
flags |= DVR_DATE_IN_TITLE;
|
||||
if(http_arg_get(&hc->hc_req_args, "timeInTitle") != NULL)
|
||||
flags |= DVR_TIME_IN_TITLE;
|
||||
if(http_arg_get(&hc->hc_req_args, "whitespaceInTitle") != NULL)
|
||||
flags |= DVR_WHITESPACE_IN_TITLE;
|
||||
|
||||
dvr_flags_set(flags);
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ tvheadend.dvrsettings = function() {
|
|||
}, ['storage','postproc','retention','dayDirs',
|
||||
'channelDirs','channelInTitle',
|
||||
'dateInTitle','timeInTitle',
|
||||
'preExtraTime', 'postExtraTime']);
|
||||
'preExtraTime', 'postExtraTime', 'whitespaceInTitle']);
|
||||
|
||||
var confpanel = new Ext.FormPanel({
|
||||
title:'Digital Video Recorder',
|
||||
|
@ -503,6 +503,9 @@ tvheadend.dvrsettings = function() {
|
|||
}), new Ext.form.Checkbox({
|
||||
fieldLabel: 'Include time in title',
|
||||
name: 'timeInTitle'
|
||||
}), new Ext.form.Checkbox({
|
||||
fieldLabel: 'Replace whitespace in title with \'-\'',
|
||||
name: 'whitespaceInTitle'
|
||||
}), {
|
||||
width: 300,
|
||||
fieldLabel: 'Post-processor command',
|
||||
|
|
Loading…
Add table
Reference in a new issue