mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +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,7 +190,26 @@ def CleanName(filename):
|
||||||
return ''.join(c for c in cleanedFilename if c in validFilenameChars)
|
return ''.join(c for c in cleanedFilename if c in validFilenameChars)
|
||||||
|
|
||||||
def normalize_string(text):
|
def normalize_string(text):
|
||||||
try:
|
# 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("\\", "-")
|
||||||
|
@ -206,8 +225,7 @@ def normalize_string(text):
|
||||||
# with dots at the end
|
# with dots at the end
|
||||||
text = text.rstrip('.')
|
text = text.rstrip('.')
|
||||||
text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore')
|
text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore')
|
||||||
except:
|
|
||||||
pass
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class VideoNodes():
|
||||||
def buildVideoNodeForView(self, tagname, type, windowPropId):
|
def buildVideoNodeForView(self, tagname, type, windowPropId):
|
||||||
#this method will build a video node for a particular Emby view (= tag in kodi)
|
#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)
|
#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)
|
libraryPath = xbmc.translatePath("special://profile/library/video/Emby - %s/" %tagname_normalized)
|
||||||
kodiVersion = 14
|
kodiVersion = 14
|
||||||
|
|
Loading…
Reference in a new issue