mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Created normalize method for video nodes only
Since no modification can happen to the theme naming.
This commit is contained in:
parent
a7310dc634
commit
560abbcc5d
2 changed files with 37 additions and 19 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue