Issue 1625 - Option for remove unsafe characters from filename while keeping Umlaute and other national characters

This commit is contained in:
Damian Gołda 2015-01-06 22:18:59 +01:00 committed by Jaroslav Kysela
parent 6f18074477
commit f8de301910
3 changed files with 11 additions and 0 deletions

View file

@ -64,6 +64,7 @@ typedef struct dvr_config {
int dvr_subtitle_in_title;
int dvr_episode_before_date;
int dvr_episode_duplicate;
int dvr_clean_samba_unsafe;
/* Series link support */
int dvr_sl_brand_lock;

View file

@ -727,6 +727,13 @@ const idclass_t dvr_config_class = {
.off = offsetof(dvr_config_t, dvr_whitespace_in_title),
.group = 5,
},
{
.type = PT_BOOL,
.id = "clean-samba-unsafe",
.name = "Replace Samba Unsafe Characters with '_'",
.off = offsetof(dvr_config_t, dvr_clean_samba_unsafe),
.group = 5,
},
{}
},
};

View file

@ -164,6 +164,9 @@ cleanup_filename(char *s, dvr_config_t *cfg)
((s[i] < 32) || (s[i] > 122) ||
(strchr("/:\\<>|*?'\"", s[i]) != NULL)))
s[i] = '_';
else if(cfg->dvr_clean_samba_unsafe &&
(strchr("/:\\<>|*?'\"", s[i]) != NULL))
s[i] = '_';
}
return s;