mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
better way to clean file names
This commit is contained in:
parent
dd192391c4
commit
59f83c4034
1 changed files with 6 additions and 11 deletions
|
@ -100,7 +100,7 @@ class CreateFiles():
|
||||||
if str(item.get("ParentIndexNumber")) != None:
|
if str(item.get("ParentIndexNumber")) != None:
|
||||||
filenamestr = self.CleanName(utils.convertEncoding(item.get("SeriesName"))) + " S" + str(item.get("ParentIndexNumber")) + "E" + str(item.get("IndexNumber")) + " (" + item["Id"] + ").nfo"
|
filenamestr = self.CleanName(utils.convertEncoding(item.get("SeriesName"))) + " S" + str(item.get("ParentIndexNumber")) + "E" + str(item.get("IndexNumber")) + " (" + item["Id"] + ").nfo"
|
||||||
else:
|
else:
|
||||||
filenamestr = self.CleanName(utils.convertEncoding(item.get("SeriesName"))) + " S0E0 " + utils.convertEncoding(self.CleanName(item["Name"])) + " (" + item["Id"] + ").nfo"
|
filenamestr = self.CleanName(utils.convertEncoding(item.get("SeriesName"))) + " S0E0 " + self.CleanName(utils.convertEncoding(item["Name"])) + " (" + item["Id"] + ").nfo"
|
||||||
nfoFile = os.path.join(itemPath,filenamestr)
|
nfoFile = os.path.join(itemPath,filenamestr)
|
||||||
rootelement = "episodedetails"
|
rootelement = "episodedetails"
|
||||||
|
|
||||||
|
@ -297,13 +297,8 @@ class CreateFiles():
|
||||||
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
|
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
|
||||||
xbmcvfs.copy(themeUrl,themeFile)
|
xbmcvfs.copy(themeUrl,themeFile)
|
||||||
|
|
||||||
def CleanName(self, name):
|
def CleanName(self, filename):
|
||||||
name = name.replace(":", "-")
|
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
|
||||||
name = name.replace("\\", "-")
|
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore')
|
||||||
name = name.replace("/", "-")
|
return ''.join(c for c in cleanedFilename if c in validFilenameChars)
|
||||||
name = name.replace("*", "-")
|
|
||||||
name = name.replace("?", "-")
|
|
||||||
name = name.replace("<", "-")
|
|
||||||
name = name.replace(">", "-")
|
|
||||||
name = name.replace("|", "-")
|
|
||||||
return name
|
|
||||||
|
|
Loading…
Reference in a new issue