mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
another attempt at Theme music
For illegal characters - following the same pattern as TV Tunes to make sure we match 100%
This commit is contained in:
parent
678efedd30
commit
ae07e1b4c6
2 changed files with 16 additions and 2 deletions
|
@ -174,12 +174,12 @@ def getThemeMedia():
|
|||
for item in result[u'Items']:
|
||||
itemId = item[u'Id']
|
||||
folderName = item[u'Name']
|
||||
folderName = xbmc.makeLegalFilename(folderName)
|
||||
folderName = utils.normalize_string(folderName)
|
||||
itemIds[itemId] = folderName
|
||||
|
||||
# Get paths
|
||||
for itemId in itemIds:
|
||||
nfo_path = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/%s" % itemIds[itemId])
|
||||
nfo_path = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/%s/" % itemIds[itemId])
|
||||
# Create folders for each content
|
||||
if not xbmcvfs.exists(nfo_path):
|
||||
xbmcvfs.mkdir(nfo_path)
|
||||
|
|
|
@ -160,6 +160,20 @@ def CleanName(filename):
|
|||
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore')
|
||||
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.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
|
||||
return text
|
||||
|
||||
|
||||
def reset():
|
||||
|
||||
|
|
Loading…
Reference in a new issue