diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 82dea3a4..2faecae7 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -190,24 +190,42 @@ def CleanName(filename): return ''.join(c for c in cleanedFilename if c in validFilenameChars) def normalize_string(text): - try: - text = text.replace(":", "") - text = text.replace("/", "-") - text = text.replace("\\", "-") - text = text.replace("<", "") - text = text.replace(">", "") - text = text.replace("*", "") - text = text.replace("?", "") - text = text.replace('|', "") - text = text.replace('(', "") - text = text.replace(')', "") - text = text.strip() - # Remove dots from the last character as windows can not have directories - # with dots at the end - text = text.rstrip('.') - text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore') - except: - pass + # For theme media, do not modify unless + # modified in TV Tunes + text = text.replace(":", "") + text = text.replace("/", "-") + text = text.replace("\\", "-") + text = text.replace("<", "") + text = text.replace(">", "") + text = text.replace("*", "") + text = text.replace("?", "") + text = text.replace('|', "") + text = text.strip() + # Remove dots from the last character as windows can not have directories + # with dots at the end + text = text.rstrip('.') + text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore') + + return text + +def normalize_nodes(text): + # For video nodes + text = text.replace(":", "") + text = text.replace("/", "-") + text = text.replace("\\", "-") + text = text.replace("<", "") + text = text.replace(">", "") + text = text.replace("*", "") + text = text.replace("?", "") + text = text.replace('|', "") + text = text.replace('(', "") + text = text.replace(')', "") + text = text.strip() + # Remove dots from the last character as windows can not have directories + # with dots at the end + text = text.rstrip('.') + text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore') + return text diff --git a/resources/lib/VideoNodes.py b/resources/lib/VideoNodes.py index 7e3076ee..1a957af1 100644 --- a/resources/lib/VideoNodes.py +++ b/resources/lib/VideoNodes.py @@ -27,7 +27,7 @@ class VideoNodes(): def buildVideoNodeForView(self, tagname, type, windowPropId): #this method will build a video node for a particular Emby view (= tag in kodi) #we set some window props here to for easy future reference and to be used in skins (for easy access only) - tagname_normalized = utils.normalize_string(tagname) + tagname_normalized = utils.normalize_nodes(tagname) libraryPath = xbmc.translatePath("special://profile/library/video/Emby - %s/" %tagname_normalized) kodiVersion = 14