diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index 9413a0c6..5d08abc2 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -42,6 +42,7 @@ extern struct dvr_entry_list dvrentries; #define DVR_WHITESPACE_IN_TITLE 0x20 #define DVR_DIR_PER_TITLE 0x40 #define DVR_EPISODE_IN_TITLE 0x80 +#define DVR_CLEAN_TITLE 0x100 typedef enum { DVR_PRIO_IMPORTANT, diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 2ffa3c34..7b124102 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -154,6 +154,7 @@ dvr_make_title(char *output, size_t outlen, dvr_entry_t *de) { struct tm tm; char buf[40]; + int i; if(dvr_flags & DVR_CHANNEL_IN_TITLE) snprintf(output, outlen, "%s-", de->de_channel->ch_name); @@ -187,6 +188,19 @@ dvr_make_title(char *output, size_t outlen, dvr_entry_t *de) ".E%02d", de->de_episode.ee_episode); } + + if(dvr_flags & DVR_CLEAN_TITLE) { + for (i=0;i122 || + output[i]==34 || + output[i]==39 || + output[i]==92 || + output[i]==58 + ) output[i]='_'; + } + } } diff --git a/src/webui/extjs.c b/src/webui/extjs.c index b22e88c2..b7276d97 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -820,6 +820,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque) htsmsg_add_u32(r, "whitespaceInTitle", !!(dvr_flags & DVR_WHITESPACE_IN_TITLE)); htsmsg_add_u32(r, "titleDirs", !!(dvr_flags & DVR_DIR_PER_TITLE)); htsmsg_add_u32(r, "episodeInTitle", !!(dvr_flags & DVR_EPISODE_IN_TITLE)); + htsmsg_add_u32(r, "cleanTitle", !!(dvr_flags & DVR_CLEAN_TITLE)); out = json_single_record(r, "dvrSettings"); @@ -846,6 +847,8 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque) flags |= DVR_DIR_PER_CHANNEL; if(http_arg_get(&hc->hc_req_args, "channelInTitle") != NULL) flags |= DVR_CHANNEL_IN_TITLE; + if(http_arg_get(&hc->hc_req_args, "cleanTitle") != NULL) + flags |= DVR_CLEAN_TITLE; if(http_arg_get(&hc->hc_req_args, "dateInTitle") != NULL) flags |= DVR_DATE_IN_TITLE; if(http_arg_get(&hc->hc_req_args, "timeInTitle") != NULL) diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 7121138f..5b58ba13 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -566,7 +566,7 @@ tvheadend.dvrsettings = function() { 'channelDirs','channelInTitle', 'dateInTitle','timeInTitle', 'preExtraTime', 'postExtraTime', 'whitespaceInTitle', - 'titleDirs', 'episodeInTitle']); + 'titleDirs', 'episodeInTitle','cleanTitle']); var confpanel = new Ext.FormPanel({ title:'Digital Video Recorder', @@ -610,6 +610,9 @@ tvheadend.dvrsettings = function() { }), new Ext.form.Checkbox({ fieldLabel: 'Include channel name in filename', name: 'channelInTitle' + }), new Ext.form.Checkbox({ + fieldLabel: 'Remove all unsafe characters from filename', + name: 'cleanTitle' }), new Ext.form.Checkbox({ fieldLabel: 'Include date in filename', name: 'dateInTitle'