Add '[ ] Remove all unsafe characters from filename' checkbox for DVR recordings.

Good if you are on a CIFS share or anything else from the 1980's

Ticket #231
This commit is contained in:
Andreas Öman 2010-08-19 19:40:25 +00:00
parent b9e8cc608b
commit 3ec3157e49
4 changed files with 22 additions and 1 deletions

View file

@ -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,

View file

@ -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;i<strlen(output);i++) {
if (
output[i]<32 ||
output[i]>122 ||
output[i]==34 ||
output[i]==39 ||
output[i]==92 ||
output[i]==58
) output[i]='_';
}
}
}

View file

@ -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)

View file

@ -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'