Feature #231 ยป cleanfilenames.patch
src/dvr/dvr.h (working copy) | ||
---|---|---|
43 | 43 |
#define DVR_WHITESPACE_IN_TITLE 0x20 |
44 | 44 |
#define DVR_DIR_PER_TITLE 0x40 |
45 | 45 |
#define DVR_EPISODE_IN_TITLE 0x80 |
46 |
#define DVR_CLEAN_TITLE 0x100 |
|
46 | 47 | |
47 | 48 |
typedef enum { |
48 | 49 |
DVR_PRIO_IMPORTANT, |
src/dvr/dvr_db.c (working copy) | ||
---|---|---|
154 | 154 |
{ |
155 | 155 |
struct tm tm; |
156 | 156 |
char buf[40]; |
157 |
int i; |
|
157 | 158 | |
158 | 159 |
if(dvr_flags & DVR_CHANNEL_IN_TITLE) |
159 | 160 |
snprintf(output, outlen, "%s-", de->de_channel->ch_name); |
... | ... | |
187 | 188 |
".E%02d", |
188 | 189 |
de->de_episode.ee_episode); |
189 | 190 |
} |
191 | ||
192 |
if(dvr_flags & DVR_CLEAN_TITLE) { |
|
193 |
for (i=0;i<strlen(output);i++) { |
|
194 |
if ( |
|
195 |
output[i]<32 || |
|
196 |
output[i]>122 || |
|
197 |
output[i]==34 || |
|
198 |
output[i]==39 || |
|
199 |
output[i]==92 || |
|
200 |
output[i]==58 |
|
201 |
) output[i]='_'; |
|
202 |
} |
|
203 |
} |
|
190 | 204 |
} |
191 | 205 | |
192 | 206 |
src/webui/static/app/dvr.js (working copy) | ||
---|---|---|
564 | 564 |
'channelDirs','channelInTitle', |
565 | 565 |
'dateInTitle','timeInTitle', |
566 | 566 |
'preExtraTime', 'postExtraTime', 'whitespaceInTitle', |
567 |
'titleDirs', 'episodeInTitle']); |
|
567 |
'titleDirs', 'episodeInTitle','cleanTitle']);
|
|
568 | 568 | |
569 | 569 |
var confpanel = new Ext.FormPanel({ |
570 | 570 |
title:'Digital Video Recorder', |
... | ... | |
609 | 609 |
fieldLabel: 'Include channel name in filename', |
610 | 610 |
name: 'channelInTitle' |
611 | 611 |
}), new Ext.form.Checkbox({ |
612 |
fieldLabel: 'Remove all unsafe characters from filename', |
|
613 |
name: 'cleanTitle' |
|
614 |
}), new Ext.form.Checkbox({ |
|
612 | 615 |
fieldLabel: 'Include date in filename', |
613 | 616 |
name: 'dateInTitle' |
614 | 617 |
}), new Ext.form.Checkbox({ |
src/webui/extjs.c (working copy) | ||
---|---|---|
821 | 821 |
htsmsg_add_u32(r, "whitespaceInTitle", !!(dvr_flags & DVR_WHITESPACE_IN_TITLE)); |
822 | 822 |
htsmsg_add_u32(r, "titleDirs", !!(dvr_flags & DVR_DIR_PER_TITLE)); |
823 | 823 |
htsmsg_add_u32(r, "episodeInTitle", !!(dvr_flags & DVR_EPISODE_IN_TITLE)); |
824 |
htsmsg_add_u32(r, "cleanTitle", !!(dvr_flags & DVR_CLEAN_TITLE)); |
|
824 | 825 | |
825 | 826 |
out = json_single_record(r, "dvrSettings"); |
826 | 827 | |
... | ... | |
847 | 848 |
flags |= DVR_DIR_PER_CHANNEL; |
848 | 849 |
if(http_arg_get(&hc->hc_req_args, "channelInTitle") != NULL) |
849 | 850 |
flags |= DVR_CHANNEL_IN_TITLE; |
851 |
if(http_arg_get(&hc->hc_req_args, "cleanTitle") != NULL) |
|
852 |
flags |= DVR_CLEAN_TITLE; |
|
850 | 853 |
if(http_arg_get(&hc->hc_req_args, "dateInTitle") != NULL) |
851 | 854 |
flags |= DVR_DATE_IN_TITLE; |
852 | 855 |
if(http_arg_get(&hc->hc_req_args, "timeInTitle") != NULL) |