From ebdc154d566cf784755449206298d6c2c6d399e6 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Tue, 14 Jun 2016 23:09:30 +0100 Subject: [PATCH] Add config.ini file only setting "remove_filename_chars". To initialise, 1) At General config page, press 'Save' then 'Shutdown' SG 2) Open config.ini in a text editor, find and edit remove_filename_chars = "" e.g. remove_filename_chars = "'" 3) Save config.ini and start SG. With the example given, the ' character will not appear in file names. --- sickbeard/__init__.py | 5 ++++- sickbeard/helpers.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index cee74561..20fe3698 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -224,6 +224,7 @@ BACKLOG_DAYS = 7 SEARCH_UNAIRED = False ADD_SHOWS_WO_DIR = False +REMOVE_FILENAME_CHARS = None CREATE_MISSING_SHOW_DIRS = False RENAME_EPISODES = False AIRDATE_EPISODES = False @@ -535,7 +536,7 @@ def initialize(consoleLogging=True): GUI_NAME, DEFAULT_HOME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, EPISODE_VIEW_LAYOUT, EPISODE_VIEW_SORT, EPISODE_VIEW_DISPLAY_PAUSED, EPISODE_VIEW_MISSED_RANGE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, \ POSTER_SORTBY, POSTER_SORTDIR, \ METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, REQUIRE_WORDS, CALENDAR_UNPROTECTED, CREATE_MISSING_SHOW_DIRS, \ - ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \ + ADD_SHOWS_WO_DIR, REMOVE_FILENAME_CHARS, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \ USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, TMDB_API_KEY, DEBUG, PROXY_SETTING, PROXY_INDEXERS, \ AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \ ANIME_DEFAULT, NAMING_ANIME, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \ @@ -771,6 +772,7 @@ def initialize(consoleLogging=True): NFO_RENAME = bool(check_setting_int(CFG, 'General', 'nfo_rename', 1)) CREATE_MISSING_SHOW_DIRS = bool(check_setting_int(CFG, 'General', 'create_missing_show_dirs', 0)) ADD_SHOWS_WO_DIR = bool(check_setting_int(CFG, 'General', 'add_shows_wo_dir', 0)) + REMOVE_FILENAME_CHARS = check_setting_str(CFG, 'General', 'remove_filename_chars', '') SAB_USERNAME = check_setting_str(CFG, 'SABnzbd', 'sab_username', '') SAB_PASSWORD = check_setting_str(CFG, 'SABnzbd', 'sab_password', '') @@ -1512,6 +1514,7 @@ def save_config(): new_config['General']['airdate_episodes'] = int(AIRDATE_EPISODES) new_config['General']['create_missing_show_dirs'] = int(CREATE_MISSING_SHOW_DIRS) new_config['General']['add_shows_wo_dir'] = int(ADD_SHOWS_WO_DIR) + new_config['General']['remove_filename_chars'] = REMOVE_FILENAME_CHARS new_config['General']['extra_scripts'] = '|'.join(EXTRA_SCRIPTS) new_config['General']['git_path'] = GIT_PATH diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 52b55b88..33327e3c 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -167,6 +167,9 @@ def sanitizeFileName(name): # remove leading/trailing periods and spaces name = name.strip(' .') + for char in sickbeard.REMOVE_FILENAME_CHARS or []: + name = name.replace(char, '') + return name